small fix to help newbies

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

small fix to help newbies

P.
Hi folks,

I'm sending this email to both Squeak-dev and Pharo-project as you can see.
This is to suggest a fix.

I typed this on a workspace:

closure := [:x | Transcript show: x].
closure value: "hey".

And when I "did it", the VM had me looking at this:

closure := [:x | Transcript show: x].
closure value: "hey". Argument expected ->

Which is cryptic at best for a newbie.
I visited #[hidden email] and asked there.
Ken Causey helped me out and even he missed the difference between "" and '' for a second.
I believe it would be beneficial to newbies to have this enhanced somehow, to point
out the fact that strings aren't double-quoted.

Thanks,

Peter


Reply | Threaded
Open this post in threaded view
|

Re: small fix to help newbies

Frank Shearar-3
On 8 August 2011 03:42, P. <[hidden email]> wrote:

> Hi folks,
>
> I'm sending this email to both Squeak-dev and Pharo-project as you can see.
> This is to suggest a fix.
>
> I typed this on a workspace:
>
> closure := [:x | Transcript show: x].
> closure value: "hey".
>
> And when I "did it", the VM had me looking at this:
>
> closure := [:x | Transcript show: x].
> closure value: "hey". Argument expected ->
>
> Which is cryptic at best for a newbie.
> I visited #[hidden email] and asked there.
> Ken Causey helped me out and even he missed the difference between "" and ''
> for a second.
> I believe it would be beneficial to newbies to have this enhanced somehow,
> to point
> out the fact that strings aren't double-quoted.

Tricky, given that the error message is correct. After you strip out
the comments, you have

  closer value: .

which is clearly not kosher.

What kind of fix would work for you? I'm just thinking that
special-casing when you have a process part of a keyword message send
followed by a comment is tricky:

  this is: "valid" code

for instance.

frank

> Thanks,
>
> Peter
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: small fix to help newbies

Bert Freudenberg

On 08.08.2011, at 10:44, Frank Shearar wrote:

> On 8 August 2011 03:42, P. <[hidden email]> wrote:
>> Hi folks,
>>
>> I'm sending this email to both Squeak-dev and Pharo-project as you can see.
>> This is to suggest a fix.
>>
>> I typed this on a workspace:
>>
>> closure := [:x | Transcript show: x].
>> closure value: "hey".
>>
>> And when I "did it", the VM had me looking at this:
>>
>> closure := [:x | Transcript show: x].
>> closure value: "hey". Argument expected ->
>>
>> Which is cryptic at best for a newbie.
>> I visited #[hidden email] and asked there.
>> Ken Causey helped me out and even he missed the difference between "" and ''
>> for a second.
>> I believe it would be beneficial to newbies to have this enhanced somehow,
>> to point
>> out the fact that strings aren't double-quoted.
>
> Tricky, given that the error message is correct. After you strip out
> the comments, you have
>
>  closer value: .
>
> which is clearly not kosher.
>
> What kind of fix would work for you?

It would be nicer if the "Argument expected" was shown right after the colon. Possibly the compiler could say what it saw instead ("found comment instead of argument").

- Bert -

> I'm just thinking that
> special-casing when you have a process part of a keyword message send
> followed by a comment is tricky:
>
>  this is: "valid" code
>
> for instance.
>
> frank
>
>> Thanks,
>>
>> Peter
>>
>>
>>
>>
>


P.
Reply | Threaded
Open this post in threaded view
|

Re: small fix to help newbies

P.
I agree with Bert. If the "Argument expected ->" message would appear right after the colon, that would be of great help. Checking to see if there's a comment where there should be an argument might be trickier (maybe by that time the parser has already stripped the comments), but it would be a plus.
It's hard to suggest something other than that; it's really not enough to just put the error message after the colon, because in the newbie's mind it will now be pointing to a string (s/he still hasn't been informed that it's a comment) so nothing has been clarified.
If detecting the comment is too hard for the parser, maybe just say "expecting argument, found '.' ". That'll give me a clue and let me know it's skipping "hey" for some reason.


On Mon, Aug 8, 2011 at 6:33 AM, Bert Freudenberg <[hidden email]> wrote:

On 08.08.2011, at 10:44, Frank Shearar wrote:

> On 8 August 2011 03:42, P. <[hidden email]> wrote:
>> Hi folks,
>>
>> I'm sending this email to both Squeak-dev and Pharo-project as you can see.
>> This is to suggest a fix.
>>
>> I typed this on a workspace:
>>
>> closure := [:x | Transcript show: x].
>> closure value: "hey".
>>
>> And when I "did it", the VM had me looking at this:
>>
>> closure := [:x | Transcript show: x].
>> closure value: "hey". Argument expected ->
>>
>> Which is cryptic at best for a newbie.
>> I visited #[hidden email] and asked there.
>> Ken Causey helped me out and even he missed the difference between "" and ''
>> for a second.
>> I believe it would be beneficial to newbies to have this enhanced somehow,
>> to point
>> out the fact that strings aren't double-quoted.
>
> Tricky, given that the error message is correct. After you strip out
> the comments, you have
>
>  closer value: .
>
> which is clearly not kosher.
>
> What kind of fix would work for you?

It would be nicer if the "Argument expected" was shown right after the colon. Possibly the compiler could say what it saw instead ("found comment instead of argument").

- Bert -

> I'm just thinking that
> special-casing when you have a process part of a keyword message send
> followed by a comment is tricky:
>
>  this is: "valid" code
>
> for instance.
>
> frank
>
>> Thanks,
>>
>> Peter
>>
>>
>>
>>
>





Reply | Threaded
Open this post in threaded view
|

Re: small fix to help newbies

Gary Dunn-2
In reply to this post by Frank Shearar-3
As I recall, perl would suggest a mistep when it sensed an unterminated string. Never a false positive, an occasional false negative, often spot on for me. But as Frank mentions, in this case it may be too tricky to be worth the effort. 

On Mon, Aug 8, 2011 at 1:44 AM, Frank Shearar <[hidden email]> wrote:
On 8 August 2011 03:42, P. <[hidden email]> wrote:
> Hi folks,
>
> I'm sending this email to both Squeak-dev and Pharo-project as you can see.
> This is to suggest a fix.
>
> I typed this on a workspace:
>
> closure := [:x | Transcript show: x].
> closure value: "hey".
>
> And when I "did it", the VM had me looking at this:
>
> closure := [:x | Transcript show: x].
> closure value: "hey". Argument expected ->
>
> Which is cryptic at best for a newbie.
> I visited #[hidden email] and asked there.
> Ken Causey helped me out and even he missed the difference between "" and ''
> for a second.
> I believe it would be beneficial to newbies to have this enhanced somehow,
> to point
> out the fact that strings aren't double-quoted.

Tricky, given that the error message is correct. After you strip out
the comments, you have

 closer value: .

which is clearly not kosher.

What kind of fix would work for you? I'm just thinking that
special-casing when you have a process part of a keyword message send
followed by a comment is tricky:

 this is: "valid" code

for instance.

frank

> Thanks,
>
> Peter
>
>
>
>




--
Gary Dunn
Honolulu