Re: [racket-users] How to disallow certain characters in identifiers?

2018-12-20 Thread Ryan Kramer
Interesting. I had never heard of 3d syntax before. But I'm not sure what advantage 3d syntax would get me here. If I have to write my own custom version of "define", couldn't it just as easily detect a dot in a regular syntax object? On Wednesday, December 19, 2018 at 6:29:22 PM UTC-6, Milo

Re: [racket-users] How to disallow certain characters in identifiers?

2018-12-19 Thread Milo Turner
Another option, which probably has a lot of terrible consequences, is to transform "a.b" into "3-d syntax" (a struct embedded in syntax) that can now be interpreted differently by forms that are interested. For instance a custom "define" could grab the 3d-syntax in the name and use it to make a

Re: [racket-users] How to disallow certain characters in identifiers?

2018-12-11 Thread Ryan Kramer
Thanks for your response Alexis. You are right: once I figured out the correct way to customize the reader, the rest fell into place much more easily. Now, when my reader sees a dot it asks the base reader to read another piece of syntax, which must be an identifier. So (define a.b 3) becomes

Re: [racket-users] How to disallow certain characters in identifiers?

2018-12-10 Thread Alexis King
I think your initial instinct was right: if you want to change the lexical structure of your language, the right place to start is in the reader. The reader is the part of Racket’s language facilities that interprets the structure of sequences of characters, and your notion of dotted

Re: [racket-users] How to disallow certain characters in identifiers?

2018-12-10 Thread Ryan Kramer
It turns out expanding the syntax object isn't the right approach. It seems easy enough for defining values and simple procedures, but as soon as you consider optional arguments and keyword arguments, the resulting expansion gets too complicated to analyze. I don't see an easy way to do this,

Re: [racket-users] How to disallow certain characters in identifiers?

2018-12-10 Thread default . kramer
Thanks Matthew, I think I can adapt that approach. As written, it's not quite what I had in mind because it disallows foo.bar in an expression context, before I get a chance to transform it to (bar foo). So I am going to try to (expand #'(module a racket . EXPRS)) and then search the

Re: [racket-users] How to disallow certain characters in identifiers?

2018-12-10 Thread Matthew Butterick
> On Dec 9, 2018, at 8:20 PM, default.kra...@gmail.com wrote: > Is there an easy way to disallow certain characters in identifiers? I > realized it's not just dots I want to disallow, but also operators like + > which might be interpreted as infix in certain contexts. Roughly, I imagine you'd

[racket-users] How to disallow certain characters in identifiers?

2018-12-09 Thread default . kramer
I am trying to make a language based on Racket in which a.b would not be allowed as an identifier, rather it would expand to something like (b a). Seems like a job for read-cdot, right? Well I quickly learned it's not that simple. With read-cdot on (define a.b 3) is not an error, rather it