Enhanced Java String Literals round 2

Brian Goetz brian.goetz at oracle.com
Fri Jan 4 15:48:29 UTC 2019

Thanks Reinier.  This is all very sensible.  

I’ll just make one comment on where you make me nervous: 

> 3. The syntactic structure R"stuff here" is officially known as the 'regexp
> literal syntax'... and the type of such an expression is j.u.r.Pattern and
> not j.l.String. 

This is cute (though the bike shed painters would probably ask “why isn’t that spelled /pattern/“ instead), but I worry that this would end up being a glass half empty — “why is this only for regex, why can’t I have literals for arbitrary types.”  (I hear Stephen’s keyboard clacking as we speak, reminding us about date-time literals.)  

I would rather not go down the road of an ad-hoc convention that “R” means regex,and then nail additional ad-hoc conversions on the side later; I’d rather either say “strings are strings” or have a general mechanism for structured literals.  And given that structured literals are probably a much bigger project than raw strings, I would rather stick to raw strings for now.

More information about the amber-dev mailing list