[erlang-questions] erlang improvement - objective c (or smalltalk) syntax
Fred Hebert (MononcQc)
mononcqc@REDACTED
Thu Jun 4 14:52:18 CEST 2009
On Thu, Jun 4, 2009 at 8:36 AM, Kenneth Lundin <kenneth.lundin@REDACTED>wrote:
> It would be easy to implement tab-completion of functions with
> argument names and types based on the
> type specifications which are in place in many of the modules in
> kernel and stdlib.
> The typespec info can easily be retrieved from the beam files without
> need for documentation.
>
> The typespec notation will be used in edoc and in the ordinary
> Erlang/OTP documetation as well.
>
> I recommend an approach where all exported functions have typespecs
> and that the possibility to
> assign a Mnemonic name to each function-argument is used.
>
> When having that in place it will be easy to support tab-completion in
> the shell as well as in IDE's.
>
>
> /Kenneth Erlang/OTP Ericsson
>
> On Thu, Jun 4, 2009 at 2:21 PM, Vlad Dumitrescu <vladdu55@REDACTED>
> wrote:
> > On Thu, Jun 4, 2009 at 14:04, Alin Popa <alin.popa@REDACTED> wrote:
> >> Please correct me if I'm wrong, but
> >> string:substring(String)from(Start)length(Length) does not look more
> like an
> >> actual multiple function calls ( substring(String) - one function call,
> >> from(Start) - other one, and so on ... ) ?
> >> I don't know that this solution may keep backward-compatibility with the
> old
> >> syntax.
> >>
> >> Or maybe I'm missing something here.
> >
> > Since there's no comma between the "calls", it is an illegal syntax
> > today. That was only a suggestion for syntax (and I might even
> > remember it wrong), there might be better alternatives.
> >
> > Could I dare throw in a sales pitch?
> >
> > erlIDE shows the function's documentation beside the list with
> > completion suggestions, so the docs are never too far away. At the
> > moment, only the standard libraries' docs are shown prettily
> > formatted; one's own code is just the raw comments before the function
> > definition.
> >
> > regards,
> > Vlad
> >
> > ________________________________________________________________
> > erlang-questions mailing list. See http://www.erlang.org/faq.html
> > erlang-questions (at) erlang.org
> >
> >
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
> That would be my choice too. Add some reflectivity to Erlang that way. It
also forces people to do some documenting of types expected and could
eventually lead to optimizations as well as letting things be safer with
dialyzer analyses.
I feel that a "string:substring( string:S start:I length:J )" syntax is both
visually confusing (it looks like a function call from a module) and opposed
to what I've seen done in languages like python where it's meant to be both
used to call a function in the "string:substring( string:S start:I length:J
)" form, but also to do dictionary unpacking (which could be like
"string:substring(**{{string,S}, {start,I}, {length,J}} )". I'm not too keen
on using that due to reasons already mentioned, including how verbose it is.
I feel like the spec use is the best one, although the ideas of docstrings
are nice too.
More information about the erlang-questions
mailing list