Scan "=<<" as something useful

classic Classic list List threaded Threaded
38 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Anthony Ramine-2
Hello,

I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
b} is rather written as {a,b}. Then there is the occasional Bin=
<<42>> with a space because erl_scan will scans "=<<" as '=<','<'
instead of '=','<<'. This patch teaches erl_scan how to not do that.

There is no backwards compatibility problem as '=<','<' can't appear
in valid code.

        git fetch https://github.com/nox/otp.git disambiguate-equal-binary

        https://github.com/nox/otp/compare/disambiguate-equal-binary
        https://github.com/nox/otp/compare/disambiguate-equal-binary.patch

Regards,

--
Anthony Ramine

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Sean Cribbs-3
I can't count how many times this has bitten me, kudos.


On Sun, Apr 21, 2013 at 11:15 PM, Anthony Ramine <n.oxyde> wrote:

> Hello,
>
> I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
> b} is rather written as {a,b}. Then there is the occasional Bin=
> <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
> instead of '=','<<'. This patch teaches erl_scan how to not do that.
>
> There is no backwards compatibility problem as '=<','<' can't appear
> in valid code.
>
>         git fetch https://github.com/nox/otp.git disambiguate-equal-binary
>
>         https://github.com/nox/otp/compare/disambiguate-equal-binary
>         https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
>
> Regards,
>
> --
> Anthony Ramine
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches
>



--
Sean Cribbs <sean>
Software Engineer
Basho Technologies, Inc.
http://basho.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130422/b998c587/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Pedram Nimreezi
Good erlang wart to remove...  +1


On Mon, Apr 22, 2013 at 12:21 AM, Sean Cribbs <sean> wrote:

> I can't count how many times this has bitten me, kudos.
>
>
> On Sun, Apr 21, 2013 at 11:15 PM, Anthony Ramine <n.oxyde>wrote:
>
>> Hello,
>>
>> I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
>> b} is rather written as {a,b}. Then there is the occasional Bin=
>> <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
>> instead of '=','<<'. This patch teaches erl_scan how to not do that.
>>
>> There is no backwards compatibility problem as '=<','<' can't appear
>> in valid code.
>>
>>         git fetch https://github.com/nox/otp.gitdisambiguate-equal-binary
>>
>>         https://github.com/nox/otp/compare/disambiguate-equal-binary
>>
>> https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
>>
>> Regards,
>>
>> --
>> Anthony Ramine
>> _______________________________________________
>> erlang-patches mailing list
>> erlang-patches
>> http://erlang.org/mailman/listinfo/erlang-patches
>>
>
>
>
> --
> Sean Cribbs <sean>
> Software Engineer
> Basho Technologies, Inc.
> http://basho.com/
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches
>
>


--
/* Sincerely
--------------------------------------------------------------
Pedram Nimreezi - Chief Technology Officer  */

// The hardest part of design ? is keeping features out. - Donald Norman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130422/d002cc4e/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Robert Virding-5
I don't want to be a wet blanket but I feel that in general having blanks between operators is a Good Thing which improves legibility. So I don't really like a syntax change which supports not having blanks between operators.

Robert

----- Original Message -----

> From: "Pedram Nimreezi" <mc>
> To: "Sean Cribbs" <sean>
> Cc: "Erlang Patches" <erlang-patches>
> Sent: Monday, 22 April, 2013 11:06:24 AM
> Subject: Re: [erlang-patches] Scan "=<<" as something useful

> Good erlang wart to remove... +1

> On Mon, Apr 22, 2013 at 12:21 AM, Sean Cribbs < sean >
> wrote:

> > I can't count how many times this has bitten me, kudos.
>

> > On Sun, Apr 21, 2013 at 11:15 PM, Anthony Ramine <
> > n.oxyde
> > > wrote:
>

> > > Hello,
> >
>

> > > I've noticed that Erlang/OTP own code tend to be space-free, e.g.
> > > {a,
> >
>
> > > b} is rather written as {a,b}. Then there is the occasional Bin=
> >
>
> > > <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
> >
>
> > > instead of '=','<<'. This patch teaches erl_scan how to not do
> > > that.
> >
>

> > > There is no backwards compatibility problem as '=<','<' can't
> > > appear
> >
>
> > > in valid code.
> >
>

> > > git fetch https://github.com/nox/otp.git
> > > disambiguate-equal-binary
> >
>

> > > https://github.com/nox/otp/compare/disambiguate-equal-binary
> >
>
> > > https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
> >
>

> > > Regards,
> >
>

> > > --
> >
>
> > > Anthony Ramine
> >
>
> > > _______________________________________________
> >
>
> > > erlang-patches mailing list
> >
>
> > > erlang-patches
> >
>
> > > http://erlang.org/mailman/listinfo/erlang-patches
> >
>

> > --
>
> > Sean Cribbs < sean >
>
> > Software Engineer
>
> > Basho Technologies, Inc.
>
> > http://basho.com/
>
> > _______________________________________________
>
> > erlang-patches mailing list
>
> > erlang-patches
>
> > http://erlang.org/mailman/listinfo/erlang-patches
>

> --
> /* Sincerely
> --------------------------------------------------------------
> Pedram Nimreezi - Chief Technology Officer */

> // The hardest part of design ? is keeping features out. - Donald
> Norman

> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130428/e2b6b8fd/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Pedram Nimreezi
While I completely agree with this sentiment- I don't agree the good
outweighs the bad here..

- I think it is a real language wart.
- I think it is inconsistent with other types.
- I think time spent looking for this error is wasted time.
- I believe that at best this should warn and not error.

Lastly, I consider this a byproduct of incomplete scanning and should be
corrected not celebrated..


On Sat, Apr 27, 2013 at 11:09 PM, Robert Virding <
robert.virding> wrote:

> I don't want to be a wet blanket but I feel that in general having blanks
> between operators is a Good Thing which improves legibility. So I don't
> really like a syntax change which supports not having blanks between
> operators.
>
> Robert
>
> ------------------------------
>
> *From: *"Pedram Nimreezi" <mc>
> *To: *"Sean Cribbs" <sean>
> *Cc: *"Erlang Patches" <erlang-patches>
> *Sent: *Monday, 22 April, 2013 11:06:24 AM
> *Subject: *Re: [erlang-patches] Scan "=<<" as something useful
>
>
> Good erlang wart to remove...  +1
>
>
> On Mon, Apr 22, 2013 at 12:21 AM, Sean Cribbs <sean> wrote:
>
>> I can't count how many times this has bitten me, kudos.
>>
>>
>> On Sun, Apr 21, 2013 at 11:15 PM, Anthony Ramine <n.oxyde>wrote:
>>
>>> Hello,
>>>
>>> I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
>>> b} is rather written as {a,b}. Then there is the occasional Bin=
>>> <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
>>> instead of '=','<<'. This patch teaches erl_scan how to not do that.
>>>
>>> There is no backwards compatibility problem as '=<','<' can't appear
>>> in valid code.
>>>
>>>         git fetch https://github.com/nox/otp.gitdisambiguate-equal-binary
>>>
>>>         https://github.com/nox/otp/compare/disambiguate-equal-binary
>>>
>>> https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
>>>
>>> Regards,
>>>
>>> --
>>> Anthony Ramine
>>> _______________________________________________
>>> erlang-patches mailing list
>>> erlang-patches
>>> http://erlang.org/mailman/listinfo/erlang-patches
>>>
>>
>>
>>
>> --
>> Sean Cribbs <sean>
>> Software Engineer
>> Basho Technologies, Inc.
>> http://basho.com/
>>
>> _______________________________________________
>> erlang-patches mailing list
>> erlang-patches
>> http://erlang.org/mailman/listinfo/erlang-patches
>>
>>
>
>
> --
> /* Sincerely
> --------------------------------------------------------------
> Pedram Nimreezi - Chief Technology Officer  */
>
> // The hardest part of design ? is keeping features out. - Donald Norman
>
>
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches
>
>
>


--
/* Sincerely
--------------------------------------------------------------
Pedram Nimreezi - Chief Technology Officer  */

// The hardest part of design ? is keeping features out. - Donald Norman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130427/d49c5779/attachment-0001.html>

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Ulf Wiger-5
In reply to this post by Robert Virding-5
Well, the rest of the syntax *does* support not having spaces between operators, and It's a common enough style too.

BR,
Ulf W

Ulf Wiger, Feuerlabs, Inc.
http://www.feuerlabs.com

28 apr 2013 kl. 05:09 skrev Robert Virding <robert.virding>:

> I don't want to be a wet blanket but I feel that in general having blanks between operators is a Good Thing which improves legibility. So I don't really like a syntax change which supports not having blanks between operators.
>
> Robert
>
> From: "Pedram Nimreezi" <mc>
> To: "Sean Cribbs" <sean>
> Cc: "Erlang Patches" <erlang-patches>
> Sent: Monday, 22 April, 2013 11:06:24 AM
> Subject: Re: [erlang-patches] Scan "=<<" as something useful
>
> Good erlang wart to remove...  +1
>
>
> On Mon, Apr 22, 2013 at 12:21 AM, Sean Cribbs <sean> wrote:
>> I can't count how many times this has bitten me, kudos.
>>
>>
>> On Sun, Apr 21, 2013 at 11:15 PM, Anthony Ramine <n.oxyde> wrote:
>>> Hello,
>>>
>>> I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
>>> b} is rather written as {a,b}. Then there is the occasional Bin=
>>> <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
>>> instead of '=','<<'. This patch teaches erl_scan how to not do that.
>>>
>>> There is no backwards compatibility problem as '=<','<' can't appear
>>> in valid code.
>>>
>>>         git fetch https://github.com/nox/otp.git disambiguate-equal-binary
>>>
>>>         https://github.com/nox/otp/compare/disambiguate-equal-binary
>>>         https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
>>>
>>> Regards,
>>>
>>> --
>>> Anthony Ramine
>>> _______________________________________________
>>> erlang-patches mailing list
>>> erlang-patches
>>> http://erlang.org/mailman/listinfo/erlang-patches
>>
>>
>>
>> --
>> Sean Cribbs <sean>
>> Software Engineer
>> Basho Technologies, Inc.
>> http://basho.com/
>>
>> _______________________________________________
>> erlang-patches mailing list
>> erlang-patches
>> http://erlang.org/mailman/listinfo/erlang-patches
>
>
>
> --
> /* Sincerely
> --------------------------------------------------------------
> Pedram Nimreezi - Chief Technology Officer  */
>
> // The hardest part of design ? is keeping features out. - Donald Norman
>
>
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130428/f9ff23ff/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Anthony Ramine-2
In reply to this post by Pedram Nimreezi
Hello Pedram,

I will also add that most often I get hit by that bug in the shell, not in compiled modules. It is quite annoying to encounter an avoidable syntax error in the REPL while testing new things and doing "Bin=<<>>".

Regards

--
Anthony Ramine

Le 28 avr. 2013 ? 05:36, Pedram Nimreezi a ?crit :

> While I completely agree with this sentiment- I don't agree the good outweighs the bad here..
>
> - I think it is a real language wart.
> - I think it is inconsistent with other types.
> - I think time spent looking for this error is wasted time.
> - I believe that at best this should warn and not error.
>
> Lastly, I consider this a byproduct of incomplete scanning and should be corrected not celebrated..
>
>
> On Sat, Apr 27, 2013 at 11:09 PM, Robert Virding <robert.virding> wrote:
> I don't want to be a wet blanket but I feel that in general having blanks between operators is a Good Thing which improves legibility. So I don't really like a syntax change which supports not having blanks between operators.
>
> Robert
>
> From: "Pedram Nimreezi" <mc>
> To: "Sean Cribbs" <sean>
> Cc: "Erlang Patches" <erlang-patches>
> Sent: Monday, 22 April, 2013 11:06:24 AM
> Subject: Re: [erlang-patches] Scan "=<<" as something useful
>
>
> Good erlang wart to remove...  +1
>
>
> On Mon, Apr 22, 2013 at 12:21 AM, Sean Cribbs <sean> wrote:
> I can't count how many times this has bitten me, kudos.
>
>
> On Sun, Apr 21, 2013 at 11:15 PM, Anthony Ramine <n.oxyde> wrote:
> Hello,
>
> I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
> b} is rather written as {a,b}. Then there is the occasional Bin=
> <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
> instead of '=','<<'. This patch teaches erl_scan how to not do that.
>
> There is no backwards compatibility problem as '=<','<' can't appear
> in valid code.
>
>         git fetch https://github.com/nox/otp.git disambiguate-equal-binary
>
>         https://github.com/nox/otp/compare/disambiguate-equal-binary
>         https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
>
> Regards,
>
> --
> Anthony Ramine
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches
>
>
>
> --
> Sean Cribbs <sean>
> Software Engineer
> Basho Technologies, Inc.
> http://basho.com/
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches
>
>
>
>
> --
> /* Sincerely
> --------------------------------------------------------------
> Pedram Nimreezi - Chief Technology Officer  */
>
> // The hardest part of design ? is keeping features out. - Donald Norman
>
>
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches
>
>
>
>
> --
> /* Sincerely
> --------------------------------------------------------------
> Pedram Nimreezi - Chief Technology Officer  */
>
> // The hardest part of design ? is keeping features out. - Donald Norman
>
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches


Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Robert Virding-5
Well, I can honestly say I never encounter it so that doesn't prove anything either way. Just put spaces around = and you will get easier to read code as well. IMAO

Robert

----- Original Message -----

> From: "Anthony Ramine" <n.oxyde>
> To: mc
> Cc: "Robert Virding" <robert.virding>, "Erlang Patches" <erlang-patches>
> Sent: Sunday, 28 April, 2013 4:59:06 AM
> Subject: Re: [erlang-patches] Scan "=<<" as something useful
>
> Hello Pedram,
>
> I will also add that most often I get hit by that bug in the shell,
> not in compiled modules. It is quite annoying to encounter an
> avoidable syntax error in the REPL while testing new things and
> doing "Bin=<<>>".
>
> Regards
>
> --
> Anthony Ramine
>
> Le 28 avr. 2013 ? 05:36, Pedram Nimreezi a ?crit :
>
> > While I completely agree with this sentiment- I don't agree the
> > good outweighs the bad here..
> >
> > - I think it is a real language wart.
> > - I think it is inconsistent with other types.
> > - I think time spent looking for this error is wasted time.
> > - I believe that at best this should warn and not error.
> >
> > Lastly, I consider this a byproduct of incomplete scanning and
> > should be corrected not celebrated..
> >
> >
> > On Sat, Apr 27, 2013 at 11:09 PM, Robert Virding
> > <robert.virding> wrote:
> > I don't want to be a wet blanket but I feel that in general having
> > blanks between operators is a Good Thing which improves
> > legibility. So I don't really like a syntax change which supports
> > not having blanks between operators.
> >
> > Robert
> >
> > From: "Pedram Nimreezi" <mc>
> > To: "Sean Cribbs" <sean>
> > Cc: "Erlang Patches" <erlang-patches>
> > Sent: Monday, 22 April, 2013 11:06:24 AM
> > Subject: Re: [erlang-patches] Scan "=<<" as something useful
> >
> >
> > Good erlang wart to remove...  +1
> >
> >
> > On Mon, Apr 22, 2013 at 12:21 AM, Sean Cribbs <sean>
> > wrote:
> > I can't count how many times this has bitten me, kudos.
> >
> >
> > On Sun, Apr 21, 2013 at 11:15 PM, Anthony Ramine
> > <n.oxyde> wrote:
> > Hello,
> >
> > I've noticed that Erlang/OTP own code tend to be space-free, e.g.
> > {a,
> > b} is rather written as {a,b}. Then there is the occasional Bin=
> > <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
> > instead of '=','<<'. This patch teaches erl_scan how to not do
> > that.
> >
> > There is no backwards compatibility problem as '=<','<' can't
> > appear
> > in valid code.
> >
> >         git fetch https://github.com/nox/otp.git
> >         disambiguate-equal-binary
> >
> >         https://github.com/nox/otp/compare/disambiguate-equal-binary
> >         https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
> >
> > Regards,
> >
> > --
> > Anthony Ramine
> > _______________________________________________
> > erlang-patches mailing list
> > erlang-patches
> > http://erlang.org/mailman/listinfo/erlang-patches
> >
> >
> >
> > --
> > Sean Cribbs <sean>
> > Software Engineer
> > Basho Technologies, Inc.
> > http://basho.com/
> >
> > _______________________________________________
> > erlang-patches mailing list
> > erlang-patches
> > http://erlang.org/mailman/listinfo/erlang-patches
> >
> >
> >
> >
> > --
> > /* Sincerely
> > --------------------------------------------------------------
> > Pedram Nimreezi - Chief Technology Officer  */
> >
> > // The hardest part of design ? is keeping features out. - Donald
> > Norman
> >
> >
> >
> > _______________________________________________
> > erlang-patches mailing list
> > erlang-patches
> > http://erlang.org/mailman/listinfo/erlang-patches
> >
> >
> >
> >
> > --
> > /* Sincerely
> > --------------------------------------------------------------
> > Pedram Nimreezi - Chief Technology Officer  */
> >
> > // The hardest part of design ? is keeping features out. - Donald
> > Norman
> >
> >
> > _______________________________________________
> > erlang-patches mailing list
> > erlang-patches
> > http://erlang.org/mailman/listinfo/erlang-patches
>
>

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Fredrik
In reply to this post by Anthony Ramine-2
On 04/21/2013 10:15 PM, Anthony Ramine wrote:

> Hello,
>
> I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
> b} is rather written as {a,b}. Then there is the occasional Bin=
> <<42>>  with a space because erl_scan will scans "=<<" as '=<','<'
> instead of '=','<<'. This patch teaches erl_scan how to not do that.
>
> There is no backwards compatibility problem as '=<','<' can't appear
> in valid code.
>
>          git fetch https://github.com/nox/otp.git disambiguate-equal-binary
>
>          https://github.com/nox/otp/compare/disambiguate-equal-binary
>          https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
>
> Regards,
>
> --
> Anthony Ramine
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches
Hello Anthony,
I've fetched your branch and it is now in the 'pu' branch.
A review process has started.
Thanks,

--

BR Fredrik Gustafsson
Erlang OTP Team


Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Raimo Niskanen-10
In reply to this post by Anthony Ramine-2
On Sun, Apr 21, 2013 at 10:15:28PM +0200, Anthony Ramine wrote:
> Hello,
>
> I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
> b} is rather written as {a,b}. Then there is the occasional Bin=
> <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
> instead of '=','<<'. This patch teaches erl_scan how to not do that.
>
> There is no backwards compatibility problem as '=<','<' can't appear
> in valid code.

When I tried to fix this years ago while rewriting the scanner just after
the binary syntax was introduced I got lecutured (I think by Robert)
that it was a bad change because it introduces syntax knowledge
into the scanner.

The scanner is today greedy so it collects as many characters as it
can into a valid token, and "=<" is a valid token.  When it is
followed by "<" that becomes a syntax error in the parser.

I kind of miss this argument this time around...

>
>         git fetch https://github.com/nox/otp.git disambiguate-equal-binary
>
>         https://github.com/nox/otp/compare/disambiguate-equal-binary
>         https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
>
> Regards,
>
> --
> Anthony Ramine
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Raimo Niskanen-10
On Mon, Apr 29, 2013 at 10:53:42AM +0200, Raimo Niskanen wrote:

> On Sun, Apr 21, 2013 at 10:15:28PM +0200, Anthony Ramine wrote:
> > Hello,
> >
> > I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
> > b} is rather written as {a,b}. Then there is the occasional Bin=
> > <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
> > instead of '=','<<'. This patch teaches erl_scan how to not do that.
> >
> > There is no backwards compatibility problem as '=<','<' can't appear
> > in valid code.
>
> When I tried to fix this years ago while rewriting the scanner just after
> the binary syntax was introduced I got lecutured (I think by Robert)
> that it was a bad change because it introduces syntax knowledge
> into the scanner.
>
> The scanner is today greedy so it collects as many characters as it
> can into a valid token, and "=<" is a valid token.  When it is
> followed by "<" that becomes a syntax error in the parser.
>
> I kind of miss this argument this time around...
>

If I read your patch correctly you also fix this variant:

    B=<<<<1>>/binary,2>>.

which means the scanner reads an arbitrary number of "<" after
"=<" and then based on if they are odd or even decides to be
greedy or not, and that is really much and ugly syntax knowledge
for a scanner...

I got a big NO for this change.

> >
> >         git fetch https://github.com/nox/otp.git disambiguate-equal-binary
> >
> >         https://github.com/nox/otp/compare/disambiguate-equal-binary
> >         https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
> >
> > Regards,
> >
> > --
> > Anthony Ramine
> > _______________________________________________
> > erlang-patches mailing list
> > erlang-patches
> > http://erlang.org/mailman/listinfo/erlang-patches
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Anthony Ramine-2
Hello Raimo,

If I read the documentation, I don't see anywhere where it is written that erl_scan is supposed to be greedy. Nor I see any syntax knowledge if we just say that erl_scan will avoid returning two consecutive comparison operators if it can. That is just knowledge that '=<' '<' makes no sense, and I can't think of any language where it does.

Erlang is and has always been pragmatic, letting such an embarrassing syntax wart for the sake of beauty isn't what should be done here, in my opinion. Pragmatism is what allows us to have a nice syntax for specs and callbacks; which wouldn't be possible without an ugly hack too[1].

What would break if that patch is accepted? The answer is nothing.

Regards,

[1] https://github.com/nox/otp/blob/master/lib/stdlib/src/erl_parse.yrl#L543-552

--
Anthony Ramine

Le 29 avr. 2013 ? 11:18, Raimo Niskanen a ?crit :

> On Mon, Apr 29, 2013 at 10:53:42AM +0200, Raimo Niskanen wrote:
>> On Sun, Apr 21, 2013 at 10:15:28PM +0200, Anthony Ramine wrote:
>>> Hello,
>>>
>>> I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
>>> b} is rather written as {a,b}. Then there is the occasional Bin=
>>> <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
>>> instead of '=','<<'. This patch teaches erl_scan how to not do that.
>>>
>>> There is no backwards compatibility problem as '=<','<' can't appear
>>> in valid code.
>>
>> When I tried to fix this years ago while rewriting the scanner just after
>> the binary syntax was introduced I got lecutured (I think by Robert)
>> that it was a bad change because it introduces syntax knowledge
>> into the scanner.
>>
>> The scanner is today greedy so it collects as many characters as it
>> can into a valid token, and "=<" is a valid token.  When it is
>> followed by "<" that becomes a syntax error in the parser.
>>
>> I kind of miss this argument this time around...
>>
>
> If I read your patch correctly you also fix this variant:
>
>    B=<<<<1>>/binary,2>>.
>
> which means the scanner reads an arbitrary number of "<" after
> "=<" and then based on if they are odd or even decides to be
> greedy or not, and that is really much and ugly syntax knowledge
> for a scanner...
>
> I got a big NO for this change.
>
>>>
>>>        git fetch https://github.com/nox/otp.git disambiguate-equal-binary
>>>
>>>        https://github.com/nox/otp/compare/disambiguate-equal-binary
>>>        https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
>>>
>>> Regards,
>>>
>>> --
>>> Anthony Ramine
>>> _______________________________________________
>>> erlang-patches mailing list
>>> erlang-patches
>>> http://erlang.org/mailman/listinfo/erlang-patches
>>
>> --
>>
>> / Raimo Niskanen, Erlang/OTP, Ericsson AB
>> _______________________________________________
>> erlang-patches mailing list
>> erlang-patches
>> http://erlang.org/mailman/listinfo/erlang-patches
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches


Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Loïc Hoguin-2
In reply to this post by Robert Virding-5
I don't encounter it often anymore because I got used to it being
broken, and put an extra space, but that doesn't mean it shouldn't be
fixed, it would relieve the many new developers from making the mistake
and then losing time asking about it.

On 04/29/2013 06:29 AM, Robert Virding wrote:

> Well, I can honestly say I never encounter it so that doesn't prove anything either way. Just put spaces around = and you will get easier to read code as well. IMAO
>
> Robert
>
> ----- Original Message -----
>> From: "Anthony Ramine" <n.oxyde>
>> To: mc
>> Cc: "Robert Virding" <robert.virding>, "Erlang Patches" <erlang-patches>
>> Sent: Sunday, 28 April, 2013 4:59:06 AM
>> Subject: Re: [erlang-patches] Scan "=<<" as something useful
>>
>> Hello Pedram,
>>
>> I will also add that most often I get hit by that bug in the shell,
>> not in compiled modules. It is quite annoying to encounter an
>> avoidable syntax error in the REPL while testing new things and
>> doing "Bin=<<>>".
>>
>> Regards
>>
>> --
>> Anthony Ramine
>>
>> Le 28 avr. 2013 ? 05:36, Pedram Nimreezi a ?crit :
>>
>>> While I completely agree with this sentiment- I don't agree the
>>> good outweighs the bad here..
>>>
>>> - I think it is a real language wart.
>>> - I think it is inconsistent with other types.
>>> - I think time spent looking for this error is wasted time.
>>> - I believe that at best this should warn and not error.
>>>
>>> Lastly, I consider this a byproduct of incomplete scanning and
>>> should be corrected not celebrated..
>>>
>>>
>>> On Sat, Apr 27, 2013 at 11:09 PM, Robert Virding
>>> <robert.virding> wrote:
>>> I don't want to be a wet blanket but I feel that in general having
>>> blanks between operators is a Good Thing which improves
>>> legibility. So I don't really like a syntax change which supports
>>> not having blanks between operators.
>>>
>>> Robert
>>>
>>> From: "Pedram Nimreezi" <mc>
>>> To: "Sean Cribbs" <sean>
>>> Cc: "Erlang Patches" <erlang-patches>
>>> Sent: Monday, 22 April, 2013 11:06:24 AM
>>> Subject: Re: [erlang-patches] Scan "=<<" as something useful
>>>
>>>
>>> Good erlang wart to remove...  +1
>>>
>>>
>>> On Mon, Apr 22, 2013 at 12:21 AM, Sean Cribbs <sean>
>>> wrote:
>>> I can't count how many times this has bitten me, kudos.
>>>
>>>
>>> On Sun, Apr 21, 2013 at 11:15 PM, Anthony Ramine
>>> <n.oxyde> wrote:
>>> Hello,
>>>
>>> I've noticed that Erlang/OTP own code tend to be space-free, e.g.
>>> {a,
>>> b} is rather written as {a,b}. Then there is the occasional Bin=
>>> <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
>>> instead of '=','<<'. This patch teaches erl_scan how to not do
>>> that.
>>>
>>> There is no backwards compatibility problem as '=<','<' can't
>>> appear
>>> in valid code.
>>>
>>>          git fetch https://github.com/nox/otp.git
>>>          disambiguate-equal-binary
>>>
>>>          https://github.com/nox/otp/compare/disambiguate-equal-binary
>>>          https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
>>>
>>> Regards,
>>>
>>> --
>>> Anthony Ramine
>>> _______________________________________________
>>> erlang-patches mailing list
>>> erlang-patches
>>> http://erlang.org/mailman/listinfo/erlang-patches
>>>
>>>
>>>
>>> --
>>> Sean Cribbs <sean>
>>> Software Engineer
>>> Basho Technologies, Inc.
>>> http://basho.com/
>>>
>>> _______________________________________________
>>> erlang-patches mailing list
>>> erlang-patches
>>> http://erlang.org/mailman/listinfo/erlang-patches
>>>
>>>
>>>
>>>
>>> --
>>> /* Sincerely
>>> --------------------------------------------------------------
>>> Pedram Nimreezi - Chief Technology Officer  */
>>>
>>> // The hardest part of design ? is keeping features out. - Donald
>>> Norman
>>>
>>>
>>>
>>> _______________________________________________
>>> erlang-patches mailing list
>>> erlang-patches
>>> http://erlang.org/mailman/listinfo/erlang-patches
>>>
>>>
>>>
>>>
>>> --
>>> /* Sincerely
>>> --------------------------------------------------------------
>>> Pedram Nimreezi - Chief Technology Officer  */
>>>
>>> // The hardest part of design ? is keeping features out. - Donald
>>> Norman
>>>
>>>
>>> _______________________________________________
>>> erlang-patches mailing list
>>> erlang-patches
>>> http://erlang.org/mailman/listinfo/erlang-patches
>>
>>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches
>


--
Lo?c Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Garrett Smith
FWIW I don't use spaces between record bindings:

#user{name="Stan", age=25}

I personally find this convention more readable than with spaces.

Having to do so for binaries:

#user{name= <<"Stan">>, age=25}

causes me to toss and turn in my sleep, occasionally waking with night terrors.

I'm quite happy to see this land.

On Mon, Apr 29, 2013 at 6:59 AM, Lo?c Hoguin <essen> wrote:

> I don't encounter it often anymore because I got used to it being broken,
> and put an extra space, but that doesn't mean it shouldn't be fixed, it
> would relieve the many new developers from making the mistake and then
> losing time asking about it.
>
>
> On 04/29/2013 06:29 AM, Robert Virding wrote:
>>
>> Well, I can honestly say I never encounter it so that doesn't prove
>> anything either way. Just put spaces around = and you will get easier to
>> read code as well. IMAO
>>
>> Robert
>>
>> ----- Original Message -----
>>>
>>> From: "Anthony Ramine" <n.oxyde>
>>> To: mc
>>> Cc: "Robert Virding" <robert.virding>, "Erlang
>>> Patches" <erlang-patches>
>>> Sent: Sunday, 28 April, 2013 4:59:06 AM
>>> Subject: Re: [erlang-patches] Scan "=<<" as something useful
>>>
>>> Hello Pedram,
>>>
>>> I will also add that most often I get hit by that bug in the shell,
>>> not in compiled modules. It is quite annoying to encounter an
>>> avoidable syntax error in the REPL while testing new things and
>>> doing "Bin=<<>>".
>>>
>>> Regards
>>>
>>> --
>>> Anthony Ramine
>>>
>>> Le 28 avr. 2013 ? 05:36, Pedram Nimreezi a ?crit :
>>>
>>>> While I completely agree with this sentiment- I don't agree the
>>>> good outweighs the bad here..
>>>>
>>>> - I think it is a real language wart.
>>>> - I think it is inconsistent with other types.
>>>> - I think time spent looking for this error is wasted time.
>>>> - I believe that at best this should warn and not error.
>>>>
>>>> Lastly, I consider this a byproduct of incomplete scanning and
>>>> should be corrected not celebrated..
>>>>
>>>>
>>>> On Sat, Apr 27, 2013 at 11:09 PM, Robert Virding
>>>> <robert.virding> wrote:
>>>> I don't want to be a wet blanket but I feel that in general having
>>>> blanks between operators is a Good Thing which improves
>>>> legibility. So I don't really like a syntax change which supports
>>>> not having blanks between operators.
>>>>
>>>> Robert
>>>>
>>>> From: "Pedram Nimreezi" <mc>
>>>> To: "Sean Cribbs" <sean>
>>>> Cc: "Erlang Patches" <erlang-patches>
>>>> Sent: Monday, 22 April, 2013 11:06:24 AM
>>>> Subject: Re: [erlang-patches] Scan "=<<" as something useful
>>>>
>>>>
>>>> Good erlang wart to remove...  +1
>>>>
>>>>
>>>> On Mon, Apr 22, 2013 at 12:21 AM, Sean Cribbs <sean>
>>>> wrote:
>>>> I can't count how many times this has bitten me, kudos.
>>>>
>>>>
>>>> On Sun, Apr 21, 2013 at 11:15 PM, Anthony Ramine
>>>> <n.oxyde> wrote:
>>>> Hello,
>>>>
>>>> I've noticed that Erlang/OTP own code tend to be space-free, e.g.
>>>> {a,
>>>> b} is rather written as {a,b}. Then there is the occasional Bin=
>>>> <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
>>>> instead of '=','<<'. This patch teaches erl_scan how to not do
>>>> that.
>>>>
>>>> There is no backwards compatibility problem as '=<','<' can't
>>>> appear
>>>> in valid code.
>>>>
>>>>          git fetch https://github.com/nox/otp.git
>>>>          disambiguate-equal-binary
>>>>
>>>>          https://github.com/nox/otp/compare/disambiguate-equal-binary
>>>>
>>>> https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
>>>>
>>>> Regards,
>>>>
>>>> --
>>>> Anthony Ramine
>>>> _______________________________________________
>>>> erlang-patches mailing list
>>>> erlang-patches
>>>> http://erlang.org/mailman/listinfo/erlang-patches
>>>>
>>>>
>>>>
>>>> --
>>>> Sean Cribbs <sean>
>>>> Software Engineer
>>>> Basho Technologies, Inc.
>>>> http://basho.com/
>>>>
>>>> _______________________________________________
>>>> erlang-patches mailing list
>>>> erlang-patches
>>>> http://erlang.org/mailman/listinfo/erlang-patches
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> /* Sincerely
>>>> --------------------------------------------------------------
>>>> Pedram Nimreezi - Chief Technology Officer  */
>>>>
>>>> // The hardest part of design ? is keeping features out. - Donald
>>>> Norman
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> erlang-patches mailing list
>>>> erlang-patches
>>>> http://erlang.org/mailman/listinfo/erlang-patches
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> /* Sincerely
>>>> --------------------------------------------------------------
>>>> Pedram Nimreezi - Chief Technology Officer  */
>>>>
>>>> // The hardest part of design ? is keeping features out. - Donald
>>>> Norman
>>>>
>>>>
>>>> _______________________________________________
>>>> erlang-patches mailing list
>>>> erlang-patches
>>>> http://erlang.org/mailman/listinfo/erlang-patches
>>>
>>>
>>>
>> _______________________________________________
>> erlang-patches mailing list
>> erlang-patches
>> http://erlang.org/mailman/listinfo/erlang-patches
>>
>
>
> --
> Lo?c Hoguin
> Erlang Cowboy
> Nine Nines
> http://ninenines.eu
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Per Hedeland-4
In reply to this post by Anthony Ramine-2
Anthony Ramine <n.oxyde> wrote:
>
>If I read the documentation, I don't see anywhere where it is written that erl_scan is supposed to be greedy. Nor I see any syntax knowledge if we just say that erl_scan will avoid returning two consecutive comparison operators if it can. That is just knowledge that '=<' '<' makes no sense, and I can't think of any language where it does.

1> A = <<17>>.  
<<17>>
2> A=<<<42>>.  
true

So will this useful:-) syntax break with the patch? (I haven't looked at
it).

--Per Hedeland


Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Anthony Ramine-2
Hello Per,

It counts the number of < characters and scans a '=<' token if the number is odd; so that still works.

Regards,

--
Anthony Ramine

Le 29 avr. 2013 ? 14:37, Per Hedeland a ?crit :

> Anthony Ramine <n.oxyde> wrote:
>>
>> If I read the documentation, I don't see anywhere where it is written that erl_scan is supposed to be greedy. Nor I see any syntax knowledge if we just say that erl_scan will avoid returning two consecutive comparison operators if it can. That is just knowledge that '=<' '<' makes no sense, and I can't think of any language where it does.
>
> 1> A = <<17>>.  
> <<17>>
> 2> A=<<<42>>.  
> true
>
> So will this useful:-) syntax break with the patch? (I haven't looked at
> it).
>
> --Per Hedeland
>


Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Raimo Niskanen-10
In reply to this post by Anthony Ramine-2
On Mon, Apr 29, 2013 at 11:41:35AM +0200, Anthony Ramine wrote:
> Hello Raimo,
>
> If I read the documentation, I don't see anywhere where it is written that erl_scan is supposed to be greedy. Nor I see any syntax knowledge if we just say that erl_scan will avoid returning two consecutive comparison operators if it can. That is just knowledge that '=<' '<' makes no sense, and I can't think of any language where it does.

But that knowledge is aquired by doing an infinite look-ahead
for this operator, and knowing that =< and < are both comparision
operators _is_ syntax knowledge as are all other reasons for
knowing that =< and < are not allowed in sequence.

>
> Erlang is and has always been pragmatic, letting such an embarrassing syntax wart for the sake of beauty isn't what should be done here, in my opinion. Pragmatism is what allows us to have a nice syntax for specs and callbacks; which wouldn't be possible without an ugly hack too[1].
>
> What would break if that patch is accepted? The answer is nothing.

Here are the old arguments:
    http://erlang.org/pipermail/erlang-questions/2003-May/008751.html

It heats up at:
    http://erlang.org/pipermail/erlang-questions/2003-May/008923.html

...and the subject pops up occasionally:
    http://erlang.org/pipermail/erlang-questions/2010-July/052587.html

One final straw back then was this: the typo "A=<<<1>>" accidentally
becomes valid syntax with the proposed change.

>
> Regards,
>
> [1] https://github.com/nox/otp/blob/master/lib/stdlib/src/erl_parse.yrl#L543-552
>
> --
> Anthony Ramine
>
> Le 29 avr. 2013 ? 11:18, Raimo Niskanen a ?crit :
>
> > On Mon, Apr 29, 2013 at 10:53:42AM +0200, Raimo Niskanen wrote:
> >> On Sun, Apr 21, 2013 at 10:15:28PM +0200, Anthony Ramine wrote:
> >>> Hello,
> >>>
> >>> I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
> >>> b} is rather written as {a,b}. Then there is the occasional Bin=
> >>> <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
> >>> instead of '=','<<'. This patch teaches erl_scan how to not do that.
> >>>
> >>> There is no backwards compatibility problem as '=<','<' can't appear
> >>> in valid code.
> >>
> >> When I tried to fix this years ago while rewriting the scanner just after
> >> the binary syntax was introduced I got lecutured (I think by Robert)
> >> that it was a bad change because it introduces syntax knowledge
> >> into the scanner.
> >>
> >> The scanner is today greedy so it collects as many characters as it
> >> can into a valid token, and "=<" is a valid token.  When it is
> >> followed by "<" that becomes a syntax error in the parser.
> >>
> >> I kind of miss this argument this time around...
> >>
> >
> > If I read your patch correctly you also fix this variant:
> >
> >    B=<<<<1>>/binary,2>>.
> >
> > which means the scanner reads an arbitrary number of "<" after
> > "=<" and then based on if they are odd or even decides to be
> > greedy or not, and that is really much and ugly syntax knowledge
> > for a scanner...
> >
> > I got a big NO for this change.
> >
> >>>
> >>>        git fetch https://github.com/nox/otp.git disambiguate-equal-binary
> >>>
> >>>        https://github.com/nox/otp/compare/disambiguate-equal-binary
> >>>        https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
> >>>
> >>> Regards,
> >>>
> >>> --
> >>> Anthony Ramine
> >>> _______________________________________________
> >>> erlang-patches mailing list
> >>> erlang-patches
> >>> http://erlang.org/mailman/listinfo/erlang-patches
> >>
> >> --
> >>
> >> / Raimo Niskanen, Erlang/OTP, Ericsson AB
> >> _______________________________________________
> >> erlang-patches mailing list
> >> erlang-patches
> >> http://erlang.org/mailman/listinfo/erlang-patches
> >
> > --
> >
> > / Raimo Niskanen, Erlang/OTP, Ericsson AB
> > _______________________________________________
> > erlang-patches mailing list
> > erlang-patches
> > http://erlang.org/mailman/listinfo/erlang-patches
>

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Anthony Ramine-2
I don't understand how is that a typo, as "A=<<<1>>" is valid syntax with or without my patch.

--
Anthony Ramine

Le 29 avr. 2013 ? 15:05, Raimo Niskanen a ?crit :

> One final straw back then was this: the typo "A=<<<1>>" accidentally
> becomes valid syntax with the proposed change.


Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Raimo Niskanen-10
In reply to this post by Raimo Niskanen-10
On Mon, Apr 29, 2013 at 03:05:45PM +0200, Raimo Niskanen wrote:

> On Mon, Apr 29, 2013 at 11:41:35AM +0200, Anthony Ramine wrote:
> > Hello Raimo,
> >
> > If I read the documentation, I don't see anywhere where it is written that erl_scan is supposed to be greedy. Nor I see any syntax knowledge if we just say that erl_scan will avoid returning two consecutive comparison operators if it can. That is just knowledge that '=<' '<' makes no sense, and I can't think of any language where it does.
>
> But that knowledge is aquired by doing an infinite look-ahead
> for this operator, and knowing that =< and < are both comparision
> operators _is_ syntax knowledge as are all other reasons for
> knowing that =< and < are not allowed in sequence.
>
> >
> > Erlang is and has always been pragmatic, letting such an embarrassing syntax wart for the sake of beauty isn't what should be done here, in my opinion. Pragmatism is what allows us to have a nice syntax for specs and callbacks; which wouldn't be possible without an ugly hack too[1].
> >
> > What would break if that patch is accepted? The answer is nothing.
>
> Here are the old arguments:
>     http://erlang.org/pipermail/erlang-questions/2003-May/008751.html
>
> It heats up at:
>     http://erlang.org/pipermail/erlang-questions/2003-May/008923.html
>
> ...and the subject pops up occasionally:
>     http://erlang.org/pipermail/erlang-questions/2010-July/052587.html
>
> One final straw back then was this: the typo "A=<<<1>>" accidentally
> becomes valid syntax with the proposed change.

...that was wrong; rather that intending to write "A =< << 1 >>" without
spaces as "A=<<<1>>" and misspelling to "A=<<1>>" would give no compiler
error and unexpected runtime behaviour...

>
> >
> > Regards,
> >
> > [1] https://github.com/nox/otp/blob/master/lib/stdlib/src/erl_parse.yrl#L543-552
> >
> > --
> > Anthony Ramine
> >
> > Le 29 avr. 2013 ? 11:18, Raimo Niskanen a ?crit :
> >
> > > On Mon, Apr 29, 2013 at 10:53:42AM +0200, Raimo Niskanen wrote:
> > >> On Sun, Apr 21, 2013 at 10:15:28PM +0200, Anthony Ramine wrote:
> > >>> Hello,
> > >>>
> > >>> I've noticed that Erlang/OTP own code tend to be space-free, e.g. {a,
> > >>> b} is rather written as {a,b}. Then there is the occasional Bin=
> > >>> <<42>> with a space because erl_scan will scans "=<<" as '=<','<'
> > >>> instead of '=','<<'. This patch teaches erl_scan how to not do that.
> > >>>
> > >>> There is no backwards compatibility problem as '=<','<' can't appear
> > >>> in valid code.
> > >>
> > >> When I tried to fix this years ago while rewriting the scanner just after
> > >> the binary syntax was introduced I got lecutured (I think by Robert)
> > >> that it was a bad change because it introduces syntax knowledge
> > >> into the scanner.
> > >>
> > >> The scanner is today greedy so it collects as many characters as it
> > >> can into a valid token, and "=<" is a valid token.  When it is
> > >> followed by "<" that becomes a syntax error in the parser.
> > >>
> > >> I kind of miss this argument this time around...
> > >>
> > >
> > > If I read your patch correctly you also fix this variant:
> > >
> > >    B=<<<<1>>/binary,2>>.
> > >
> > > which means the scanner reads an arbitrary number of "<" after
> > > "=<" and then based on if they are odd or even decides to be
> > > greedy or not, and that is really much and ugly syntax knowledge
> > > for a scanner...
> > >
> > > I got a big NO for this change.
> > >
> > >>>
> > >>>        git fetch https://github.com/nox/otp.git disambiguate-equal-binary
> > >>>
> > >>>        https://github.com/nox/otp/compare/disambiguate-equal-binary
> > >>>        https://github.com/nox/otp/compare/disambiguate-equal-binary.patch
> > >>>
> > >>> Regards,
> > >>>
> > >>> --
> > >>> Anthony Ramine
> > >>> _______________________________________________
> > >>> erlang-patches mailing list
> > >>> erlang-patches
> > >>> http://erlang.org/mailman/listinfo/erlang-patches
> > >>
> > >> --
> > >>
> > >> / Raimo Niskanen, Erlang/OTP, Ericsson AB
> > >> _______________________________________________
> > >> erlang-patches mailing list
> > >> erlang-patches
> > >> http://erlang.org/mailman/listinfo/erlang-patches
> > >
> > > --
> > >
> > > / Raimo Niskanen, Erlang/OTP, Ericsson AB
> > > _______________________________________________
> > > erlang-patches mailing list
> > > erlang-patches
> > > http://erlang.org/mailman/listinfo/erlang-patches
> >
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

Reply | Threaded
Open this post in threaded view
|

Scan "=<<" as something useful

Loïc Hoguin-2
On 04/29/2013 03:14 PM, Raimo Niskanen wrote:
 >> One final straw back then was this: the typo "A=<<<1>>" accidentally
 >> becomes valid syntax with the proposed change.
 >
 > ...that was wrong; rather that intending to write "A =< << 1 >>" without
 > spaces as "A=<<<1>>" and misspelling to "A=<<1>>" would give no compiler
 > error and unexpected runtime behaviour...

How often have you encountered code that had this form? I never have,
and I use binaries everyday.

--
Lo?c Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu

12