[erlang-questions] How about a new warning? Was: Re: trouble with erlang or erlang is a ghetto
Mon Aug 8 04:13:15 CEST 2011
On 8/08/2011, at 11:24 AM, Garrett Smith wrote:
> I reread his post, largely due to your generous (and dignified)
> representation of his position in this thread.
Well, given how I jumped all over his proposal to adopt
Ruby-style "blocks" into Erlang, I thought it was time to
shake the venom out of the pen...
> The crux of his argument is this:
> "This is the type of error you only encounter at runtime. It can lay
> undetected in your codebase, unless you're writing tests."
> As if other dynamically typed languages (Ruby) excel in catching
> "errors" at compile time.
My point here was that this kind of error *can* be caught at
compile time. I have a Smalltalk to C compiler (it does not handle
exceptions yet, so it's not really ready to release) and it's
actually quite surprising how much you *can* detect at compile time.
For example, I have a rule language that lets me write rules like these:
rule: 'isNil is sacred'
defines: #isNil -> is: Object | is: UndefinedObject
rule: '= and hash must be consistent (A)'
defines: #= -> defines: #hash
rule: '= and hash must be consistent (B)'
defines: #hash -> defines: #=
rule: 'network addresses are values'
kindOf: NetworkAddress -> isAbstract | isValue
rule: 'streams are NOT values'
kindOf: InputStream | kindOf: OutputStream -> isAbstract | isMutable
This is not traditional in Smalltalk, but it's surprising the number
of mistakes they've caught. The rule language is compiled into AWK
by an AWK script, which was rather fun. There are a couple of
hundred rules and should be more. Of course, now I need a checker for
the checking language! One of the rules above had a typo I just noticed
when pasting it in...
More information about the erlang-questions