[squeak-dev] Syntax error in MC package (_ problem?)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Syntax error in MC package (_ problem?)

Ross Boylan
I tried to load SoundsLike-RJT.2 from
MCHttpRepository
    location: 'http://www.squeaksource.com/SoundsLike'
    user: ''
    password: ''

and got a syntax error in the imported code.  There doesn't appear to be
any way to proceed.

The error show in the method pane like this:
testProcessCxNothing more expected ->_1
        dmsc inputKey: 'abcdefg'.
        self should: [ dmsc inputKey = 'ABCDEFG' ].

I think the problem is that the method is called
testProcessCx_1
and the underscore is getting interpreted as assignment.

This raises a couple of issues.  I'm in a squeak3.10 image.

First, can I do something so that _ will be accepted as a regular
character, at least for the import and perhaps beyond?  I ran into this
earlier; I wanted to use _ as a way of indicating  a method was private
(e.g., _foo is for consumption of the class only), and that didn't work.

Second, what is the preferred way to indicate assignment, _ or := ?
In the past, I remember _ was automatically converted to := if you typed
it, but this is not happening any more.

Third, given something in squeaksource that needs a fix up, how does one
do that?  This is not a question about how to edit the code once I have
a hold of it; it is a question about everything that surrounds that.  I
noticed when I tried to browse the package that things looked odd; I
suspect this also resulted from the parse failure.  It looks as if I do
have the mcz file in my package-cache, but I'm not sure how to make a
new one.  I also am not sure if uploading the fixed version to
squeaksource is advisable, or even possible.

Thanks.
Ross Boylan


Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: Syntax error in MC package (_ problem?)

Ross Boylan
OK, good news and bad.

The good news is that SoundsLike-RobRothwell.1 corrects the syntax error
and loads successfully.

The bad news is that the prior load seemed simply to have frozen.  I
closed the windows that were up, but I ended up with the package partly
installed.  I thought MC loads were atomic.  Can anyone clarify?

I'm a bit puzzled that version 1 of SoundsLike is later than v 2.  The
version history appears to indicate no ancestors for v2, even though the
comment clearly indicates it's a fix.

I am also puzzled that DoubleMetaphoneStringComparator has all its
methods in a protocol called 'Kernel-Objects'.

Although my immediate problem is solved, I'm still curious about all the
issues I've raised, and would welcome any info.

Thanks.
Ross
On Sat, 2009-09-19 at 20:00 -0700, Ross Boylan wrote:

> I tried to load SoundsLike-RJT.2 from
> MCHttpRepository
>     location: 'http://www.squeaksource.com/SoundsLike'
>     user: ''
>     password: ''
>
> and got a syntax error in the imported code.  There doesn't appear to be
> any way to proceed.
>
> The error show in the method pane like this:
> testProcessCxNothing more expected ->_1
> dmsc inputKey: 'abcdefg'.
> self should: [ dmsc inputKey = 'ABCDEFG' ].
>
> I think the problem is that the method is called
> testProcessCx_1
> and the underscore is getting interpreted as assignment.
>
> This raises a couple of issues.  I'm in a squeak3.10 image.
>
> First, can I do something so that _ will be accepted as a regular
> character, at least for the import and perhaps beyond?  I ran into this
> earlier; I wanted to use _ as a way of indicating  a method was private
> (e.g., _foo is for consumption of the class only), and that didn't work.
>
> Second, what is the preferred way to indicate assignment, _ or := ?
> In the past, I remember _ was automatically converted to := if you typed
> it, but this is not happening any more.
>
> Third, given something in squeaksource that needs a fix up, how does one
> do that?  This is not a question about how to edit the code once I have
> a hold of it; it is a question about everything that surrounds that.  I
> noticed when I tried to browse the package that things looked odd; I
> suspect this also resulted from the parse failure.  It looks as if I do
> have the mcz file in my package-cache, but I'm not sure how to make a
> new one.  I also am not sure if uploading the fixed version to
> squeaksource is advisable, or even possible.
>
> Thanks.
> Ross Boylan
>


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Syntax error in MC package (_ problem?)

Bert Freudenberg
In reply to this post by Ross Boylan

On 20.09.2009, at 05:00, Ross Boylan wrote:

> First, can I do something so that _ will be accepted as a regular
> character, at least for the import and perhaps beyond?

Yes, hack the parser.

> I wanted to use _ as a way of indicating  a method was private

If you name a method pvtSomething, the compiler checks that it is sent  
only to self.

> Second, what is the preferred way to indicate assignment, _ or := ?

:= is preferred over _.

There is no decision yet about supporting ←, and if so, if this  
should be preferred over :=.

> Third, given something in squeaksource that needs a fix up, how does  
> one
> do that?

Unzip the mcz, remove snapshot.bin, edit source.st, re-zip.

- Bert -