Erlang is getting too big

Vance Shipley vances@REDACTED
Mon Oct 13 21:34:26 CEST 2003


On Mon, Oct 13, 2003 at 07:49:55PM +0100, Sean Hinde wrote:
}  
}  On Monday, October 13, 2003, at 07:22  pm, Vance Shipley wrote:
}  >
}  >I could't agree more.  The fact that if one were to want to take Erlang
}  >for a test drive that they would find themselves building things with
}  >Java, CORBA, SNMP, etc. is exactly what Sean is warning about.
}  
}  Err, actually it isn't. This is what Joe is worrying about. I am more 
}  concerned about there being so much syntax - wayyy before getting as 
}  far as libraries.

OK, however I believe it has the same effect.

}  But then what would distinguish it from the other 500 languages out 
}  there? This needs a book, or a lightweight way into OTP, not discarding 
}  it.

I certainly have no interest in discarding OTP!  It is OTP which drew me
to Erlang in the first place.   By having an Erlang without an OTP I
believe it makes it much clearer what OTP is.

}  To join begin ... end, which I've never figured out the point of?

I've used begin before in this sort of way:

   init() ->
      case catch begin
         case foo:init() of
            ok -> ok;
            _ -> throw(foo)
         end,
         case bar:init() of
            ok -> ok;
            _ -> throw(bar)
         end,
      end of
         ok -> ok;
         Error -> io:fwrite("module ~w failed to initialize~n", [Module])
      end.

That's not really a good example of the "Erlang way" of error handling
however it demonstrates the use of 'begin'.

Good examples are the best way of demonstrating the application of these
things.  I think the following is a good one.

For a long time I couldn't figure out what 'if' brought to the table.
It seemed totally redundant with 'case'.  Over the years I have used 
'if' more and more.  A few days ago I wrote the following and was very
happy with the clear expressiveness it achieved:

   if
      not ConnectionOriented and not SequenceControl -> Class = 0;
      not ConnectionOriented and SequenceControl -> Class = 1;
      ConnectionOriented and not SequenceControl -> Class = 2;
      ConnectionOriented and SequenceControl -> Class = 3
   end,

Yes, it could have been written using case:

   case ConnectionOriented of
      false ->
         case SequenceControl of
            false ->
               Class = 0;
            true ->
               Class = 1
         end;
      true ->
         case SequenceControl of
            false ->
               Class = 2;
            true ->
               Class = 3
         end
   end,

I think you'll agree the former is much clearer.


	-Vance



More information about the erlang-questions mailing list