2016-08-13 2:54 GMT+02:00 Dale Henrichs <[email protected]>:
> Actually I'm just suggesting that the error message is ambiguous and I > that an error message that acknowledged the ambiguity would be useful. ... > pretty simple change I would think ... > > If one WERE writing a method using the | message selector, the existing > error messages make perfect sense. For everyone else making the mistake of > missing the message pattern, the additional information takes away the > confusion ... > > Changing the error message for this case is all that I'm suggesting .... > and it is just a suggestion to make things easier for beginners who do not > have a Smalltalk compiler in the their heads ... > > Dale > > I opened an issue 18932 <https://pharo.fogbugz.com/f/cases/18932/better-error-message-for-missing-message-pattern> better error message for missing message pattern > > On 08/12/2016 03:36 PM, Nicolas Cellier wrote: > > But the bar is a valid binary selector which takes a text parameter > > | text > | text '|' expected -> > := self requestPassword > > You seem to suggest that the parser should use formatting, > presence/absence or spaces/newlines, but it never did so, it just > skips/ignores spaces. > The parser process as much as possible until the first error. It never did > a global analysis to find the minimal error. That's a far more difficult > problem. > > Note that for the same kind of reason, while we could make ^ a binary > selector as I proposed once, we didn't yet by fear of interpreting things > differently in case of missing period: > > self seeThePeriodMissingAtEndOfThisSentence > ^self > > > 2016-08-13 0:02 GMT+02:00 Dale Henrichs <[email protected]> > : > >> >> >> On 08/12/2016 11:40 AM, Nicolai Hess wrote: >> >> >> >> 2016-08-12 20:30 GMT+02:00 Dale Henrichs <dale.henrichs@gemtalksystems. >> com>: >> >>> `'|' expected` is not the error message I would expect when the message >>> pattern is missing from a method and I try to accept in browser: >>> >>> >>> | text | >>> text '|' expected ->:= self requestPassword >>> ifTrue: [ UIManager default requestPassword: self prompt ] >>> ifFalse: [ UIManager default request: self prompt initialAnswer: >>> self template ]. >>> ^ (text isNil or: [ text isEmpty ]) >>> ifTrue: [ nil ] >>> ifFalse: [ text ] >>> >>> The highlighter was also confused turning red at the `->` instead at the >>> very beginning of the method ... >>> >> >> yeah, this is a funny one. >> I onced debugged the parser to find out why that's happening. Can you >> spot why this is a valid method : >> >> | text | >> | ^ text >> >> :) >> >> I cheated and used the syntax highlighting to give me subtle but import >> clues :) Things I missed when initially trying to figure out what I had >> done wrong ... perhaps an error message that special cases this would be >> called for: "'|' expected or missing message message pattern" ... There are >> at least two developers who expected the syntax highlighter to do a better >> job ... and I sent this thinking about newbies running into what I assume >> would be a common mistake ... >> >> Dale >> >> >> > >
