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

David Mercer dmercer@REDACTED
Thu Jun 4 16:18:54 CEST 2009


> > Didn't you (or was it someone else? I can't find that message in the
> > archives) suggest for some time ago a different but similar way to
> > represent function calls, something like
> >       string:substring(String)from(Start)length(Length)
> > ?
> That was suggested by Richard A. O'Keefe.

And if I recall correctly, a compromise could be done using tuples.  E.g.:

	string:substring({S, from, I, length, J})

As I write this, it almost seems like you want to use proplists, though
there are obvious performance issues with this:

	string:substring([{string, S}, {from, I}, {length, J}])

Or to avoid the overhead of parsing proplists, have every function have a
record structure for its arguments, put the record definition in an include
file, and voilà:

	string:substring(#substring{string = S, from = I, length = J})

Has the double advantage of being able to define default values in the
record declaration, but I think now I'm getting silly...


> -----Original Message-----
> From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On
> Behalf Of Bengt Kleberg
> Sent: Thursday, June 04, 2009 6:38 AM
> To: undisclosed-recipients:
> Cc: Erlang
> Subject: Re: [erlang-questions] erlang improvement - objective c (or
> smalltalk) syntax
> 
> That was suggested by Richard A. O'Keefe.
> 
> 
> bengt
> 
> On Thu, 2009-06-04 at 13:31 +0200, Vlad Dumitrescu wrote:
> > On Thu, Jun 4, 2009 at 11:10, Joe Armstrong <erlang@REDACTED> wrote:
> > > Imagine a function like string:substring/3. A call to this looks like:
> > >
> > >        string:substring(Str, I, J)
> >
> > > Solution: write the call like this.
> > >
> > >       string:substring( string:S start:I length:J)
> >
> > Hi Joe,
> >
> > Didn't you (or was it someone else? I can't find that message in the
> > archives) suggest for some time ago a different but similar way to
> > represent function calls, something like
> >       string:substring(String)from(Start)length(Length)
> > ?
> >
> > 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



More information about the erlang-questions mailing list