Seems
Integer>>#| Is not in Squeak 6.0 . Any reason ? Edgar |
On 23/05/20 3:18 pm, Edgar De Cleene wrote:
> Seems > Integer>>#| > > Is not in Squeak 6.0 . > Any reason ? AFAIK, #| has always been boolean or operator in Smalltalk. The bitwise or is #bitOr: as in: 2r1011 bitOr: 2r101 "15" HTH .. Subbu |
Yes, the bit-wise operators from C translate to #bit*: messages in Smalltalk. However, ages ago, someone started to support #>> and #<< on Integer for bit shifting. So, it is somewhat inconsistent. Even though there are & and | in Boolean, most of the time, the code reads better with #and: or #or:. It can be challenging already to teach students the difference between "expOne or: [expTwo]" and "expOne or: (expTwo)". Adding & and | to the mix is not helpful. :-D Next step would be to support #ifTrue:ifFalse: on Integer? Please, don't. :-) Best, Marcel
|
Of course you right
But Pharo have this Sent from my iPhone On 23 May 2020, at 12:37, Marcel Taeumel <[hidden email]> wrote:
|
Hi Edgar, Hi Marcel, Pharo team probably wanted to lower the gap with some mainstream languages and provide same kind of "operators"... IMO, we don't need two ways to do the same thing, and we should better let that out of Squeak. I suggest using an optional package if compatibility matters. However, note that for VMMaker << and >> are directed shifts and it makes a big difference. The code generated for bitShift: has to check the sign of the shift and that ain't good. Le sam. 23 mai 2020 à 21:50, Edgar De Cleene <[hidden email]> a écrit :
|
On Sun, 24 May 2020 at 04:31, Nicolas Cellier <[hidden email]> wrote:
Apologies to divert to a Pharo query but it should be quick (even if I'm looking at the code I might not know...) Is Pharo's #<< and #>> equivalent to VMMaker #<< and #>> ? cheers -ben
|
Hi Ben. > Is Pharo's #<< and #>> equivalent to VMMaker #<< and #>> ? Hmm... For a comparison, I would first take a look at the source code and generated bytecodes, respectively. :-) Best, Marcel
|
Free forum by Nabble | Edit this page |