[erlang-questions] Hungarian notation for Erlang / ETL

Dominic Williams erlang@REDACTED
Wed Jan 9 15:33:12 CET 2008

Hi Zvi,

> Is there some kind of Hungarian notation for Erlang?
> i.e. prefix or postfix naming convention.  As Erlang has
> dynamic typing and somewhat confuzed about string datatype, I
> constantly make errors when mixing lists and binary strings.

To my knowledge there is no conventional hungarian-like
notation for Erlang, and I believe that would definitely not
be the solution to type confusion.

I think the best way to embrace dynamic typing is to use
test-driven development. When you only ever write code to a
failing test, you will catch type errors immediately.

With this as a safety net, type "confusion" can actually be seen
as an advantage: call it type "abstraction" and write functions
without caring too much about the type. You will end up with many
functions that turn out working regardless of whether they are
passed a string or a binary (especially functions that operate on
heterogenous lists). Less code, and better separation of concerns
(functions are algorithms, data is separate).

> Another question: is there something like C++ STL in Erlang?
> I.e. ADTs conforming to the same behavior(s). The behavior
> should implement all the HOFs and generic algorithms, instead
> of STL iterators.

The equivalent to STL iterators and algorithms is to use lists,
list comprehensions and higher-order functions (lists:foreach/2
etc). There are some ADT's in Erlang (check out dict, orddict,
set and ordset modules).


Dominic Williams


More information about the erlang-questions mailing list