[erlang-questions] literal character syntax

Vlad Dumitrescu vladdu55@REDACTED
Thu May 15 12:41:35 CEST 2014


Hi!

On Thu, May 15, 2014 at 12:17 PM, zxq9 <zxq9@REDACTED> wrote:

> > starts_with([$  | _]) -> space;
> > starts_with([$         | _]) -> tab;
> > starts_with([$
> >  |_]) -> newline.
> >
> > Vlad here recommends deprecating the former case,
> >
>
> I can understand the argument about it being confusing, otoh, special
> casing
> something in the language implementation (the whitespace literals VS every
> other literal) to explicitly disallow them when there is a text-readable
> way
> of expressing this already (the escape characters) seems like step in the
> wrong direction.
>
> The current implementation is entirely consistent, is not confusing in
> editors/highlight modes which are trained to point out literal whitespace,
> and
> the readability issue really boils down to clean coding conventions VS
> trying
> to make the language implementation force a clean coding convention which
> may
> not fit all cases/editors/communities. If emacs/vi/fooedit evolve in the
> future
> to the point our conception of "whitespace" changes even a little, this
> will
> be seen as an awkward wart lingering in the language. I can't think of a
> case
> of coding convention VS implementation-imposed discipline where "imposed
> discipline" was a good idea unless it was central to the design of the
> language to begin with.
>

The problem is that  file diffs usually don't have this feature. (Not to
mention paper printouts, if anyone still use those :-). Also, most editors
can show spaces, tabs and newlines in a "visible" way, but the syntax
allows any control character and I'm not sure all editors will display for
example $^C. Also, "cat f.erl" might behave strangely if there are control
characters (I remember a long time ago all OTP files had ^L between
function definitions...)

Also, one must not use editor features/plugins that automatically replace
tabs with spaces or the other way around. Some editors do that everywhere,
not just at the beginning of the line.

regards,
Vlad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140515/ae7b951c/attachment.htm>


More information about the erlang-questions mailing list