[erlang-questions] erlang improvement - objective c (or smalltalk) syntax
Fri Jun 5 09:46:02 CEST 2009
The drawback with
string:substring_string_start_length(S, X, J)
is that you might still have made a mistake. If/When
string:substring(string:S, start:X, length:J)
is introduced the compiler will put things in the correct position.
It could also make sure that the function (ought to) exist, at least for
OTP functions. That would be nice. The number of times I have written
lists:length/1 is embarrassing.
On Fri, 2009-06-05 at 09:27 +0200, Vlad Dumitrescu wrote:
> On Fri, Jun 5, 2009 at 07:10, Richard O'Keefe <ok@REDACTED> 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)
> 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,
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
More information about the erlang-questions