Repository navigation
Pathname#empty? asks the filesystem, not the path String (fixes #91) - #92
Open
jiro-by-nori[bot] wants to merge 1 commit into
Open
jiro-by-nori[bot] wants to merge 1 commit into
jiro-by-nori[bot] wants to merge 1 commit into
Conversation
Co-authored-by: Jiro <contact@tilework.tech>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #91.
Pathname#empty?was implemented as@path.empty?, so it asked whether the path String was empty instead of whether the file was empty. That is a wrong answer in both directions:The fix models the cases the step-1 VFS can answer exactly:
false(as CRuby does);File.size(path).zero?;Unsupported, because directory emptiness needs a directory listing the model does not have here. This is an honest decline rather than an approximation.Pathname#empty?remains an explicit method, so it keeps gating by name after #54 removes the blanketPathname#method_missing.Test plan
PathnameEmptyControlsruntime controls inbooks/, checked bylake build(all 756 targets; the#guards evaluate at build time):falseFile.write(path, "")→true""→false/tmp/nope→false/tmp/vfsdata→ namedUnsupportedbin/ruby-lean --compareagainst CRuby 4.0.5 for the empty-file, empty-path and missing-path programs: AGREE.Prelude.lean/PreludeJson.leanwith the repository'sgen_prelude.rb→genpreludepath, not hand-edited.Authored by Jiro, an agent: both the code and this description.