[Pharo-project] RBScanner>>#initializeClassificationTable
Hello guys, Is there a reason this method use : (Scanner isLiteralSymbol: '_') ifTrue: [ self initializeChars: '_' to: #alphabetic ] ifFalse: [ self initializeChars: '_' to: #special ]. and not (Scanner allowUnderscoreAsAssignment) ifTrue: [ self initializeChars: '_' to: #special ] ifFalse:[ self initializeChars: '_' to: #alphabetic ] ? Cheers, Ben
On Nov 25, 2010, at 10:58 44AM, Benjamin wrote:
Hello guys,
Is there a reason this method use :
(Scanner isLiteralSymbol: '_') ifTrue: [ self initializeChars: '_' to: #alphabetic ] ifFalse: [ self initializeChars: '_' to: #special ].
and not
(Scanner allowUnderscoreAsAssignment) ifTrue: [ self initializeChars: '_' to: #special ] ifFalse:[ self initializeChars: '_' to: #alphabetic ]
?
Cheers,
Ben
Compatibility I would guess. In Squeak, allowUnderscoreAsAssignment is still a Preferences method. Cheers, Henry
On Nov 25, 2010, at 11:12 59AM, Henrik Johansen wrote:
On Nov 25, 2010, at 10:58 44AM, Benjamin wrote:
Hello guys,
Is there a reason this method use :
(Scanner isLiteralSymbol: '_') ifTrue: [ self initializeChars: '_' to: #alphabetic ] ifFalse: [ self initializeChars: '_' to: #special ].
and not
(Scanner allowUnderscoreAsAssignment) ifTrue: [ self initializeChars: '_' to: #special ] ifFalse:[ self initializeChars: '_' to: #alphabetic ]
?
Cheers,
Ben
Compatibility I would guess. In Squeak, allowUnderscoreAsAssignment is still a Preferences method.
Cheers, Henry
P.S. At the very least it could be changed to Scanner isLiteralSymbol: #_ :)
On Thu, 25 Nov 2010, Henrik Johansen wrote:
On Nov 25, 2010, at 11:12 59AM, Henrik Johansen wrote:
On Nov 25, 2010, at 10:58 44AM, Benjamin wrote:
Hello guys,
Is there a reason this method use :
(Scanner isLiteralSymbol: '_') ifTrue: [ self initializeChars: '_' to: #alphabetic ] ifFalse: [ self initializeChars: '_' to: #special ].
and not
(Scanner allowUnderscoreAsAssignment) ifTrue: [ self initializeChars: '_' to: #special ] ifFalse:[ self initializeChars: '_' to: #alphabetic ]
?
Cheers,
Ben
Compatibility I would guess. In Squeak, allowUnderscoreAsAssignment is still a Preferences method.
Cheers, Henry
P.S. At the very least it could be changed to Scanner isLiteralSymbol: #_
I guess not. There was a bug in Squeak (and probably Pharo too), because the compiler replaced #_ to #':=' during compilation. See http://bugs.squeak.org/view.php?id=7571 . Levente
:)
On Thu, 25 Nov 2010, Henrik Johansen wrote:
On Nov 25, 2010, at 10:58 44AM, Benjamin wrote:
Hello guys,
Is there a reason this method use :
(Scanner isLiteralSymbol: '_') ifTrue: [ self initializeChars: '_' to: #alphabetic ] ifFalse: [ self initializeChars: '_' to: #special ].
and not
(Scanner allowUnderscoreAsAssignment) ifTrue: [ self initializeChars: '_' to: #special ] ifFalse:[ self initializeChars: '_' to: #alphabetic ]
?
Cheers,
Ben
Compatibility I would guess. In Squeak, allowUnderscoreAsAssignment is still a Preferences method.
No, it never was a method of Preferences. It's a pragma preference, but in Squeak 4.1 it has a different name, IIRC prefAllowUnderscoreAssignment. Levente
Cheers, Henry
On Nov 25, 2010, at 11:41 07AM, Levente Uzonyi wrote:
On Thu, 25 Nov 2010, Henrik Johansen wrote:
On Nov 25, 2010, at 10:58 44AM, Benjamin wrote:
Hello guys,
Is there a reason this method use :
(Scanner isLiteralSymbol: '_') ifTrue: [ self initializeChars: '_' to: #alphabetic ] ifFalse: [ self initializeChars: '_' to: #special ].
and not
(Scanner allowUnderscoreAsAssignment) ifTrue: [ self initializeChars: '_' to: #special ] ifFalse:[ self initializeChars: '_' to: #alphabetic ]
?
Cheers,
Ben
Compatibility I would guess. In Squeak, allowUnderscoreAsAssignment is still a Preferences method.
No, it never was a method of Preferences. It's a pragma preference, but in Squeak 4.1 it has a different name, IIRC prefAllowUnderscoreAssignment.
Levente
My bad, in the 4.1 image there's Preferences >> allowUnderscoreAssignment ^ self valueOfFlag: #allowUnderscoreAssignment ifAbsent: [false] (Added by Parser class>>#initialize), I didn't check if it was actually in use anymore. Compatibility seems the be the reason anyways though, as you said the Scanner pragma preference has a different name. On Nov 25, 2010, at 11:42 56AM, Levente Uzonyi wrote:
On Thu, 25 Nov 2010, Henrik Johansen wrote:
P.S. At the very least it could be changed to Scanner isLiteralSymbol: #_
I guess not. There was a bug in Squeak (and probably Pharo too), because the compiler replaced #_ to #':=' during compilation. See http://bugs.squeak.org/view.php?id=7571 .
:( Can't reproduce it in Pharo 1.0 onwards, with allowUnderscore on/off, though. Cheers, Henry
On Thu, 25 Nov 2010, Henrik Johansen wrote:
My bad, in the 4.1 image there's Preferences >> allowUnderscoreAssignment ^ self valueOfFlag: #allowUnderscoreAssignment ifAbsent: [false] (Added by Parser class>>#initialize), I didn't check if it was actually in use anymore.
Compatibility seems the be the reason anyways though, as you said the Scanner pragma preference has a different name.
I doubt there was any effort to write compatible code, there are countless packages that were originally written in Squeak, but now they are incompatble with it. In Squeak the pragma preference in Scanner was renamed recently to allowUnderscoreAsAssignment to resolve the incompatibility.
On Nov 25, 2010, at 11:42 56AM, Levente Uzonyi wrote:
On Thu, 25 Nov 2010, Henrik Johansen wrote:
P.S. At the very least it could be changed to Scanner isLiteralSymbol: #_
I guess not. There was a bug in Squeak (and probably Pharo too), because the compiler replaced #_ to #':=' during compilation. See http://bugs.squeak.org/view.php?id=7571 .
:( Can't reproduce it in Pharo 1.0 onwards, with allowUnderscore on/off, though.
That's fair, because you can't use underscores in selectors in Pharo. Levente
Cheers, Henry
participants (3)
-
Benjamin -
Henrik Johansen -
Levente Uzonyi