-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more correct emulation of \box and \copy primitives #2480
Open
dginev
wants to merge
6
commits into
brucemiller:master
Choose a base branch
from
dginev:box-primitive-patches
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0145e84
more correct emulation of \box and \copy primitives
dginev a70a295
explicit use of Clone module
dginev f564f53
use tex quotes in test
dginev ecbc892
perldoc for removeValue
dginev d4285a3
ensure \box does not unbind outer values when used twice in a frame
dginev 8655d3f
idempotent value removal by checking key-exists and a 0 undo value
dginev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Binary file not shown.
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use this code to implement
scope => 'samelevel'
assignments (with a better name, if you can find it), which would be equivalent toremoveValue
when assigning\undef
. Should you one day discover another assignment 'in place'.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's also a possibility. My main worry is that
assign_internal
is already somewhat entangled, so adding more to it just makes life harder... Will wait for feedback from Bruce.I enjoy the idea of having a dedicated removal method, for what that's worth. But since the removal isn't global, the name is a bit misleading. It's really
UnbindLastValueAssignment
, but this is not a Java project...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking the opposite: this code is very similar to
assign_internal
and would be better placed there for ease of maintainance... ?I am also wondering if removing values has other side effects, e.g. will this make
\ifcsname
false? That's not really possible in TeX, is it? (This has no real consequence of course sinceremoveValue
is only used for the box registers.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only if it can be DRY ("do not repeat yourself"). Otherwise just growing the body of the function will make it more impenetrable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going back to the DRY idea, couldn't this code be folded into the global assignment? If I parse correctly, your new code and global assignment differ by only two lines (
last;
and$$frame{value}{$key} = 0
). So asamelevel
scope could be implemented by adding the linelast if $samelevel
inassign_internal
(but it wouldn't remove the value as you do here, of course).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am open to the idea.
Would likely seek a slightly better name ... To fit better with
global
andlocal
, maybeinitial
is a good keyword? Fishing for inspiration from CSS initialThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that
samelevel
is a terrible name... let's think about how one could document the new scope. The assignment in scopesamelevel
means something like:$name
was assigned a value (solast
?)$name
received its current value/the current definition of$name
was made (socurrent_def
orcurrent_value
?)$name
was assigned the current value (sosame
?)$name
was initially assigned the current value (soinitial
?)I am not totally convinced by
initial
. It sounds too similar to global.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the primary purpose we'll use this for is still "removing" or "unsetting" the value (CSS has an "unset" property related to initial which also comes to mind). So having an associated
scope=>"unset"
could also be intuitive when looked at (+ documented) from the right perspective, if the "initial" is too confusing. The thing that bothers me a little is that such calls really don't take a "value" argument, so unifying the interfaces will be inevitably clunky. So I can also see as reasonable to keep the code paths separate.