Skip to content
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

Eliminate the dollar sign hack #203

Merged
merged 4 commits into from
Jul 7, 2017
Merged

Eliminate the dollar sign hack #203

merged 4 commits into from
Jul 7, 2017

Conversation

RyanGlScott
Copy link
Collaborator

singletons currently special-cases a lot of operations for names that begin with $. It has been the center of a spider's nest of bugs (see #29, #160 (comment), #172, and #197 for examples).

This PR rips out the hack, and improves the situation surrounding defunctionalization symbols, which use $ characters as suffixes. We now precede the defunctionalized $s with the string @#$%^%$#@ (as suggested in #197 (comment)). This allows use to promote ($) and ($!) without any special-casing at all. Huzzah!

README.md Outdated
@@ -433,7 +433,7 @@ There are some special cases:

singleton constructr: `SCons`

symbols: `ConsSym0`, `ConsSym1`
symbols: `:@#$%^%$#@$`, `:@#$%^%$#@$`
Copy link
Collaborator Author

@RyanGlScott RyanGlScott Jun 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I didn't change conventions here! I checked, and it turns out the defunctionalization symbols for (:) weren't actually named ConsSym0 and ConsSym1 at all, but rather (:$) and (:$$). I just opted to update this reference to be correct here, since I happened to change what (:$) and (:$$) were named.

@RyanGlScott
Copy link
Collaborator Author

The downside to this is that now defunctionalization symbols are obscenely long and hard to remember. Perhaps we ought to provide a convenience function of type Name -> Q Type which gives you the appropriate defunctionalization symbol on demand?

@goldfirere
Copy link
Owner

This diff is ugly. Is there an intermediate solution, something without quite so many symbols? Like, maybe 2-3 arbitrary symbols will be enough in practice. (Note that if someone wrote a normal identifier that happened to end in Sym0, we'd hit a similar problem with alpha identifiers.) In any case, you're free to merge this, but if it's easy to shorten the glyph string, that would seem to be an improvement.

@RyanGlScott
Copy link
Collaborator Author

Indeed, I'm not claiming this will eliminate naming conflicts altogether (ultimately, we'd need something like #204 to work around that robustly), but it will certainly make it less likely.

How about @#@ instead for the suffix?

@RyanGlScott RyanGlScott merged commit 74c9997 into goldfirere:master Jul 7, 2017
@RyanGlScott RyanGlScott deleted the dollar-dollar-hacks-yall branch July 7, 2017 21:42
@goldfirere
Copy link
Owner

@#@ is great. Thanks!

RyanGlScott added a commit that referenced this pull request Jul 31, 2017
* Suffix symbol defun symbols with @#$%^%0@

* Eliminate the dollar-sign hack

* ConsSym0 and ConsSym1 aren't actually things, update them

* Use the suffix @#@ instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants