[erlang-questions] Why do we need modules at all?
Nicolai Waniek
rochus@REDACTED
Tue May 24 11:00:19 CEST 2011
Hi,
> - do away with modules
If you want to get rid of modules you might want to have something like
proper namespaces to place names into, because
> - all functions have unique distinct names
won't really work. Examples were already given (sort, replace,
compression, etc) but will be easily extended to other functions as
well, so you probably have to provide something to prevent a prefix-mess.
Additionally, when thinking about something like removing modules but
adding namespaces you might want to add some way to tell the compiler
that every function invoked in the next function is from one specific
namespace. Somewhat like C++ namespaces work (I don't say exactly as C++
namespaces work, just to get an idea...).
> - all functions have (lots of) meta data
As soon as you start to define functions with meta-data, wouldn't it be
easier to simply invent a type system as, say, Haskell uses to prevent
meta-data? I like functions short and nice, bloating them with meta-data
won't do any good.
> - all functions go into a global (searchable) Key-value database
You would have to provide a way to go back to older 'revisions' of your
key-value database. For example you introduce a new function that breaks
some stuff (bug wasn't found when doing peer-review), you'd like to be
able to revert to an older state, or easily bisect your code. This could
be accomplished by seeing the key-value database in a functional manner:
it's immutable. If you want to introduce a new function, the new one
gets a new tag/whatever and a new function-db will replace the whole old
one. Therefore you can simply step through your function-database when
things go wrong.
Regards,
Nicolai
More information about the erlang-questions
mailing list