On Aug 27, 2019, at 01:42, Chris Angelico <ros...@gmail.com> wrote:
> 
> Will these "custom
> prefixes" be able to define anything syntactically? If not, why not
> just use a function call? And if they can, then you have created an
> absolute monster, where a v-string in one context can have completely
> different syntactic influence on what follows it than a v-string in
> another context.

There is a possibility in between the two extremes of “useless” and “complete 
monster”: the prefix accepts exactly one token, but can parse that token 
however it wants.

That’s pretty close to what C++ does, and pretty close to the way my hacky 
proof of concept last time around worked, and I don’t think that only works 
because those are suffix-only designs. 

(That being said, if you do allow “really raw” string literals as input to the 
user prefixes/suffixes to handle the path'C:\' case, then it’s possible to 
invent cases that would tokenize differently with and without the feature—in 
fact. I just did—and therefore it _might_ be possible to invent cases that 
parse validly but differently, in which case the monster is lurking after all. 
Someone might want to look more carefully at the C++ rules for that?)
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/GLZPVGS5NSWZ64DJMQBPETZFT3TDJEGH/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to