[erlang-questions] erlang improvement - objective c (or smalltalk) syntax

Vlad Dumitrescu <>
Fri Jun 5 09:27:39 CEST 2009


On Fri, Jun 5, 2009 at 07:10, Richard O'Keefe <> wrote:
> On 5 Jun 2009, at 12:21 am, Vlad Dumitrescu wrote:
>> erlIDE shows the function's documentation beside the list with
>> completion suggestions, so the docs are never too far away.
>
> That's fine for someone who is _writing_, and using erlIDE.
> How exactly does it help someone who is _reading_ a listing
> on the train home?

Yes, of course. What I wanted top point out is that there is still
some help to be had today (Distel has this functionality too), one at
least doesn't have to switch to the browser to check the online docs
every other function call.

Returning to the proposed syntax, I have a suggestion that is (to me,
at least) just as good and requires no syntax change:

It was suggested to use
    string:substring(string:S, start:X, length:J)
or
    string:substring(S) start(X) length(J)
that will be converted by the parser to something like
    string:substring_length_start(S, J, X).

The original problem is that one wants to know what the arguments are
at the call site, but IMHO the tags don't need to sit right next to
the argument.

Why not just directly use
    string:substring_string_start_length(S, X, J)
?
I find it easy to map tags with arguments, it's almost as verbose as
the other suggestions, it works today.

The only issue is that maybe some other separator than '_' should be
used, because it may be confusing if there was a function
string:substring/2 where the tag for argument 2 was 'start_length'

Another observation is that with string:substring(S) start(X)
length(J), the first argument is special (has no tag).

best regards,
Vlad


More information about the erlang-questions mailing list