[erlang-questions] extend parser to allow single quotes in variable names (or: "let's confuse the text editors!")

Motiejus Jakštys desired.mta@REDACTED
Sun Oct 7 23:50:02 CEST 2012


On Mon, Oct 08, 2012 at 10:44:45AM +1300, Richard O'Keefe wrote:
> 
> On 8/10/2012, at 5:35 AM, Motiejus Jakštys wrote:
> 
> > Hi,
> > 
> > In Haskell you can have variable names with single quotes. Imagine for a
> > moment you are in a perfect world:
> > 
> > oops() ->
> >    A = 1024,
> >    A' = math:log(A) / math:log(2),
> >    io:format("Wow! ~p~n", [A']).
> > 
> > What would you think about this extension?
> 
> I would think it was pointless.
> 
> Haskell			Erlang
> x			X
> x'			X1
> x''			X2
> x'''			X3
> x''''			X4
> x'''''			X5
> 
> Spot the pattern?
> 
> Haskell (or at least GHC) allows primes inside identifiers too,
> but nobody seems to take advantage of that.
> 
> Consider f'x 'y'.  Want to read _that_ fast?
> Consider f'x' y'.  Want to tell them apart fast?

Whoosh! This reasoning is just perfect. I never want to see code like
this. Thanks.

Motiejus



More information about the erlang-questions mailing list