[Nix-dev] Should I revert my last Eclipse patch or shall I extend the expression?

Marc Weber marco-oweber at gmx.de
Sat Apr 24 04:41:23 CEST 2010


> Hi Marc,
> That is way, way to complicated. There is absolutely no need
> whatsoever to adopt such a complex approach.
> 
> You need to adopt the positive method of : "If it is constant and does
> exist, do something else exit."
> Not, wild card, haystack, yes/no.

Tony, you should think about it in a different way.
Think about it as a poor mans switch because Nix doesn't have it.

Why was switch invented?

if a = 10  print "a is 10"
else if a = 20 print "a is 20"
else if ...

Which is the repeating pattern?
a =

How can you avoid writing it?

switch a of
  10: print "a is 10"; [break]
  20: print "a is 20"; [break]

Do you consider this being way, way too complicated as well?

And I'd even say its easier to read. But that's my point of view.

Marc Weber



More information about the nix-dev mailing list