Re: [Pharo-dev] printing Symbol
> On Jan 19, 2020, at 1:50 PM, Stéphane Ducasse > wrote: > > > The idea that is that I would like to be able to > > text -> tokens -> text > > For text -> tokens > > (RBScanner on: 'self classVariables: { #A . #B }' readStream) > contents collect: #value > > > I wrote a little method that takes the result of the RBScanner and recreate > the text > But I cannot get this method to work. > I’m puzzled because the symbols are eaten. > > > expressionStringFrom: aLine > > "self new > expressionStringFrom: #('self' 'classVariables:' ${ #A $. #B > $}) > >>> > 'self classVariables: { A . B }' > " > ^ String streamContents: [ :s | > aLine > do: [ :each | s << each ] > separatedBy: [ s space ]] > > I tried with print:, printOn:, but I failed. > > Any idea? With Symbols one needs to use storeOn: > > S. > > > > > > Stéphane Ducasse > http://stephane.ducasse.free.fr / http://www.pharo.org > 03 59 35 87 52 > Assistant: Julie Jonas > FAX 03 59 57 78 50 > TEL 03 59 35 86 16 > S. Ducasse - Inria > 40, avenue Halley, > Parc Scientifique de la Haute Borne, Bât.A, Park Plaza > Villeneuve d'Ascq 59650 > France >
[Pharo-dev] Object>>#pinInMemory performance
Hello I stumbled across a performance issue when pinning objects in memory. Below I have two scripts that pin and unpin a byte array (or any object) 20k times. The first script pins each time a new byte array: > [ 2 timesRepeat: [ > | array wasPinned | > array := ByteArray new. > wasPinned := array pinInMemory. > array setPinnedInMemory: wasPinned. > ] ] timeToRunWithoutGC. *"4284"* while the second one pins the same instance of array: > array := ByteArray new. > [ 2 timesRepeat: [ >| wasPinned | >wasPinned := array pinInMemory. >array setPinnedInMemory: wasPinned. > ] ] timeToRunWithoutGC "*12*" However, as you can see there is a huge performance difference between these scripts. Is it expected or is it a bug? And if it is expected what can be happening in VM that leads to such huge performance impact? Thanks! Cheers, Alex
Re: [Pharo-dev] Wrong behavior of receiveDataInto:fromHost:port:
Hi Hilaire, Given the following comment: Socket>>#primSocket: socketID receiveUDPDataInto: aStringOrByteArray startingAt: startIndex count: count "Receive data from the given socket into the given array starting at the given index. Return an Array containing the amount read, the host address byte array, the host port, and the more flag" self primitiveFailed I would says that the primitive result uses a ByteArray to represent the (other party's) host address in its second slot. I find the method Socket>>#receiveDataInto:fromHost:port: quite weird: why would you restrict from whom you receive datagrams, especially since non-matching datagrams are simply thrown away. But I do agree that SocketAddress is a weird class, maybe its #species should be set to ByteArray so that #= would work between them, but I am not sure. Sven > On 19 Jan 2020, at 20:24, HilaireFernandes wrote: > > Hello, > > I would like to discuss one point regarding this method. In my opinion its > parameter hostAddress is expected to be a SocketAdress, but the method > interprets it as a ByteArray. So in the code bellow, the returned result is > 0, although the host responds a datagram: > > server := NetNameResolver addressForName: 'localhost'. > socket := Socket newUDP. > socket sendUDPData: packet toHost: server port: 3. > socket waitForData. > packet := ByteArray new: 200. > result := socket receiveDataInto: packet fromHost: server port: 3. > > The method receiveUDPData:toHost:port: should be amended as follow to make > it symmetric with sendUDPData... : > > [ | datagram | > datagram := self receiveUDPDataInto: aStringOrByteArray. > ((datagram at: 2) *asSocketAddress* = hostAddress and: [ > (datagram at: 3) > = portNumber ]) > ifTrue: [ ^ datagram at: 1 ] > ifFalse: [ ^0 ] ] repeat > > What do you think? > > > > - > http://drgeo.eu > -- > Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html >
[Pharo-dev] printing Symbol
The idea that is that I would like to be able to text -> tokens -> text For text -> tokens (RBScanner on: 'self classVariables: { #A . #B }' readStream) contents collect: #value I wrote a little method that takes the result of the RBScanner and recreate the text But I cannot get this method to work. I’m puzzled because the symbols are eaten. expressionStringFrom: aLine "self new expressionStringFrom: #('self' 'classVariables:' ${ #A $. #B $}) >>> 'self classVariables: { A . B }' " ^ String streamContents: [ :s | aLine do: [ :each | s << each ] separatedBy: [ s space ]] I tried with print:, printOn:, but I failed. Any idea? S. Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Julie Jonas FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
[Pharo-dev] Wrong behavior of receiveDataInto:fromHost:port:
Hello, I would like to discuss one point regarding this method. In my opinion its parameter hostAddress is expected to be a SocketAdress, but the method interprets it as a ByteArray. So in the code bellow, the returned result is 0, although the host responds a datagram: server := NetNameResolver addressForName: 'localhost'. socket := Socket newUDP. socket sendUDPData: packet toHost: server port: 3. socket waitForData. packet := ByteArray new: 200. result := socket receiveDataInto: packet fromHost: server port: 3. The method receiveUDPData:toHost:port: should be amended as follow to make it symmetric with sendUDPData... : [ | datagram | datagram := self receiveUDPDataInto: aStringOrByteArray. ((datagram at: 2) *asSocketAddress* = hostAddress and: [ (datagram at: 3) = portNumber ]) ifTrue: [ ^ datagram at: 1 ] ifFalse: [ ^0 ] ] repeat What do you think? - http://drgeo.eu -- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
Re: [Pharo-dev] New Latest VM - Please Test
thanks > Am 19.01.2020 um 19:10 schrieb teso...@gmail.com: > > You are right Norbert, sorry I miss the data. > This is available through zeroConf. > Doing for example: > > wget -O - get.pharo.org/64/70+vmLatest | bash > wget -O - get.pharo.org/64/80+vmLatest | bash > > Cheers, > Pablo > > On Sat, Jan 18, 2020 at 7:53 AM Norbert Hartl wrote: >> >> Just a short remark. If you announce something it is good to say how to get >> it. What seems obvious to you is not necessarily obvious for others. >> >> Norbert >> >>> Am 17.01.2020 um 10:49 schrieb "teso...@gmail.com" : >>> >>> Hello, >>> I have just uploaded a new version of the VM as the latest. This >>> version is the one to be intended for Pharo 8 release. Please feel >>> free to test it. >>> >>> Changes: >>> >>> - Fix in the GC corruption error >>> >>> Thanks. >>> >>> -- >>> Pablo Tesone. >>> teso...@gmail.com >>> >> >> > > > -- > Pablo Tesone. > teso...@gmail.com >
Re: [Pharo-dev] New Latest VM - Please Test
You are right Norbert, sorry I miss the data. This is available through zeroConf. Doing for example: wget -O - get.pharo.org/64/70+vmLatest | bash wget -O - get.pharo.org/64/80+vmLatest | bash Cheers, Pablo On Sat, Jan 18, 2020 at 7:53 AM Norbert Hartl wrote: > > Just a short remark. If you announce something it is good to say how to get > it. What seems obvious to you is not necessarily obvious for others. > > Norbert > > > Am 17.01.2020 um 10:49 schrieb "teso...@gmail.com" : > > > > Hello, > > I have just uploaded a new version of the VM as the latest. This > > version is the one to be intended for Pharo 8 release. Please feel > > free to test it. > > > > Changes: > > > > - Fix in the GC corruption error > > > > Thanks. > > > > -- > > Pablo Tesone. > > teso...@gmail.com > > > > -- Pablo Tesone. teso...@gmail.com
[Pharo-dev] [Pharo 8.0] Build #1121: update Spec2 to 0.2.0
There is a new Pharo build available! The status of the build #1121 was: FAILURE. The Pull Request #5513 was integrated: "update Spec2 to 0.2.0" Pull request url: https://github.com/pharo-project/pharo/pull/5513 Issue Url: https://github.com/pharo-project/pharo/issues/Pharo8.0 Build Url: https://ci.inria.fr/pharo-ci-jenkins2/job/Test%20pending%20pull%20request%20and%20branch%20Pipeline/job/Pharo8.0/1121/