kill "if" and "case" instead! [was Re: Enhanced type guard syntax]

Peter-Henry Mander <>
Fri Sep 19 08:57:29 CEST 2003


Hi Joe and the Gurus,

Joe Armstrong wrote:

>   Adding  guards  like  this   violates  one  of  my  favorite  design
> meta-principles:
> 
>   " If  you add something  to a language  you have to  chuck something
> away "
> 
>   What are we going to chuck away?
> 
>   Well not "when ->" ...

Maybe I just weird, but I don't find "when ->" offensive in the least. 
What's fundamentally wrong with it? It does a lot that can't be done 
otherwise, and seems to me to be othogonal to other language features.

Syntactic sugar only makes a language fat.

>   Can we please start checking stuff away to make the language simple.

In this case, may I propose that "if" and "case" were stuffed into the 
blender? They're _not_ orthogonal to other features!

I cannot find any solid argument toward keeping and using them when 
writing equivalent code using functions alone makes (at least my) code 
much less prone to the Dreaded Indent pushing against the right margin. 
Not mentioning that the resulting function names can be well chosen too.

>   To hasten this process I'd like to add a new declaration to the
> the language.
> 
>   All modules should start.
> 
> 	  -needsErlangVersion(N).
> 
>   	  Where N is the language version.

Yes. I like this idea. In its absence, does it default to the version of 
todays Erlang?

>   They type y - and the system gets the latest version of the system
> and installs it for them :-)

That sounds horribly like Windows Update! Surely we can assume that 
users know where to get the latest version of Erlang? Or am I being 
presumtious?

>   Then once we have got the versioning in we can start chucking things
> away.
...
> You only need spawn(fun() -> ...)

As I discovered recently, it's much cleaner. Yes, I'm a slow learner, 
(-: but I haven't had the benefit of a good training course )-: Bloody 
finances!

Pete.






More information about the erlang-questions mailing list