This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Re: using prefix operators as identifiers

5 replies
Yuvi Masory
Joined: 2010-12-22,
User offline. Last seen 1 year 27 weeks ago.
Paul pointed me to this old issue:https://issues.scala-lang.org/browse/SI-1696

Yuvi



On Tue, May 31, 2011 at 1:10 PM, Paul Phillips <paulp [at] improving [dot] org> wrote:
On 5/31/11 9:12 AM, Yuvi Masory wrote:
> Unless I missed something in the spec this is either a problem with the
> spec or with the parser. Any thoughts before I file a bug report?

https://issues.scala-lang.org/browse/SI-1696
"interpreter doesn't always (un)mangle names correctly"

The title is misleading: see the comments, in which I carry on a
conversation with myself and the group of us agree it is a parser issue.
 I opened it in Feb '09 against scala 2.7.3 and I'm sure I'll get to it
annnnny day now.

mepcotterell
Joined: 2011-03-17,
User offline. Last seen 40 weeks 6 days ago.
Re: using prefix operators as identifiers

That's pretty interesting. Seems like either Scala should allow
arbitrarily defined prefix operators or at least make the ones that
they do allow reserved identifiers. The example you showed behaves the
same for me. It just doesn't make sense.

On Tue, May 31, 2011 at 1:35 PM, Yuvi Masory wrote:
> Paul pointed me to this old issue:
> https://issues.scala-lang.org/browse/SI-1696
>
> Yuvi
>
>
>
> On Tue, May 31, 2011 at 1:10 PM, Paul Phillips wrote:
>>
>> On 5/31/11 9:12 AM, Yuvi Masory wrote:
>> > Unless I missed something in the spec this is either a problem with the
>> > spec or with the parser. Any thoughts before I file a bug report?
>>
>> https://issues.scala-lang.org/browse/SI-1696
>> "interpreter doesn't always (un)mangle names correctly"
>>
>> The title is misleading: see the comments, in which I carry on a
>> conversation with myself and the group of us agree it is a parser issue.
>>  I opened it in Feb '09 against scala 2.7.3 and I'm sure I'll get to it
>> annnnny day now.
>
>

Nate Nystrom 3
Joined: 2011-05-31,
User offline. Last seen 42 years 45 weeks ago.
Re: using prefix operators as identifiers

It looks like backticks don't work either:

scala> val ~ = 1
~: Int = 1

scala> (`~`)
:1: error: illegal start of simple expression
(`~`)
^

scala> val ! = 1
!: Int = 1

scala> `!`
|
|
You typed two blank lines. Starting a new command.

Nate

On Tue, May 31, 2011 at 20:04, Michael Cotterell wrote:
> That's pretty interesting. Seems like either Scala should allow
> arbitrarily defined prefix operators or at least make the ones that
> they do allow reserved identifiers. The example you showed behaves the
> same for me. It just doesn't make sense.
>
> On Tue, May 31, 2011 at 1:35 PM, Yuvi Masory wrote:
>> Paul pointed me to this old issue:
>> https://issues.scala-lang.org/browse/SI-1696
>>
>> Yuvi
>>
>>
>>
>> On Tue, May 31, 2011 at 1:10 PM, Paul Phillips wrote:
>>>
>>> On 5/31/11 9:12 AM, Yuvi Masory wrote:
>>> > Unless I missed something in the spec this is either a problem with the
>>> > spec or with the parser. Any thoughts before I file a bug report?
>>>
>>> https://issues.scala-lang.org/browse/SI-1696
>>> "interpreter doesn't always (un)mangle names correctly"
>>>
>>> The title is misleading: see the comments, in which I carry on a
>>> conversation with myself and the group of us agree it is a parser issue.
>>>  I opened it in Feb '09 against scala 2.7.3 and I'm sure I'll get to it
>>> annnnny day now.
>>
>>
>
>
>
> --
> Sincerely,
> Michael Cotterell
> mepcotterell [at] gmail [dot] com
> mepcott [at] uga [dot] edu
>

Yuvi Masory
Joined: 2010-12-22,
User offline. Last seen 1 year 27 weeks ago.
Re: using prefix operators as identifiers
Back tick is specified as a delimiter character in the spec.

Yuvi



On Tue, May 31, 2011 at 2:10 PM, Nate Nystrom <nate [dot] nystrom [at] usi [dot] ch> wrote:
It looks like backticks don't work either:

scala> val ~ = 1
~: Int = 1

scala> (`~`)
<console>:1: error: illegal start of simple expression
      (`~`)
          ^

scala> val ! = 1
!: Int = 1

scala> `!`
    |
    |
You typed two blank lines.  Starting a new command.

Nate




On Tue, May 31, 2011 at 20:04, Michael Cotterell <mepcotterell [at] gmail [dot] com> wrote:
> That's pretty interesting. Seems like either Scala should allow
> arbitrarily defined prefix operators or at least make the ones that
> they do allow reserved identifiers. The example you showed behaves the
> same for me. It just doesn't make sense.
>
> On Tue, May 31, 2011 at 1:35 PM, Yuvi Masory <ymasory [at] gmail [dot] com> wrote:
>> Paul pointed me to this old issue:
>> https://issues.scala-lang.org/browse/SI-1696
>>
>> Yuvi
>>
>>
>>
>> On Tue, May 31, 2011 at 1:10 PM, Paul Phillips <paulp [at] improving [dot] org> wrote:
>>>
>>> On 5/31/11 9:12 AM, Yuvi Masory wrote:
>>> > Unless I missed something in the spec this is either a problem with the
>>> > spec or with the parser. Any thoughts before I file a bug report?
>>>
>>> https://issues.scala-lang.org/browse/SI-1696
>>> "interpreter doesn't always (un)mangle names correctly"
>>>
>>> The title is misleading: see the comments, in which I carry on a
>>> conversation with myself and the group of us agree it is a parser issue.
>>>  I opened it in Feb '09 against scala 2.7.3 and I'm sure I'll get to it
>>> annnnny day now.
>>
>>
>
>
>
> --
> Sincerely,
> Michael Cotterell
> mepcotterell [at] gmail [dot] com
> mepcott [at] uga [dot] edu
>

Philippe Lhoste
Joined: 2010-09-02,
User offline. Last seen 42 years 45 weeks ago.
Re: using prefix operators as identifiers

On 31/05/2011 19:35, Yuvi Masory wrote:
> Paul pointed me to this old issue:
> https://issues.scala-lang.org/browse/SI-1696

Yes, and as you point out, it is not a problem with the REPL only (I always check in a
small .scala file, I suspect lot of issues reported in the MLs with a REPL trace are
inherent to the REPL way of doing things).

At least, it explains why we often see functions like ~~ or !! and never the symbols alone...

mepcotterell
Joined: 2011-03-17,
User offline. Last seen 40 weeks 6 days ago.
Re: using prefix operators as identifiers
Has anyone figured out if this is a bug yet?
-- 
Sincerely,
Michael Cotterell
mepcotterell [at] gmail [dot] com
mepcott [at] uga [dot] edu

P.S. - Check out ScalaTion (http://code.google.com/p/scalation/), a
Domain-Specific Language for Modeling & Simulation. #blatantplug

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland