Re: [Pharo-users] Macros?

2018-05-25 Thread Clément Bera
On Sat, May 26, 2018 at 8:07 AM, Denis Kudriashov 
wrote:

> Hi
>
> 2018-05-26 8:46 GMT+03:00 Clément Bera :
>
>> Just mentioning another use-case:
>>
>> getDatabaseInstance
>> ^ (Production CifTrue: [Database] CifFalse: [MockDatabase]) new
>>
>
> I think following code will work:
>
> getDatabaseInstance
>  ^ (Production ifTrue: [Database] ifFalse: [MockDatabase])
> asMethodConstant new
>
>
>
Arf, obviously you try to work around the example. You can have anything in
the block, not necessarily a constant.

foo
   ^ Condition  CifTrue: [self bar] CifFalse: [self baz]

And I want the condition to be replaced by the contents of one block or the
other, not just by a constant.


>>
>>
>> Since I use conditional compilation more often than just precompiling
>> constants.
>>
>> I don't see an equivalent of asMethodConstant AST manipulation at
>> runtime strategy in the image for this case right now but it's probably a
>> couple lines of code with Reflectivity.
>>
>> On Sat, May 26, 2018 at 7:28 AM, Clément Bera 
>> wrote:
>>
>>>
>>>
>>> On Fri, May 25, 2018 at 10:44 PM, Esteban Lorenzano >> > wrote:
>>>
>>>>
>>>>
>>>> On 25 May 2018, at 17:30, Clément Bera  wrote:
>>>>
>>>> What about a preprocessor like the Java preprocessors ? The Truffle
>>>> project relies heavily on that for high performance Java and it's quite
>>>> nice. It's difficult to do that in Smalltalk right now.
>>>>
>>>> I think if you want to do what are asking for you just need to write a
>>>> bytecode compiler extension.
>>>>
>>>> I did something similar in the past to have precomputed constants
>>>> through AST manipulation at compilation time. You can find it here with
>>>> examples: http://smalltalkhub.com/#!/~ClementBera/NeoCompiler. Once
>>>> the code is loaded you need to recompile the examples (NeoCompilerExample
>>>> withAllSubclassesDo: #compileAll.). With it you can write code such as:
>>>> [ Smalltalk vm class ] Cvalue
>>>> And depending if the compiler allowsPrecompilation or not, the bytecode
>>>> compiler generates:
>>>> Smalltalk vm class
>>>> Or just a push literal with the precomputed value (the class
>>>> VirtualMachine).
>>>>
>>>>
>>>> this is not what #asMethodConstant provides?
>>>>
>>>
>>> Can you turn asMethodConstant On and Off so you have the constant in
>>> production and not a development time ? Typically at development time I
>>> change the constants generated a lot and I don't want to waste time
>>> recompiling all the time.
>>>
>>> But yeah, my project is from 2014. I guess instead of preprocessing you
>>> could do everything at runtime with AST manipulation/recompilation like
>>> in asMethodConstant.
>>>
>>> The main point of preprocessing IMO is to control performance, it's just
>>> easier for me to just look at the generated bytecode and change the
>>> preprocessor until it gets what I want, it's not always easy to run code
>>> that will change your method at runtime quickly so you can look at the
>>> bytecode generated.
>>>
>>> Anyway, I am not convinced at all something like that should be in the
>>> base image.
>>>
>>>
>>>>
>>>> Esteban
>>>>
>>>> In the end I decided not to use this, but you can use it and extend it
>>>> to support more than just constants (any AST manipulation is possible).
>>>> Just checked it works in Pharo 6.
>>>>
>>>> On Fri, May 25, 2018 at 4:26 PM, Stephan Eggermont 
>>>> wrote:
>>>>
>>>>> Debiller 777 
>>>>> wrote:
>>>>> > Well, I've already asked about adding new literals to pharo or
>>>>> Smalltalk in
>>>>> > general, however this time I have a better idea:
>>>>> > macros. Can they be added? Because if I understand correctly they
>>>>> may be
>>>>> > the only way to do that.
>>>>>
>>>>> Why do you think they would be a good idea? We have powerful
>>>>> meta-programming facilities that are well understood and somewhat
>>>>> supported
>>>>> by tooling. How do we get value out of macros?
>>>>>
>>>>> Stephan
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Clément Béra
>>>> https://clementbera.github.io/
>>>> https://clementbera.wordpress.com/
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Clément Béra
>>> https://clementbera.github.io/
>>> https://clementbera.wordpress.com/
>>>
>>
>>
>>
>> --
>> Clément Béra
>> https://clementbera.github.io/
>> https://clementbera.wordpress.com/
>>
>
>


-- 
Clément Béra
https://clementbera.github.io/
https://clementbera.wordpress.com/


Re: [Pharo-users] Macros?

2018-05-25 Thread Clément Bera
Just mentioning another use-case:

getDatabaseInstance
^ (Production CifTrue: [Database] CifFalse: [MockDatabase]) new

Since I use conditional compilation more often than just precompiling
constants.

I don't see an equivalent of asMethodConstant AST manipulation at runtime
strategy in the image for this case right now but it's probably a couple
lines of code with Reflectivity.

On Sat, May 26, 2018 at 7:28 AM, Clément Bera 
wrote:

>
>
> On Fri, May 25, 2018 at 10:44 PM, Esteban Lorenzano 
> wrote:
>
>>
>>
>> On 25 May 2018, at 17:30, Clément Bera  wrote:
>>
>> What about a preprocessor like the Java preprocessors ? The Truffle
>> project relies heavily on that for high performance Java and it's quite
>> nice. It's difficult to do that in Smalltalk right now.
>>
>> I think if you want to do what are asking for you just need to write a
>> bytecode compiler extension.
>>
>> I did something similar in the past to have precomputed constants through
>> AST manipulation at compilation time. You can find it here with examples:
>> http://smalltalkhub.com/#!/~ClementBera/NeoCompiler. Once the code is
>> loaded you need to recompile the examples (NeoCompilerExample
>> withAllSubclassesDo: #compileAll.). With it you can write code such as:
>> [ Smalltalk vm class ] Cvalue
>> And depending if the compiler allowsPrecompilation or not, the bytecode
>> compiler generates:
>> Smalltalk vm class
>> Or just a push literal with the precomputed value (the class
>> VirtualMachine).
>>
>>
>> this is not what #asMethodConstant provides?
>>
>
> Can you turn asMethodConstant On and Off so you have the constant in
> production and not a development time ? Typically at development time I
> change the constants generated a lot and I don't want to waste time
> recompiling all the time.
>
> But yeah, my project is from 2014. I guess instead of preprocessing you
> could do everything at runtime with AST manipulation/recompilation like
> in asMethodConstant.
>
> The main point of preprocessing IMO is to control performance, it's just
> easier for me to just look at the generated bytecode and change the
> preprocessor until it gets what I want, it's not always easy to run code
> that will change your method at runtime quickly so you can look at the
> bytecode generated.
>
> Anyway, I am not convinced at all something like that should be in the
> base image.
>
>
>>
>> Esteban
>>
>> In the end I decided not to use this, but you can use it and extend it to
>> support more than just constants (any AST manipulation is possible).
>> Just checked it works in Pharo 6.
>>
>> On Fri, May 25, 2018 at 4:26 PM, Stephan Eggermont 
>> wrote:
>>
>>> Debiller 777 
>>> wrote:
>>> > Well, I've already asked about adding new literals to pharo or
>>> Smalltalk in
>>> > general, however this time I have a better idea:
>>> > macros. Can they be added? Because if I understand correctly they may
>>> be
>>> > the only way to do that.
>>>
>>> Why do you think they would be a good idea? We have powerful
>>> meta-programming facilities that are well understood and somewhat
>>> supported
>>> by tooling. How do we get value out of macros?
>>>
>>> Stephan
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Clément Béra
>> https://clementbera.github.io/
>> https://clementbera.wordpress.com/
>>
>>
>>
>
>
> --
> Clément Béra
> https://clementbera.github.io/
> https://clementbera.wordpress.com/
>



-- 
Clément Béra
https://clementbera.github.io/
https://clementbera.wordpress.com/


Re: [Pharo-users] Macros?

2018-05-25 Thread Clément Bera
On Fri, May 25, 2018 at 10:44 PM, Esteban Lorenzano 
wrote:

>
>
> On 25 May 2018, at 17:30, Clément Bera  wrote:
>
> What about a preprocessor like the Java preprocessors ? The Truffle
> project relies heavily on that for high performance Java and it's quite
> nice. It's difficult to do that in Smalltalk right now.
>
> I think if you want to do what are asking for you just need to write a
> bytecode compiler extension.
>
> I did something similar in the past to have precomputed constants through
> AST manipulation at compilation time. You can find it here with examples:
> http://smalltalkhub.com/#!/~ClementBera/NeoCompiler. Once the code is
> loaded you need to recompile the examples (NeoCompilerExample
> withAllSubclassesDo: #compileAll.). With it you can write code such as:
> [ Smalltalk vm class ] Cvalue
> And depending if the compiler allowsPrecompilation or not, the bytecode
> compiler generates:
> Smalltalk vm class
> Or just a push literal with the precomputed value (the class
> VirtualMachine).
>
>
> this is not what #asMethodConstant provides?
>

Can you turn asMethodConstant On and Off so you have the constant in
production and not a development time ? Typically at development time I
change the constants generated a lot and I don't want to waste time
recompiling all the time.

But yeah, my project is from 2014. I guess instead of preprocessing you
could do everything at runtime with AST manipulation/recompilation like
in asMethodConstant.

The main point of preprocessing IMO is to control performance, it's just
easier for me to just look at the generated bytecode and change the
preprocessor until it gets what I want, it's not always easy to run code
that will change your method at runtime quickly so you can look at the
bytecode generated.

Anyway, I am not convinced at all something like that should be in the base
image.


>
> Esteban
>
> In the end I decided not to use this, but you can use it and extend it to
> support more than just constants (any AST manipulation is possible).
> Just checked it works in Pharo 6.
>
> On Fri, May 25, 2018 at 4:26 PM, Stephan Eggermont 
> wrote:
>
>> Debiller 777 
>> wrote:
>> > Well, I've already asked about adding new literals to pharo or
>> Smalltalk in
>> > general, however this time I have a better idea:
>> > macros. Can they be added? Because if I understand correctly they may be
>> > the only way to do that.
>>
>> Why do you think they would be a good idea? We have powerful
>> meta-programming facilities that are well understood and somewhat
>> supported
>> by tooling. How do we get value out of macros?
>>
>> Stephan
>>
>>
>>
>>
>
>
> --
> Clément Béra
> https://clementbera.github.io/
> https://clementbera.wordpress.com/
>
>
>


-- 
Clément Béra
https://clementbera.github.io/
https://clementbera.wordpress.com/


Re: [Pharo-users] Macros?

2018-05-25 Thread Clément Bera
What about a preprocessor like the Java preprocessors ? The Truffle project
relies heavily on that for high performance Java and it's quite nice. It's
difficult to do that in Smalltalk right now.

I think if you want to do what are asking for you just need to write a
bytecode compiler extension.

I did something similar in the past to have precomputed constants through
AST manipulation at compilation time. You can find it here with examples:
http://smalltalkhub.com/#!/~ClementBera/NeoCompiler. Once the code is
loaded you need to recompile the examples (NeoCompilerExample
withAllSubclassesDo: #compileAll.). With it you can write code such as:
[ Smalltalk vm class ] Cvalue
And depending if the compiler allowsPrecompilation or not, the bytecode
compiler generates:
Smalltalk vm class
Or just a push literal with the precomputed value (the class VirtualMachine
).
In the end I decided not to use this, but you can use it and extend it to
support more than just constants (any AST manipulation is possible).
Just checked it works in Pharo 6.

On Fri, May 25, 2018 at 4:26 PM, Stephan Eggermont  wrote:

> Debiller 777 
> wrote:
> > Well, I've already asked about adding new literals to pharo or
> Smalltalk in
> > general, however this time I have a better idea:
> > macros. Can they be added? Because if I understand correctly they may be
> > the only way to do that.
>
> Why do you think they would be a good idea? We have powerful
> meta-programming facilities that are well understood and somewhat supported
> by tooling. How do we get value out of macros?
>
> Stephan
>
>
>
>


-- 
Clément Béra
https://clementbera.github.io/
https://clementbera.wordpress.com/


Re: [Pharo-users] Saving a Smalltalk Project

2018-05-03 Thread Clément Bera
That is the answer I would give:

Biggest Smalltalk community in Silicon valley is likely the Lam Research
one (dozens of devs). On my blog post talking about Smalltalk, I have 2k
views per Smalltalk community-wide audience post, so the community is at
least that big. Smalltalk conferences (Smalltalks and Esug) have usually
around 200 attendees.

To hire Smalltalk developers, a job offer mail through esug or pharo
mailing list is one of the best way to get people to apply, other solutions
include giving a 10 min talk at ESUG (Europe) or Smalltalks (Argentina)
conference and say loud and clear you are hiring (people may be able to
move to other countries). Getting a few developers should not be that hard
if you accept remote positions.

Migrating from Squeak to Pharo is something to discuss with the developers
you hire, things like IoT and Magma DB support might not be easy to port,
so it is difficult to tell with the little information provided. Pharo's
community is likely the easiest to hire new Smalltalk developers though,
and you can check the Pharo consortium website for support and success
stories to ease communication with your investors and partners.



On Wed, May 2, 2018, 20:21 horrido  wrote:

> I received the following message:
>
> *We started off doing a small project in conservation in South Africa that
> involved tracking Rhinos in a remote GPS denied environment and ended up
> with some impressive building blocks for a Big Data Platform for IoT. The
> platform includes its own GIS subsystem and parts of an Expert System.
>
> Due to the choice made by my business partner and handful of contractors
> the
> platform ended up being built in Smalltalk on Squeak  VM and the Magma
> Object Database.
>
> We now believe we may have the beginning of a commercial platform however
> its notoriously difficult to find Smalltalk developers so I am in half
> minds
> to migrate to a platform which uses a more mainstream language (Java /
> Python) as I have been getting some strange reactions from Angel Investors
> /
> VCs and mainstream developers.
>
> ...
>
> I wanted to ask you if you have information on how big the Smalltalk
> community is and whether its better to migrate to Pharo from Squeak and
> what
> types of recent industrial projects youve come across that use Smalltalk?
>
> Also I wondered if you know of any active smalltalk group in Silicon Valley
> and what are the best forums for professional SmallTalk development.*
>
> I would very much like to save their project as a Smalltalk project. The
> principal issue seems to be finding enough Smalltalk developers. I don't
> know if they need on-site developers or if remote developers can pass
> muster. I strongly suspect the former.
>
> How hard would it be to find Smalltalkers willing to work in Silicon
> Valley,
> or South Africa?
>
> What is the best response to this person? Thanks.
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>
>


Re: [Pharo-users] Literals

2018-04-27 Thread Clément Bera
The guy who asked the question said: "...when you want to shorten some
object initialization"

Using ClassVariable is an alternative way to shorten object initialization,
reading a ClassVariable is almost the same performance as reading a
literal, so that looked like a good alternative to me. Both the
ClassVariable and the literal have the same issues (same object so if you
mutate it you have to deal with it).

But yes, it's not a new literal.

For new literals, you can extend the compiler or hard patch thing:

MyClass>>foo
^ #bar

(MyClass>>#foo) literalAt: ((MyClass>>#foo) literals indexOf: #bar) put:
Set new.

MyClass new foo

>>> a Set ()

Obviously it depends what you mean by literal, the latter code uses the
literal bytecode instruction, which does not make the pushed object a
literal object...

On Fri, Apr 27, 2018 at 8:59 PM, Esteban A. Maringolo 
wrote:

> On 27/04/2018 15:35, Richard Sargent wrote:
> > On Fri, Apr 27, 2018 at 2:08 PM, Esteban A. Maringolo
> > mailto:emaring...@gmail.com>> wrote:
>
> > As far as I knew the only way to have new literals was to modify the
> > compiler.
> >
> >
> > Yes.
> >
> > VA Smalltalk has an interesting syntax extension which allows an
> > arbitrary expression to be a compile-time literal.
> > Going by memory, something like ##(Dictionary new at: #a put: self
> > something; at: #b put: self somethingElse; yourself).
>
> Dolphin Smalltalk provides that ##() literal as well since a decade at
> least, so you have the full expression that gave origin to that literal,
> but you don't need to compute it every time it is accessed.
>
> Although I don't remember seeing it with Dictionaries, but more with
> string concatenations or "magic numbers" like seconds in a day stored as
> ##(24 * 60 * 60).
>
> Regards,
>
>
> --
> Esteban A. Maringolo
>
>


-- 
Clément Béra
https://clementbera.github.io/
https://clementbera.wordpress.com/


Re: [Pharo-users] Literals

2018-04-27 Thread Clément Bera
Not really.

You can use ClassVariables though. Here's an example for Sets:

Object subclass: #MyClass
instanceVariableNames: ''
classVariableNames: 'MyClassVar'
package: 'MyPackage'

MyClass class>>initialize
super initialize.
MyClassVar := Set new.

MyClass>>foo
self bar: MyClassVar

Obviously sets are not as easy to deal with. You cannot mutate empty
arrays/bytearrays, if you concatenate something it creates a new object.
You can add things in sets. So you need to be careful... You can make the
object read-only to avoid issues (MyClassVar beReadOnlyObject).



On Fri, Apr 27, 2018 at 3:19 PM, Debiller 777 
wrote:

> You know, literals are quite useful in case when you want to shorten some
> object initialization. For example #() and {} for arrays and $[]for byte
> arrays. However, if there is a way to add custom literals, for example for
> sets (something like #{} I guess)? how to do it? and can some special kind
> of objects for creating literals easily be added to Pharo?
>



-- 
Clément Béra
https://clementbera.github.io/
https://clementbera.wordpress.com/


Re: [Pharo-users] Where do we go now ?

2018-04-13 Thread Clément Bera
"Alpha software can be unstable and could cause crashes or data loss" [1]

Experiencing instability, crashes and data loss in the alpha version of a
software, including Pharo alpha, is to be expected and nothing to be
surprised about. The support of the Pharo stable version (currently 6.1)
has significantly improved in the past year. Many fixes and enhancements
were back-ported from Pharo 7 to Pharo 6.1. Based on your comments, it
seems that you have issues because you are not using the version of Pharo
that fits your needs (i.e. the stable version).

Checking the Pharo website [2], it seems there are *no* download links to
the alpha version so far because it's not considered stable enough. Where
did you get a link to download Pharo 7 alpha ?

[1] https://en.wikipedia.org/wiki/Software_release_life_cycle
[2] https://pharo.org/download


On Fri, Apr 13, 2018 at 11:26 AM, Benoit St-Jean via Pharo-users <
pharo-users@lists.pharo.org> wrote:

>
>
> -- Forwarded message --
> From: Benoit St-Jean 
> To: Esteban Lorenzano 
> Cc: Any question about pharo is welcome 
> Bcc:
> Date: Fri, 13 Apr 2018 09:26:09 + (UTC)
> Subject: Re: [Pharo-users] Where do we go now ?
> BTW, why put an .exe installer for Windows available when it crashes right
> from the start? It just doesn't work at all.  Period.  For everyone.
>
> And I thought looking for senders of a method was something we mastered a
> long time ago, like starting with Smalltalk-76.  Am I supposed to assume
> that everything, even basic functionalities, are all broken because it's
> labeled "alpha" ?
>
>
> -
> Benoît St-Jean
> Yahoo! Messenger: bstjean
> Twitter: @BenLeChialeux
> Pinterest: benoitstjean
> Instagram: Chef_Benito
> IRC: lamneth
> Blogue: endormitoire.wordpress.com
> "A standpoint is an intellectual horizon of radius zero".  (A. Einstein)
>
>
> On Friday, April 13, 2018, 5:20:28 a.m. EDT, Esteban Lorenzano <
> esteba...@gmail.com> wrote:
>
>
>
>
> On 13 Apr 2018, at 11:07, Benoit St-Jean  wrote:
>
> I'm on Windows 10, using Pharo 7.0 alpha 32 bit.
>
>
> and btw… which part of ALPHA you do not get?
>

> Esteban
>
>


-- 
Clément Béra
https://clementbera.github.io/
https://clementbera.wordpress.com/


Re: [Pharo-users] Slower

2018-04-04 Thread Clément Bera
Hi Hilaire,

Do you have to use the world or Morphic at all ?

I wrote 2 different real-time 2D games at 50fps in Pharo [1,2]. I tried
using Morphic but that was crazy slow I could not even get 20fps. Instead I
use direct bindings to Cairo surface and SDL2 window and I don't open the
world morph at all to avoid the delays due to its cycles which are also
crazy (I open Pharo in headless, then the Pharo code opens a SDL2 window
and draws on it using Cairo). Then I was just careful on the number of
allocations, especially closures, in between frame rendering and also on
algorithms (I had 60% of time spent creating rectangle in corner: since it
performs a lot of min max computation, rewriting that to fastCorner method
without min max greatly improved the performance in my case). I still have
frame drops from time to time but that's hardly noticeable.

If you're scared of using Cairo / SDL2 because you deploy on specific
platforms like mobiles, you can still use BitBlt. The point being not to
run WorldMorph cycles at all but instead manage yourself what is drawn. If
possible don't use Morph at all too, it has many features that likely you
don't use, slowing down your system and wasting battery on mobiles for
nothing.

[1] https://github.com/clementbera/wizard-battle-arena
[2] https://github.com/clementbera/SpiderInvasion


On Wed, Apr 4, 2018, 15:49 Hilaire  wrote:

> Hi,
>
> I discover this Dr. Geo Smalltalk sketch to animate is about 60% slowler
> on P7 compare to P3:
>
> | fig point comment x y random inArc tries|
> "Monte-Carlo PI approximation"
> fig := DrGeoCanvas new fullscreen scale: 400.
> fig arcCenter: 0@0 from:  1@0 to: 0@1.
> fig polygon: { 0@0. 0@1. 1@1. 1@0 }.
> comment := fig texte: '' a: 0@ -0.1.
> random := Random seed: Time millisecondClockValue.
> tries := 500.
> inArc := 0.
> [1 a: tries faire: [: try |
>  x := random next.
>  y := random next.
>  point := (fig point: x@y) small.
>  (x squared + y squared) > 1
>  ifTrue: [point color: Color blue  ]
>  ifFalse: [inArc := inArc + 1 ].
> comment text: 'Tries: ', try asString, '
> approx: ', (inArc * 4 / try) asFloat asString.
> World doOneCycle.
> ] ] timeProfile
>
> The log are enclosed to compare. The mains differences seems to be
> during the world update. Years ago when porting to P3 I also see an
> important time performance degradation[1] and it remained unresolved.
>
>
> [1] http://forum.world.st/Slowness-question-tt4761717.html
>
>
>
>
> --
> Dr. Geo
> http://drgeo.eu
>
>


Re: [Pharo-users] Porting Transducers to Pharo

2018-03-21 Thread Clément Bera
On Fri, Jun 2, 2017, 17:05 Steffen Märcker  wrote:

> Dear all,
>
> thanks for the many suggestions. I didn't had time to test all
> import/export ways yet. But for now, I can report on two:
>
> 1) NGFileOuter
> Unfortunately It raised several MNUs in my image. I'll investigate them
> later.
>
> 2) FileOut30 (VW Contributed)
> I was able to file out the code except for the package definition.
> Replacing {category: ''} in the class definitions with {package:
> 'Transducers'} fixed that. However, methods that extend existing classes
> did not end up in the Transducers package. Is there a similar easy change
> to the file-out making that happen? Also I'd like to add the package
> comment if that's possible.
>
> Most things appear to work as far as I can see. Two exceptions:
> 1) Random is a subclass of Stream in VW and in Pharo it is not. Hence,
> I'll have to copy some methods from Stream to Random.
> 2) I used #beImmutable in VW but I couldn't yet figure out how to make
> objects immutable in Pharo.
>

#beReadOnlyObject. Pharo 6.1 and onwards.
#beWritable to revert.


> However, until the tests are ported, I cannot guarantee. Porting the test
> suite will be another beast, since I rely on the excellent mocking/stubbing
> library DoubleAgents by Randy Coulman. I am not sure how I will handle
> that. In general, I think it would be really worth the effort to be ported
> to Pharo, too. DoubleAgents is pretty powerful and produces easy to read
> and understand mocking/stubbing code. Personally, I prefer it clearly,
> e.g., over Mocketry (no offence intended!).
>
> Attached you'll find the file-out that I loaded into Pharo. The issues
> above are not addressed yet. However, the following example works:
>
> | scale sides count collect experiment random samples coin flip |
>
> scale := [:x | (x * 2 + 1) floor] map.
> sides := #(heads tails) replace.
> count := 1000 take.
>
> collect := [:bag :c | bag add: c; yourself].
> experiment := (scale * sides * count) transform: collect.
> random := #(0.1 0.3 0.4 0.5 0.6 0.7 0.8 0.9).
>
> samples := random
>
>   reduce: experiment
>   init: Bag new.
>
> samples := random
>
>   transduce: scale * sides * count
>   reduce: collect
>   init: Bag new.
>
> coin := sides <~ scale <~ random.
>
> flip := Bag <~ count.
>
> samples := flip <~ coin.
>
>
> Best, Steffen
>
>
>
> Am .06.2017, 08:16 Uhr, schrieb Stephane Ducasse  >:
>
> There is a package for that NGFileOuter or something like that on cincom
>> store.
>> We used it for mobydic code.
>>
>> On Wed, May 31, 2017 at 6:35 PM, Alexandre Bergel <
>> alexandre.ber...@me.com>
>> wrote:
>>
>> If I remember correctly, there is a parcel in VisualWorks to export a file
>>> out (Squeak format).
>>>
>>> @Milton, can you give a hand to Steffen?
>>>
>>> Alexandre
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>> On May 31, 2017, at 10:32 AM, Steffen Märcker  wrote:
>>>
>>> Thanks for the encouraging response! First question: Which is the
>>> recommended (friction free) way to exchange code between VW and Pharo?
>>>
>>> Cheers!
>>> Steffen
>>>
>>> Am .05.2017, 16:22 Uhr, schrieb Alexandre Bergel <
>>> alexandre.ber...@me.com
>>> >:
>>>
>>> I second Sven. This is very exciting!
>>>
>>> Let us know when you have something ready to be tested.
>>>
>>> Alexandre
>>>
>>>
>>>
>>>
>>>


Re: [Pharo-users] MiniScheme in Pharo

2018-03-18 Thread Clément Bera
p.3
simpliciyty -> simplicity

p.4
we will have the define their semantics.
-> to define ? I am not sure I understand the sentence

p.10
and may converted on the fly
-> and maybe ? I am not sure I understand the sentence

At the beginning I started to read and understood nothing, then I read a 24
slides lecture on lisp lists [1], then I restarted to read and understood
One of my main problem was that what cdr does is explained p.7, while cdr
is used p.3 for the first time and multiple times before p.7. But maybe you
expect the reader to know scheme already.

[1] https://perso.liris.cnrs.fr/nathalie.guin/LIF3/Cours/Cours3-Listes.pdf
  (first result on google for me)

On Sat, Mar 17, 2018 at 7:36 PM, Stephane Ducasse 
wrote:

> Hi
>
> I finally decided to release the booklet I wrote about implementing a
> minischeme in Pharo.
> I did not announce it yet because I would like to get feedback and fix
> what can be fixed.
>
>
> https://files.pharo.org/books-pdfs/booklet-AMiniSchemeInPharo/2018-03-17-
> MiniScheme.pdf
>
> Stef
>
>


-- 
Clément Béra
https://clementbera.github.io/
https://clementbera.wordpress.com/


Re: [Pharo-users] Please rejoin Discord

2018-03-10 Thread Clément Bera
I think the roles got changed I am no longer admin (Note that it does not
really matter since I did not do much admin work but still)

On Sat, Mar 10, 2018 at 11:48 AM, Dimitris Chloupis 
wrote:

> Hey guys after my mistake we got "hacked" and someone banned all our
> members in Discord
>
> I have revoked all the bans but you will have to rejoin . Existing join
> links are still valid , if you dont have one here is one
>
> https://discord.gg/gtKeHne
>
> My apologies for this inconvenience, I am still exploring all possible
> threats to make sure this never happens again.
>



-- 
Clément Béra
Pharo consortium engineer
https://clementbera.github.io/
https://clementbera.wordpress.com/
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq


Re: [Pharo-users] canonical way to convert Symbol into Class (retrieve class by its name)

2018-02-10 Thread Clément Bera
On Sat, Feb 10, 2018 at 4:34 PM, Hernán Morales Durand <
hernan.mora...@gmail.com> wrote:

> Hi Clément,
>
> First time I read about modules in Pharo.
> What is a module exactly?

What's the problem to solve?
>

It's similar to namespaces with some different, arguably better, features.

Honestly I am not the expert on it so I would like some one else to answer.

Among other things, it solves the problem of having 2 classes with the same
name (avoiding the prefixes we have like in C). But reportedly that's just
a side-effect and not the main problem to solve.


> Cheers,
>
> Hernán
>
> 2018-02-10 9:47 GMT-03:00 Clément Bera :
> > Hi,
> >
> > In short, everything that is not namespace/module compatible will be
> > deprecated/changed/removed in the future, so it is not recommended to use
> > it.
> >
> > a.2) #Array asClassInEnvironment: Smalltalk globals
> > b.1) Smalltalk globals at: #Array
> > => Ok-ish, note that you may need to change 'Smalltalk globals' the
> > namespace/module when support for those will be added since Array will
> be in
> > a module.
> > Maybe you want instead to use instead:
> >
> > c) self class environment at: #Array
> > => this will work in the future if your code is a class which
> > environment/namespace/module includes the Array class you would expect
> >
> > a.1) #Array asClass
> > b.2) Smalltalk at: #Array
> > b.3) Smalltalk classNamed: #Array
> > => In which namespace/module are you looking for #Array ? In the future
> this
> > may be removed, alternatively it will work only for globals but not
> globals
> > inside namespace/module which won't work since Array will be in a module.
> >
> >
> > On Sat, Feb 10, 2018 at 12:57 PM, Peter Uhnák  wrote:
> >>
> >> Hi,
> >>
> >> what is the canonical way to get a class from a symbol?
> >>
> >> a) Converting symbol into class via string protocol
> >>
> >> a.1) #Array asClass
> >> I use this the most, because it is easy, uses unary selector, and so far
> >> I've never ran into any issues. But apparently it is not good -- why?
> >>
> >> a.2) #Array asClassInEnvironment: Smalltalk globals
> >>
> >> b) Retriving the class by key from the system dictionary
> >>
> >> b.1) Smalltalk globals at: #Array
> >>
> >> b.2) Smalltalk at: #Array
> >>
> >> b.3) Smalltalk classNamed: #Array
> >>
> >> c) something else entirely?
> >>
> >> I get that using #asClass wouldn't work if there was a different
> >> environment, however I don't even know in what situation there could be
> a
> >> different environment, so I cannot assert how problematic it is or
> isn't.
> >>
> >> Thanks,
> >> Peter
> >
> >
> >
> >
> > --
> > Clément Béra
> > Pharo consortium engineer
> > https://clementbera.wordpress.com/
> > Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq
>
>


-- 
Clément Béra
Pharo consortium engineer
https://clementbera.wordpress.com/
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq


Re: [Pharo-users] canonical way to convert Symbol into Class (retrieve class by its name)

2018-02-10 Thread Clément Bera
Modules can import other modules to be able to use their classes directly.

Anyway, this is theory, there is no module implementation currently.

But the idea in the recent versions of Pharo (5-6-7) was to start moving
away from things like (Smalltalk at: #className) or (#className asClass)
since it does not work with the module system that is going to be
introduced.


On Sat, Feb 10, 2018 at 3:33 PM, Peter Uhnák  wrote:

> > c) self class environment at: #Array
> > => this will work in the future if your code is a class which
> environment/namespace/module includes the Array class you would expect
>
> Let's say that namespaces are added; Array is now in the module
> Collections.Array
> My code is now in module MyProject.MyWhatever
>
> I would imagine that in such situation I would need to change the code
> anyway, because it would try to look up MyProject.Array, no?
>
> So if the argument for asClass is based on future addition of modules,
> then I will need to manually change it anyway regardless of what approach I
> used, because I don't know in which namespace the class will end up.
>
> Am I missing something?
>
> Thanks,
> Peter
>
>
> On Sat, Feb 10, 2018 at 1:47 PM, Clément Bera 
> wrote:
>
>> Hi,
>>
>> In short, everything that is not namespace/module compatible will be
>> deprecated/changed/removed in the future, so it is not recommended to use
>> it.
>>
>> a.2) #Array asClassInEnvironment: Smalltalk globals
>> b.1) Smalltalk globals at: #Array
>> => Ok-ish, note that you may need to change 'Smalltalk globals' the
>> namespace/module when support for those will be added since Array will be
>> in a module.
>> Maybe you want instead to use instead:
>>
>> c) self class environment at: #Array
>> => this will work in the future if your code is a class which
>> environment/namespace/module includes the Array class you would expect
>>
>> a.1) #Array asClass
>> b.2) Smalltalk at: #Array
>> b.3) Smalltalk classNamed: #Array
>> => In which namespace/module are you looking for #Array ? In the future
>> this may be removed, alternatively it will work only for globals but not
>> globals inside namespace/module which won't work since Array will be in a
>> module.
>>
>>
>> On Sat, Feb 10, 2018 at 12:57 PM, Peter Uhnák  wrote:
>>
>>> Hi,
>>>
>>> what is the canonical way to get a class from a symbol?
>>>
>>> a) Converting symbol into class via string protocol
>>>
>>> a.1) #Array asClass
>>> I use this the most, because it is easy, uses unary selector, and so far
>>> I've never ran into any issues. But apparently it is not good -- why?
>>>
>>> a.2) #Array asClassInEnvironment: Smalltalk globals
>>>
>>> b) Retriving the class by key from the system dictionary
>>>
>>> b.1) Smalltalk globals at: #Array
>>>
>>> b.2) Smalltalk at: #Array
>>>
>>> b.3) Smalltalk classNamed: #Array
>>>
>>> c) something else entirely?
>>>
>>> I get that using #asClass wouldn't work if there was a different
>>> environment, however I don't even know in what situation there could be a
>>> different environment, so I cannot assert how problematic it is or isn't.
>>>
>>> Thanks,
>>> Peter
>>>
>>
>>
>>
>> --
>> Clément Béra
>> Pharo consortium engineer
>> https://clementbera.wordpress.com/
>> Bâtiment B 40, avenue Halley 59650
>> <https://maps.google.com/?q=40,+avenue+Halley+59650%C2%A0Villeneuve+d'Ascq&entry=gmail&source=g>Villeneuve
>> d
>> <https://maps.google.com/?q=40,+avenue+Halley+59650%C2%A0Villeneuve+d'Ascq&entry=gmail&source=g>
>> 'Ascq
>> <https://maps.google.com/?q=40,+avenue+Halley+59650%C2%A0Villeneuve+d'Ascq&entry=gmail&source=g>
>>
>
>


-- 
Clément Béra
Pharo consortium engineer
https://clementbera.wordpress.com/
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq


Re: [Pharo-users] canonical way to convert Symbol into Class (retrieve class by its name)

2018-02-10 Thread Clément Bera
Hi,

In short, everything that is not namespace/module compatible will be
deprecated/changed/removed in the future, so it is not recommended to use
it.

a.2) #Array asClassInEnvironment: Smalltalk globals
b.1) Smalltalk globals at: #Array
=> Ok-ish, note that you may need to change 'Smalltalk globals' the
namespace/module when support for those will be added since Array will be
in a module.
Maybe you want instead to use instead:

c) self class environment at: #Array
=> this will work in the future if your code is a class which
environment/namespace/module includes the Array class you would expect

a.1) #Array asClass
b.2) Smalltalk at: #Array
b.3) Smalltalk classNamed: #Array
=> In which namespace/module are you looking for #Array ? In the future
this may be removed, alternatively it will work only for globals but not
globals inside namespace/module which won't work since Array will be in a
module.


On Sat, Feb 10, 2018 at 12:57 PM, Peter Uhnák  wrote:

> Hi,
>
> what is the canonical way to get a class from a symbol?
>
> a) Converting symbol into class via string protocol
>
> a.1) #Array asClass
> I use this the most, because it is easy, uses unary selector, and so far
> I've never ran into any issues. But apparently it is not good -- why?
>
> a.2) #Array asClassInEnvironment: Smalltalk globals
>
> b) Retriving the class by key from the system dictionary
>
> b.1) Smalltalk globals at: #Array
>
> b.2) Smalltalk at: #Array
>
> b.3) Smalltalk classNamed: #Array
>
> c) something else entirely?
>
> I get that using #asClass wouldn't work if there was a different
> environment, however I don't even know in what situation there could be a
> different environment, so I cannot assert how problematic it is or isn't.
>
> Thanks,
> Peter
>



-- 
Clément Béra
Pharo consortium engineer
https://clementbera.wordpress.com/
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq


[Pharo-users] Problem with Traditional and Simplified Chinese parsing in Pharo

2018-01-29 Thread Clément Bera
Hi,

I am currently parsing lua and JSON-like file in Pharo. They contain both
Simplified and Traditional Chinese characters for comments and for strings
displayed in the UI. Lua files are parsed correctly. However the JSON-like
files aren't.

In attachment I put one of the problematic file with Simplified chinese
characters (I've also copied the file at the end of the mail). The problem
can be shown as follow in Pharo:

'schinese.txt' asFileReference readStream contents

The contents function sends a UTF8InvalidText 'Invalid utf8 input detected'
error.
However my text editor correctly displays the file and it is correctly
parsed by the Lua runtime (The program parsed has been deployed in
production for years and works fine).

What can I do to parse this file correctly from Pharo ?

Thanks,

Below is the file content, non Chinese people may not have the font to
display the characters, note that I have no idea what is written in Chinese
(Please don't hold me responsible if there are offending contents):

"lang"
{
"Language" "Schinese"
"Tokens"
{
"text_store_cd" "贝壳商店的商品会每天随机刷新! 下次刷新冷却时间"
"text_cannot_huidaoguoqu" "现在不能使用回到过去~"
"tips1" "利用鼠标滚轮可以调节视角距离,方便你查看场地全貌~"
"tips2" "通过全部50关以后你还可以继续挑战更加有难度的无尽试炼模式!"
"tips3" "每天早晨贝壳商店会随机刷新和随机打折,留心你想要的商品!"
"tips4" "排行榜的前25名可以获得皇冠奖章,象征着你在塔防游戏中的卓越成绩!"
"tips5" "每10波敌人会有一个BOSS关卡,它比普通敌人更难击杀~"
"tips6" "飞行的敌人不会被石头阻挡,所以不能利用迷宫来增长怪物的线路~"
"tips7" "开局的时候点击左下方的英雄选择图标可以查看并选择你拥有的英雄!"
"tips8" "隐身的敌人必须通过蛋白系列塔的照明光环才能被发现!"
"tips9" "点击右侧的合成公式按钮可以打开合成面板,了解高级塔的合成以及当前配件状态~"
"tips10" "邀请好友一起游戏,可以互相协作共同对抗强大的敌人!"
"tips11" "石板会对踩上去的敌人产生效果,所以最好放置在敌人必经的路线上~"
"tips12" "为英雄购买美丽的特效,当你可以一回合合成的时候所有配件都会有特效提示!"
"tips13" "每回合伤害最高的塔将会获得最多10层的MVP光环,增加物理和魔法输出!"
"tips14" "每个月的最后一天是赛季结算日,将会根据你这赛季的排名颁发丰厚的贝壳奖励!"
"tips15" "如果不知道怎样造迷宫,你可以点击右侧的迷宫指南按钮查看或者分享推荐的迷宫~"
}
}



-- 
Clément Béra
Pharo consortium engineer
https://clementbera.wordpress.com/
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq
"lang"
{
"Language"  "Schinese"
"Tokens"
{
"text_store_cd" "贝壳商店的商品会每天随机刷新! 下次刷新冷却时间"
"text_cannot_huidaoguoqu"   "现在不能使用回到过去~"
"tips1" "利用鼠标滚轮可以调节视角距离,方便你查看场地全貌~"
"tips2" "通过全部50关以后你还可以继续挑战更加有难度的无尽试炼模式!"
"tips3" "每天早晨贝壳商店会随机刷新和随机打折,留心你想要的商品!"
"tips4" "排行榜的前25名可以获得皇冠奖章,象征着你在塔防游戏中的卓越成绩!"
"tips5" "每10波敌人会有一个BOSS关卡,它比普通敌人更难击杀~"
"tips6" "飞行的敌人不会被石头阻挡,所以不能利用迷宫来增长怪物的线路~"
"tips7" "开局的时候点击左下方的英雄选择图标可以查看并选择你拥有的英雄!"
"tips8" "隐身的敌人必须通过蛋白系列塔的照明光环才能被发现!"
"tips9" "点击右侧的合成公式按钮可以打开合成面板,了解高级塔的合成以及当前配件状态~"
"tips10""邀请好友一起游戏,可以互相协作共同对抗强大的敌人!"
"tips11""石板会对踩上去的敌人产生效果,所以最好放置在敌人必经的路线上~"
"tips12""为英雄购买美丽的特效,当你可以一回合合成的时候所有配件都会有特效提示!"
"tips13""每回合伤害最高的塔将会获得最多10层的MVP光环,增加物理和魔法输出!"
"tips14""每个月的最后一天是赛季结算日,将会根据你这赛季的排名颁发丰厚的贝壳奖励!"
"tips15""如果不知道怎样造迷宫,你可以点击右侧的迷宫指南按钮查看或者分享推荐的迷宫~"
}
}


Re: [Pharo-users] looking for another iterator :)

2018-01-21 Thread Clément Bera
I don't think we do. Do you need it on SequenceableCollection or
HashedCollection too ?

Recently I was trying to iterate over the first N elements of a collection
and since there was no #first:do: I used #from:to:do:. I guess you could
use that too:

aCollection from: 1 to: (aCollection size min: 1000) do: aBlock

Which guarantees you iterate at max over 1000 elements. But that API is
SequenceableCollection specific.

On Sun, Jan 21, 2018 at 11:44 AM, Ben Coman  wrote:

> On 21 January 2018 at 18:36, Stephane Ducasse 
> wrote:
> > Hi
> >
> > I would like to iterate at max on a certain amount of elements in a
> collection.
> > And I was wondering if we have such iterator.
>
> I'm not clear what functionality your asking for.  Could you present
> it as code & result if you assumed the iterator you want was
> available?
>
> cheers -ben
>
>


-- 
Clément Béra
Pharo consortium engineer
https://clementbera.wordpress.com/
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq


Re: [Pharo-users] How to write a little REPL

2017-11-28 Thread Clément Bera
 There is a REPL Image we use for VM debugging. It's a REPL in the command
line and in the VM Simulator.

File-in in attachement to load and start the REPL.

On Tue, Nov 28, 2017 at 8:18 AM, Stephane Ducasse 
wrote:

> Sorry I wanted to have it in pharo :)
>
> On Mon, Nov 27, 2017 at 3:56 AM, Holger Freyther 
> wrote:
> >
> >> On 27. Nov 2017, at 05:38, Stephane Ducasse 
> wrote:
> >>
> >> Hi
> >
> > Hey!
> >
> >
> >> I'm working on a mini scheme implementation and I would like to add a
> REPL and
> >> I wonder how I can super easily get a read line.
> >
> > The easiest might just be to use "rlwrap your-interpreter"? But I think
> you want to allow multi-line input. So either link libreadline (GPL) or
> libedit?
> >
> > holger
>
>


-- 
Clément Béra
Pharo consortium engineer
https://clementbera.wordpress.com/
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq


StartReader.st
Description: Binary data


LoadReader.st
Description: Binary data


Re: [Pharo-users] Can we halt on memory growth beyond a limit?

2017-10-24 Thread Clément Bera
Hi,

You can start the VM with this parameter:

 --memory [mk]use fixed heap size (added to image size)

When the memory is reached you have an out of memory error.

Check --help on the VM.


On Tue, Oct 24, 2017 at 10:15 PM, PAUL DEBRUICKER 
wrote:

> I'm trying to get some understanding about a process that uses a lot of
> RAM when it runs.
>
>
> Is there a way to halt if/when RAM use doubles ?
>
>
> Thanks
>
> Paul
>



-- 
Clément Béra
Pharo consortium engineer
https://clementbera.wordpress.com/
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq


Re: [Pharo-users] Pharo and instance variables ...

2017-10-17 Thread Clément Bera
On Wed, Oct 18, 2017 at 7:07 AM, James Ladd  wrote:

> Hey David,
>
> If you could only access instance variables in the class that defined them
> and therefore only in a subclass via an accessor / mutator method w that be
> a big problem in your view?
>

Yes.

I don't want to have to define accessors, which are public, just to have
the subclasses access the instance variables.


>
> Sent from my Commodore 64
>
> On 18 Oct 2017, at 2:41 pm, David Mason  wrote:
>
> In Pharo, open a browser on OrderedCollection, then click "Variables" in
> the top left of the window and then "array"... if you scroll through you
> can see that mostly OrderedCollection methods use it, but some
> SortedCollection (a subclass) methods also use it.
>
> The model is similar to protected in Java (see http://docs.oracle.com/
> javase/tutorial/java/javaOO/accesscontrol.html ) except there is no
> "Package" column.
>
> On 17 October 2017 at 23:30, James Ladd  wrote:
>
>> Please could you provide an example?
>>
>>
>>
>> On Wed, Oct 18, 2017 at 2:16 PM, David Mason  wrote:
>>
>>> Any instance method in the class where the instance variable is defined
>>> or in a subclass can access the instance variable.  Similarly for class
>>> methods to access class-side variables, and for class and instance methods
>>> to access class variables.
>>>
>>> On 17 October 2017 at 23:04, James Ladd  wrote:
>>>
 Hello Pharo Users,

 I'm wondering about instance variables for support in Redline Smalltalk
 and
 want to get my understanding straight.

 Are instance variables only accessible (without using #instVarNamed:)
 inside
 the method with the same name as the instance variable?

 eg:

myInstVar
^ myInstVar.

 Or can you reference an instance variable from a method that doesn't
 have
 the same name ?

anotherMethod
^ myInstVar.

 Can someone give me or point me to an example of accessing an instance
 variable in Pharo Smalltalk?

 - James.




 --
 Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html


>>>
>>
>


-- 
Clément Béra
Pharo consortium engineer
https://clementbera.wordpress.com/
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq


Re: [Pharo-users] Music beat detection and 60FPS graphics on Pharo?

2017-10-14 Thread Clément Bera
Hi Phil,

I did that using Ronie's OpenAL binding and Merwann's wav parser back in
2014-2015:

MCSmalltalkhubRepository
owner: 'ronsaldo'
project: 'OpenAL'

MCSmalltalkhubRepository
owner: 'MerwanOuddane'
project: 'WAVParser'

I did things such as (build yourself something derived from this code I did
not check if it works):

MyClass>>example
WAVParser wavFromStream: ('resources/music/spellNoise.wav' asFileReference
readStream binary readStream).
contextAttributes := ALContextAttributes new.
device := OpenALC openDefaultDevice.
context := device createContext: contextAttributes asList.
context process.
context currentDuring: [
"Create the buffer"
buffer := self makeBufferFromHeader: wav header data: wav data asByteArray.
"Create the source"
source := OpenAL genSource.
OpenAL sourcei: source param: AL_BUFFER value: buffer.
"Play the source"
OpenAL sourcePlay: source.
"Play for sometime "
(Delay forSeconds: wav header soundDuration) wait.
"Delete the source and the buffer"
OpenAL deleteSource: source;
deleteBuffer: buffer
].
OpenALC nullCurrentContext.
context destroy.
device close.

MyClass>>makeBufferFromHeader: header data: data
| buffer |
buffer := OpenAL genBuffer.
OpenAL bufferData: buffer format: (self readFormatFromHeader: header) data:
data size: data size freq: header sampleRate.
^ buffer

MyClass>>readFormatFromHeader: header
^ header channels = 1
ifTrue: [
header bitsPerSample = 8
ifTrue: [ AL_FORMAT_MONO8 ]
ifFalse: [ AL_FORMAT_MONO16 ] ]
ifFalse: [
header bitsPerSample = 8
ifTrue: [ AL_FORMAT_STEREO8 ]
ifFalse: [ AL_FORMAT_STEREO16 ] ]

I am pretty sure with a little work those things could work again. I have
never succeeded in playing mp3 files from Pharo though (but I'm on mac and
I remembered trying solutions that did not work on Mac but may work on
other OS).

Have fun guys :-)

On Sat, Oct 14, 2017 at 10:01 AM, p...@highoctane.be 
wrote:

> I'd like to do something like this: https://www.youtube.com/
> watch?v=vL7D4eU0lYE
>
> to showcase FFI, Bloc, and the Pharo liveliness.
>
> And once I get the basics working, level up in getting it working in a VR
> headset.
>
> Is there anyone having a binding to a library for dealing with the sound
> part, like FMod or other things like that?
>
> I see this as a medium term project, so, like I can get it working by the
> end of the year.
>
> TIA
>
> Phil
>



-- 
Clément Béra
Pharo consortium engineer
https://clementbera.wordpress.com/
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq


Re: [Pharo-users] Force headless mode

2017-09-26 Thread Clément Bera
Or write a script that obfuscate the code. Not so hard to do.

On Tue, Sep 26, 2017 at 5:13 PM, Christophe Demarey <
christophe.dema...@inria.fr> wrote:

> Hi
>
> What about deploying a minimal image without  UI ?
> But, as you probably know, headless mode does not prevent to dump the code.
>
> Christophe
> - Cyril Ferlicot  a écrit :
> > Hi,
> >
> > At Synectique we are working on the deployment of a web application
> > and we would like to force the headless mode. We tried to just
> > override the method SmalltalkImage>>#isHeadless to return true all the
> > time be it is not enough because the image is still opened. It is
> > probabaly the vm that open the window.
> >
> > I know we can add some arguments to the command line to open the image
> > as headless but we want to forbid the user to launch the image without
> > headless to protect the code.
> >
> > Is this possible? Do you have some pointers?
> >
> > Thanks in advance.
> >
> > --
> > Cyril Ferlicot
> > https://ferlicot.fr
> >
> > http://www.synectique.eu
> > 2 rue Jacques Prévert 01,
> > 59650 Villeneuve d'ascq France
> >
>
>
>


Re: [Pharo-users] X11 options on Ubuntu VM / Athens rendering problems

2017-09-24 Thread Clément Bera
On Mon, Sep 25, 2017 at 2:33 AM, J.F. Rick  wrote:

> Hi Clement and and Stef,
>
> thanks for sharing. The video looks cool and it seems like a
> high-performance approach. Unfortunately, it doesn't seem to be working in
> Linux. I'm attaching the Pharo debug file, but it seems like the Handler
> being OSNullWindowHandle indicates a problem. I'm also not sure that this
> approach would allow me to do fullscreen apps. I noticed that your video
> shows a title bar in MacOS.
>
>
I've never made the demo work on linux, I am not surprised it doesn't work.
This demo is based on the Pharo 4 OSWindow version, and more recent
versions are working fine on linux.

About fullscreen as I said in the previous mail it is possible to enable
it, I tried it worked, but I did not do it as I don't think it make sense
with this game.

I will consider in the future making it work on the latest Pharo version on
multiple OS if it makes sense to show people how to do it. I'm busy with
other concerns right now.

Anyway, it's just one approach, you can use another one.


> Cheers,
>
> Jeff
>
>
>
>
>
> On Sun, Sep 24, 2017 at 7:53 AM Clément Bera 
> wrote:
>
>> Hi,
>>
>> I describe in the next paragraphs what I do to build application with
>> Pharo at 50 fps. Now I am using a SDL2 window with OSWindow and not the
>> default Pharo window for rendering. There is a fullscreen option with
>> OSWindow, I don't use it but I've just tried it works fine.
>>
>> To use Athens/Cairo I start the VM headless and I open from the code a
>> window using the SDL2 binding (OSWindow), then I extract the window surface
>> as a cairo surface to draw on it using Athens and I use SDL2 to manage
>> events (mouse, keyboard). That way I don't even start morphic/WorldMorph
>> which wastes cpu ressources.
>>
>> I built this video game that way:
>> https://clementbera.wordpress.com/2016/08/29/sdl2-cairo-
>> headless-for-realtime-native-applications/
>> https://www.youtube.com/watch?v=srPdFgbyS6s
>>
>> The game is running in Pharo 4 (pre-Spur). I configured it to run at 50
>> fps but from time to time some frames are dropped for performance so I
>> would say it is running at around 48-49 fps in practice. I think it should
>> work on the latest Pharo but you need to ask on pharo-dev how to use
>> OSWindow. Some APIs have changed since Pharo 4. Since the latest Pharo
>> version is now using Spur I expect the performance to be way better and I
>> think 50 fps is definitely manageable on a laptop.
>>
>> Note that this is still Pharo so if you want something which looks
>> real-time you need to be careful about you object allocation rate
>> in-between frame rendering.
>>
>> I hope this can help.
>>
>> Regards
>>
>>
>>
>> On Sun, Sep 24, 2017 at 9:43 AM, Stephane Ducasse <
>> stepharo.s...@gmail.com> wrote:
>>
>>> Hi jeff
>>>
>>> let us know if this is working. the start.sh script is not working on
>>> my machine. but clement made it worked on his machine and he should
>>> publish a zip.
>>>
>>> Stef
>>>
>>>
>>>
>>> On Sun, Sep 24, 2017 at 9:39 AM, Stephane Ducasse
>>>  wrote:
>>> > Yes I will share a dropbox with you for now.
>>> >
>>> > On Sat, Sep 23, 2017 at 9:44 PM, J.F. Rick  wrote:
>>> >> Hi Stef,
>>> >>
>>> >> since I'm only doing Athens rendering, it might be possible to do a
>>> native
>>> >> window implementation. That said, I don't know how to get started
>>> with that.
>>> >> Documentation seems to be hard to find. The last time I saw any work
>>> on that
>>> >> it was too early to be usable. I'm also not sure if it solves my "it
>>> needs
>>> >> to run in fullscreen at full speed" problem. If someone like Clement
>>> could
>>> >> get me started, that would be awesome.
>>> >>
>>> >> Cheers,
>>> >>
>>> >> Jeff
>>> >>
>>> >> On Fri, Sep 22, 2017 at 12:27 PM Stephane Ducasse <
>>> stepharo.s...@gmail.com>
>>> >> wrote:
>>> >>>
>>> >>> Hi Jeff
>>> >>>
>>> >>> Nice to see you. I do not know anybody running on X11. Esteban is
>>> >>> working on better SDL20 integration.
>>> >>> Did you try having a native window? I asked clement if he could
>>> >

Re: [Pharo-users] X11 options on Ubuntu VM / Athens rendering problems

2017-09-24 Thread Clément Bera
Hi,

I describe in the next paragraphs what I do to build application with Pharo
at 50 fps. Now I am using a SDL2 window with OSWindow and not the default
Pharo window for rendering. There is a fullscreen option with OSWindow, I
don't use it but I've just tried it works fine.

To use Athens/Cairo I start the VM headless and I open from the code a
window using the SDL2 binding (OSWindow), then I extract the window surface
as a cairo surface to draw on it using Athens and I use SDL2 to manage
events (mouse, keyboard). That way I don't even start morphic/WorldMorph
which wastes cpu ressources.

I built this video game that way:
https://clementbera.wordpress.com/2016/08/29/sdl2-cairo-headless-for-realtime-native-applications/
https://www.youtube.com/watch?v=srPdFgbyS6s

The game is running in Pharo 4 (pre-Spur). I configured it to run at 50 fps
but from time to time some frames are dropped for performance so I would
say it is running at around 48-49 fps in practice. I think it should work
on the latest Pharo but you need to ask on pharo-dev how to use OSWindow.
Some APIs have changed since Pharo 4. Since the latest Pharo version is now
using Spur I expect the performance to be way better and I think 50 fps is
definitely manageable on a laptop.

Note that this is still Pharo so if you want something which looks
real-time you need to be careful about you object allocation rate
in-between frame rendering.

I hope this can help.

Regards



On Sun, Sep 24, 2017 at 9:43 AM, Stephane Ducasse 
wrote:

> Hi jeff
>
> let us know if this is working. the start.sh script is not working on
> my machine. but clement made it worked on his machine and he should
> publish a zip.
>
> Stef
>
>
>
> On Sun, Sep 24, 2017 at 9:39 AM, Stephane Ducasse
>  wrote:
> > Yes I will share a dropbox with you for now.
> >
> > On Sat, Sep 23, 2017 at 9:44 PM, J.F. Rick  wrote:
> >> Hi Stef,
> >>
> >> since I'm only doing Athens rendering, it might be possible to do a
> native
> >> window implementation. That said, I don't know how to get started with
> that.
> >> Documentation seems to be hard to find. The last time I saw any work on
> that
> >> it was too early to be usable. I'm also not sure if it solves my "it
> needs
> >> to run in fullscreen at full speed" problem. If someone like Clement
> could
> >> get me started, that would be awesome.
> >>
> >> Cheers,
> >>
> >> Jeff
> >>
> >> On Fri, Sep 22, 2017 at 12:27 PM Stephane Ducasse <
> stepharo.s...@gmail.com>
> >> wrote:
> >>>
> >>> Hi Jeff
> >>>
> >>> Nice to see you. I do not know anybody running on X11. Esteban is
> >>> working on better SDL20 integration.
> >>> Did you try having a native window? I asked clement if he could
> >>> release the Wizard Battle Arena because it was a game he did in a
> >>> couple of days (yes he is good this guy) and that use cairo athens
> >>> based for drawing on native window.
> >>>
> >>> stef
> >>>
> >>> On Fri, Sep 22, 2017 at 3:11 PM, J.F. Rick  wrote:
> >>> > I'm running a fullscreen Pharo application on Ubuntu and I've noticed
> >>> > that
> >>> > Athens rendering gets way worse (maybe 10 updates per second) when I
> >>> > switch
> >>> > to fullscreen mode from inside Pharo. Ideally, I'd love for that to
> be
> >>> > fixed.
> >>> >
> >>> > In lieu of that, it would be cool if I could just maximize Pharo to
> the
> >>> > size
> >>> > of the screen to achieve good performance. Two things stop that: the
> >>> > Unity
> >>> > application bar and the title-bar. For the former, I can configure
> Unity
> >>> > to
> >>> > hide it. I noticed a '-notitle' X11 option when I execute pharo
> -help.
> >>> > I've
> >>> > tried using these X11 options and neither -notitle or -fullscreen
> seem
> >>> > to
> >>> > have any effect. Here's the command I run:
> >>> >
> >>> > ./bin/pharo --encoding utf8 -vm-display-X11 -fullscreen
> PATH_TO_IMAGE &
> >>> >
> >>> > Pharo starts fine but neither option seems to have any effect. I've
> also
> >>> > tried this in GNOME, thinking that Unity was the problem. Again, no
> >>> > effect.
> >>> >
> >>> > Any suggestions?
> >>> >
> >>> > Jeff
> >>> >
> >>> >
> >>>
> >>
>
>


Re: [Pharo-users] CodeImporter. 256 literals limit

2017-08-29 Thread Clément Bera
Hi,

If your tool works in Pharo 6, you can use the other bytecode set which
supports up to 32k literals. To do so, go to:
World Menu > Settings > Compiler > Encoder
and pick SistaV1 instead of V3PlusClosures
Try to load your code. The default Pharo 6 VM supports both bytecode sets.

Alternatively you need to split your methods with many literals in multiple
methods with less literals, which is usually quite tricky to do right.

On Tue, Aug 29, 2017 at 4:52 AM, Andreas Sunardi 
wrote:

> I have written a tool (Pharo5) where user gives an input file to it, where
> the content is a smalltalk code, a DSL. I used a subclass of CodeImporter
> class to evaluate this input file.
>
> Recently my user used an input file where it hit the 256 literal limit
> (total of unique string, number, method name, etc), down in
> OpalEncoderForV3PlusClosures >> genPushLiteral:. The number seems to be
> hard coded and related to byte code generator, not something I can simply
> increase. I wasn't aware of this limitation.
>
> Before I overhaul my tool, I thought I should ask. Is there another
> alternative to evaluate a smalltalk file/script? The file is small, 27k,
> but the number of unique literals in it is > 256. Is it possible at all,
> seeing that the limit is related to byte code generator.
>
> Thank you in advance
> --
> Andreas Sunardi
>


Re: [Pharo-users] Pharo 6 / VM crashes

2017-04-30 Thread Clément Bera
Hi,

About the best way to help...

A reproducible case that we (VM developers) can reproduce easily is the
best way to help. If we do not have a way to reproduce your bug, we cannot
do anything about it. The best is an image which crashes immediately after
start-up or a do-it that reliably crash the system, combined with all the
version numbers (OS version, vm version, pharo version) or a crash dump
file which includes all those version numbers.

Trying another version of Pharo (like 5 instead of 6 like you did) and the
latest VM over the stable is another thing you can do. If you can prove
that the bug comes from recent images or recent VMs it helps us as we know
where to look (in the VM or in the image).

As Oleks said the bug you mentioned should be fixed in the latest VM. The
latest VM will be promoted to stable in the incoming weeks for the Pharo 6
release. Sorry for the inconvenience.

Best,


On Sun, Apr 30, 2017 at 1:10 PM, Oleks  wrote:

> Hello,
>
> The same happened to me about a week ago. Apparently, the latest 'stable'
> (Feb 22) version of VR has some compactor bug which makes it crash.
>
> Try this:
> curl get.pharo.org/60+vmLatest | bash
> It should download the latest (Apr 18) VM, which works just fine.
>
> Oleks
>
>
>
> --
> View this message in context: http://forum.world.st/Pharo-6-
> VM-crashes-tp4944939p4944946.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] Need help opening image

2017-03-12 Thread Clément Bera
Hi,

You need a VM with the SqueakV3 memory manager and compiled in the past few
months for Mac OS X Sierra support.

All recent Pharo VM are compiled with the Spur memory manager leading to
this error “This interpreter (vers. X) cannot read image file (vers. 6505)”.

I would try the latest VM from this repository (latest.zip):
http://files.pharo.org/vm/pharo/mac/

If you get the second error ( [NSPathStore2 stringByAppendingPathExtension:]:
cannot append extension 'bundle/Contents/MacOS/' to … ), it means the VM is
too old and does not support Mac OS X Sierra.

In this case, try instead the VM named:
cog_macos32x86_squeak.cog.v3_201703051406.tar.gz
present at:
https://bintray.com/opensmalltalk/vm/cog/201703051406#files

It should work but it is not a Pharo VM hence some features may be disabled
(specific VM plugins, etc.). Depending on your use-case it may be enough or
not.

Best,


On Sun, Mar 12, 2017 at 4:57 PM, David Shaffer  wrote:

> I have an image (from Pharo3.0) which reports version 6505.  I have tried
> four OSX vms but none of them will open it.  Either I get “This interpreter
> (vers. X) cannot read image file (vers. 6505)” or I get hit with a long
> stream of:
>
> [NSPathStore2 stringByAppendingPathExtension:]: cannot append extension
> 'bundle/Contents/MacOS/' to …
>
> which I know is a known bug.  The problem is, I can’t find a VM that
> doesn’t have this bug but can open my old image format (on OSX).  Any
> pointers would be appreciated.
>
> Thanks!
>
> David
>
>
>


Re: [Pharo-users] why is concat of Symbols a string?

2017-03-04 Thread Clément Bera
Hi,

All symbols are interned in the Symbol table. If one does (#foo , #bar ,
#baz) and each returned value would be a symbol, then both #foobar and
#foobarbaz would be registered in the symbol table.

I would guess that's why the concatenated value is a string and not a
symbol, to avoid registering many unused symbols. But maybe I am wrong.

If for your use case you need to concatenate symbols and get a symbol out
of it, you can define a new method in Symbol to do what you want.

For example:

Symbol >> ,, arg
^ (self , arg) asSymbol

Then

#foo ,, #bar

Answers directly the symbol #foobar.

Best,




On Sat, Mar 4, 2017 at 11:36 AM, Peter Uhnak  wrote:

> Hi,
>
> why is the concatenation of symbols a string?
>
> e.g. #desc, #Name -> 'descName'
>
> this means that I have to always wrap in parentheses and recast, or stream
> it, e.g.
>
> (#desc, #Name) asSymbol -> #descName
> Symbol streamContents: [ :s | s << #desc; << #Name ] -> #descName
>
> both of which introduce extraneous syntactical clutter.
> The technical reason seems to be ByteSymbol>>#species returning
> ByteString, but I have no idea why it has to be this complicated.
>
> Thanks,
> Peter
>
>


Re: [Pharo-users] Pharo Spur 64 VM

2017-03-02 Thread Clément Bera
Hi Raffaello,

Reportedly, the VM without the JIT (pure interpreter, also called PharoS or
StackVM) works on windows 64 and FFI works with it if the VM compiled with
clang but not with gcc. There is no configuration for Pharo right now. It
should not be hard to add a pharo configuration to have the image start-up,
but I don't think several libraries such as Athens/Cairo or libgit would
work out of the box, so it's not clear such a configuration would make a
lot of sense. There is no PharoS-spur64 repository on files.pharo.org right
now either.

Windows support is not ready mostly because:
- Some C types are different in x64 between Unix and windows
- Calling conventions are different in x64 bits between Unix and Windows

Calling conventions have impact in switching between the interpreter and
the JIT runtime and in FFI.
C types being different have impact for the VM compilation and in FFI.

If someone looks into it, I guess in a day of work we could have the Stack
VM working with Spur 64 for Pharo without support for some librairies.
There might be uncommon crashes to fix over the first week of use. With
several more weeks of work (maybe a couple months), the StackVM with all
libraries should be production-ready. The JIT support will take more time,
hopefully it will be done in a year from now.

Maybe I should mention that the company who funded 64 bits support is using
the VM on Mac for development and Linux for production, so Windows was not
a priority and not done. We have to rely on open-source contributors, non
paid, to add Windows support and that takes time. Nicolas Cellier added the
support for the 64 bits Stack VM on his free time. If someone is investing
money, the 64 bits Windows VM could reach production sooner (I guess within
6 months) because someone could work full time on it.

Regards,


On Thu, Mar 2, 2017 at 4:04 PM,  wrote:

> On 07/02/17 07:13, Esteban Lorenzano wrote:
> >
> >> On 6 Feb 2017, at 21:41, Cyril Ferlicot D. 
> wrote:
> >>
> >> Le 06/02/2017 à 21:31, Benoit St-Jean via Pharo-users a écrit :
> >>
> >>
> >> Hi!
> >>
> >> IIRC, the windows VM will need some more time to be ready. Only Linux
> >> and OSX ones are usable at the moment.
> >
> > ^ this.
> > as Cyril says, win 64bits vm is still not ready (and it will take some
> more time to be).
> >
> > Esteban
> >
>
>
> Just for general curiosity, what are the main stumbling blocks in the
> road to a Windows 64 bit Pharo?
>
>
> Raffaello
>
>
>


Re: [Pharo-users] [Stupid Benchmarks] C++ vs Pharo

2016-12-17 Thread Clément Bera
If I am correct, when you do:
 double x=0;
  while(x<10)
{
x = x+1;
}
C++ compiles the + to double operation.

In Pharo, this code: |x| x := 0. 1 to: 10 do:[:each| x := x +1]
is using SmallInteger operations. The code you wrote is fully inlined in
Cog's JIT (no message sends).

Hence you're comparing double operation versus int operations. That's why
Pharo is faster.
Pharo should be a little bit slower than C++ if it would use int32 because
of the 4 Smallinteger checks it requires for the inlined <= and the 2
inlined +.

I am a bit surprised the C++ compiler does not entirely remove the loop as
it is side-effect free. Are you compiling in O2 ?

For *, firstly you're comparing this time double arithmetic vs double
arithmetic, where Pharo is slower due to boxing/unboxing, and secondly
Cogit does not inline the *, so there is a message send in the loop in
Pharo, leading to worse performance.

Are you benchmarking on Pharo 64 bits ? Because this kind of double
benchmarks should be way faster on the 64 bits VM than the 32 bits one.

Anyway, for benchmarking we normally use the bench suite here:
http://squeak.org/codespeed/ and micro-benchmarks are always questionable.

On Sat, Dec 17, 2016 at 1:41 PM, Dimitris Chloupis 
wrote:

> in multiplication pharo is around 2 times slower compared to C++
>
> #include 
>
> int main()
> {
>   double x=1;
>   for(double i; i<10 ; ++i)
> {
> x = 0.1*i;
> }
>
>   return 1;
>   }
>
> time ./testMul
> 3.13 real 3.13 user 0.00 sys
>
> time ./pharo Ephestos.image eval "|x| x := 1. 1 to: 10 do:[:each|
> x := 0.1 * each]"
> 1
> 4.97 real 4.48 user 0.09 sys
>
> On Sat, Dec 17, 2016 at 2:16 PM Dimitris Chloupis 
> wrote:
>
>> So I was bored and decided to test how fast pharo is compared to C++.
>>
>> so I tested addition
>>
>> C++ version:
>>
>> #include 
>>
>> int main()
>> {
>>   double x=0;
>>   while(x<10)
>> {
>> x = x+1;
>> }
>>
>>   return 1;
>>   }
>>
>>  time ./test1
>> 2.84 real 2.84 user 0.00 sys
>>
>> Pharo version:
>>
>> time ./pharo Ephestos.image eval "|x| x := 0. 1 to: 10 do:[:each|
>> x := x +1]"
>> 1
>> 2.09 real 1.94 user 0.08 sys
>>
>> Pharo is +50% faster than C++ ... o_O ... that's suprising, I assume here
>> Pharo VM probably does some kind of optimisation.
>>
>>


Re: [Pharo-users] Cog VM on Raspberry Pi ?

2016-10-18 Thread Clément Bera
The VM you use is the fastest one available.

It's slower mostly due to non Smalltalk concerns (processor architecture,
energy consumption, frequency, overall hardware).

There is an abstraction over the back-ends in the JIT and it could be that
overall the JIT is a little bit more optimised for intel than for ARM. But
I would guess that's a 20% difference at most, if difference there is.

On Mon, Oct 17, 2016 at 11:15 PM, Denis Kudriashov 
wrote:

> Hi.
>
> 2016-10-17 20:43 GMT+02:00 Sven Van Caekenberghe :
>
>> That is no significant difference on a RPi 3, at all. Is this normal ? Am
>> I missing something ?
>>
>> Thx,
>>
>> Sven
>>
>> PS: Just for reference, my Mac Book Pro is 10 times faster
>>
>
> I had same experience with beaglebone
>
>
>>
>> 1 tinyBenchmarks  "'1323852617 bytecodes/sec; 174185794 sends/sec'"
>>
>
>
>


Re: [Pharo-users] Debugger with inlined methods

2016-10-13 Thread Clément Bera
Well for quick methods it's doable.

For inlined control flow operations it's quite difficult. Although it could
be possible now with the mustBeBoolean magic thingy...


On Thu, Oct 13, 2016 at 3:23 PM, Vitor Medina Cruz 
wrote:

> Ben,
>
> I was thinking the same as you, I think that if I could set the image in
> development mode, or something like that, it would not do such optimization
> so that debugger behaves more like expected. If the debugger could undo
> such optimizations would be fine also. I just assumed it should be hard to
> accomplish that.
>
> Regards,
> Vitor
>
> On Wed, Oct 12, 2016 at 9:38 AM, Clément Bera 
> wrote:
>
>> The simulation of primitives is done in Context>>#doPrimitive:method:r
>> eceiver:args:
>>
>> Basically, specific numbers are simulated in the image while other
>> numbers are run using the VM code.
>>
>> Quick methods (what you call inlined methods) are encoded with primitive
>> numbers between 256 and 512. If you look at 
>> IRBytecodeGenerator>>quickMethodPrim
>> you should be able to find the specification of the quick primitive numbers
>> (256 = quick return self, 257 = quick return true, etc...).
>>
>> Basically if you change this method to simulate in the image those
>> primitive numbers instead of using the VM code and simulating by creating
>> the context and executing it, it should work. Or something like that.
>>
>>
>> On Wed, Oct 12, 2016 at 2:18 PM, Ben Coman  wrote:
>>
>>> On Tue, Oct 11, 2016 at 9:45 PM, Esteban Lorenzano 
>>> wrote:
>>> >
>>> >> On 11 Oct 2016, at 15:43, Vitor Medina Cruz 
>>> wrote:
>>> >>
>>> >> Hello,
>>> >>
>>> >> I was TTDing today with Pharo and some odd thing happened. I had a
>>> method that just returned false and while debugging I could not step into
>>> it (i wanted to change the method while debugging), I suppose the method
>>> was inlined and so debugging was not available, is that correct?
>>> >
>>> > yes.
>>>
>>> The same also happens for accessors that return an instance variable
>>> directly.  I often find It unsettling, to be expecting one behaviour
>>> and something different occurs, even if a moment later I implicitly
>>> understand what happened.
>>>
>>> Except of course that someone busy would have to do it, how hard would
>>> it be for the debugger to un-inline the method so it can step into it?
>>>  Are there any reasons not to do that?
>>>
>>> cheers -ben
>>>
>>>
>>
>


Re: [Pharo-users] Debugger with inlined methods

2016-10-12 Thread Clément Bera
The simulation of primitives is done in
Context>>#doPrimitive:method:receiver:args:

Basically, specific numbers are simulated in the image while other numbers
are run using the VM code.

Quick methods (what you call inlined methods) are encoded with primitive
numbers between 256 and 512. If you look at
IRBytecodeGenerator>>quickMethodPrim you should be able to find the
specification of the quick primitive numbers (256 = quick return self, 257
= quick return true, etc...).

Basically if you change this method to simulate in the image those
primitive numbers instead of using the VM code and simulating by creating
the context and executing it, it should work. Or something like that.


On Wed, Oct 12, 2016 at 2:18 PM, Ben Coman  wrote:

> On Tue, Oct 11, 2016 at 9:45 PM, Esteban Lorenzano 
> wrote:
> >
> >> On 11 Oct 2016, at 15:43, Vitor Medina Cruz 
> wrote:
> >>
> >> Hello,
> >>
> >> I was TTDing today with Pharo and some odd thing happened. I had a
> method that just returned false and while debugging I could not step into
> it (i wanted to change the method while debugging), I suppose the method
> was inlined and so debugging was not available, is that correct?
> >
> > yes.
>
> The same also happens for accessors that return an instance variable
> directly.  I often find It unsettling, to be expecting one behaviour
> and something different occurs, even if a moment later I implicitly
> understand what happened.
>
> Except of course that someone busy would have to do it, how hard would
> it be for the debugger to un-inline the method so it can step into it?
>  Are there any reasons not to do that?
>
> cheers -ben
>
>


Re: [Pharo-users] Pharo5 download for linux - interpreter cannot read image file

2016-10-06 Thread Clément Bera
Hello

What you describe (arg1 instead of string) means the source file is not
present. Sources are required for some FFI calls. Take the PharoV50.sources
file (you can find it here http://files.pharo.org/sources/) and put it in
the same folder as your VM. It should solve the problem.

Best,

Clement

On Fri, Oct 7, 2016 at 6:20 AM, Andreas Sunardi  wrote:

> Thanks, Bernardo. That fogbugz case is exactly the problem I'm having.
>
> This VM (pharo-vm-spur-swing.zip) is able to open Pharo 5.0 image from
> Pharo download page. This is a good sign.
>
> Upon opening the image, I am, however, presented immediately with
> 'MessageNotUnderstood: receiver of "/" is nil'. It's coming from
> SystemSettingsPersistence class >> defaultPreferenceFileReference
>
> It boils down to
> OSEnvironment#getEnv: 'HOME'
>
> a failure in building an FFI call. The FFI call function signature is
> #( String getenv (String string) )
>
> The context object built from OSEnvironment#getEnv: gives answer 'arg1',
> instead of 'string', to a call to #method#argumentNames. Down the road, an
> IRMethod instance is trying to find the index for 'string' and can't find
> any, because what is stored is 'arg1'.
>
> I'm out of my depth at this point, and this is a separate issue than not
> being able to start the image. I have to think where I want to go from here.
>
> So, thank you for all of you, for the exceedingly quick and friendly help.
>
> Cheers!
>
> On Thu, Oct 6, 2016 at 5:42 PM, Bernardo Ezequiel Contreras <
> vonbecm...@gmail.com> wrote:
>
>> Hold on,
>>
>>   There's also this issue
>> https://pharo.fogbugz.com/f/cases/17353/build-spur-vm-for-debian-old-libc
>>
>> where in one comment jan.vrany recommended his build
>>
>> https://swing.fit.cvut.cz/jenkins/job/pharo-vm-spur-swing/
>>
>> https://swing.fit.cvut.cz/jenkins/view/All/job/pharo-vm-spur
>> -swing/lastSuccessfulBuild/artifact/pharo-vm-spur-swing.zip
>>
>> that i have used in debian wheezy with the old libc for quite a while. i
>> don't use it anymore because im in jessie.
>>
>>
>>
>> On Thu, Oct 6, 2016 at 9:13 PM, Andreas Sunardi 
>> wrote:
>>
>>> Thank you for the impressive quick response. Unfortunately, I have older
>>> glibc. So now I'm struggling with compiling glibc 2.15 for 32 bit on my 64
>>> bit CentOS 6.5 machine. Not an easy thing to do.
>>>
>>> I'll try those VMs once I succeed in building this glibc
>>>
>>> On Thu, Oct 6, 2016 at 12:41 PM, Bernardo Ezequiel Contreras <
>>> vonbecm...@gmail.com> wrote:
>>>
>>>> this
>>>> http://files.pharo.org/vm/pharo-spur32/linux/latest.zip
>>>>
>>>> works pretty well in Debian GNU/Linux 8 Jessie
>>>>
>>>>
>>>> On Thu, Oct 6, 2016 at 4:09 PM, Clément Bera 
>>>> wrote:
>>>>
>>>>> Thanks for reporting the problem.
>>>>>
>>>>> The error means the VM is incompatible with the image. There was a
>>>>> change of image format in Pharo 5, so the package has likely an old VM
>>>>> while the image has the new format, or the new VM while the image has the
>>>>> old format.
>>>>>
>>>>> Someone will look into that problem in the incoming weeks. Most Pharo
>>>>> maintainers are on Mac, we noticed recently that other OS were not
>>>>> maintained carefully enough (We're sorry about that) and we're trying to
>>>>> solve that problem.
>>>>>
>>>>> Meantime
>>>>>
>>>>> Can you try the latest VM from here (latest.zip):
>>>>> http://files.pharo.org/vm/pharo-spur32/linux/
>>>>>
>>>>> Or if still failing, the latest VM from here (latest.zip):
>>>>> http://files.pharo.org/vm/pharo/linux/
>>>>>
>>>>> One of these two VMs should work. Please tell me which one worked if
>>>>> you try.
>>>>>
>>>>> Thanks & Regards
>>>>>
>>>>> Clement
>>>>>
>>>>> On Thu, Oct 6, 2016 at 8:44 PM, Bernardo Ezequiel Contreras <
>>>>> vonbecm...@gmail.com> wrote:
>>>>>
>>>>>> i already submitted a similar issue
>>>>>> https://pharo.fogbugz.com/f/cases/18221/This-interpreter-ver
>>>>>> s-6505-cannot-read-image-file-vers-6521
>>>>&g

Re: [Pharo-users] Pharo5 download for linux - interpreter cannot read image file

2016-10-06 Thread Clément Bera
Thanks for reporting the problem.

The error means the VM is incompatible with the image. There was a change
of image format in Pharo 5, so the package has likely an old VM while the
image has the new format, or the new VM while the image has the old format.

Someone will look into that problem in the incoming weeks. Most Pharo
maintainers are on Mac, we noticed recently that other OS were not
maintained carefully enough (We're sorry about that) and we're trying to
solve that problem.

Meantime

Can you try the latest VM from here (latest.zip):
http://files.pharo.org/vm/pharo-spur32/linux/

Or if still failing, the latest VM from here (latest.zip):
http://files.pharo.org/vm/pharo/linux/

One of these two VMs should work. Please tell me which one worked if you
try.

Thanks & Regards

Clement

On Thu, Oct 6, 2016 at 8:44 PM, Bernardo Ezequiel Contreras <
vonbecm...@gmail.com> wrote:

> i already submitted a similar issue
> https://pharo.fogbugz.com/f/cases/18221/This-interpreter-
> vers-6505-cannot-read-image-file-vers-6521
>
> check it and see if it is the same
>
> On Thu, Oct 6, 2016 at 3:20 PM, Andreas Sunardi 
> wrote:
>
>> I'm on CentOS 6.5 and I downloaded Pharo 5 for GNU/Linux w. libc < 2.15
>> and for CentOS. Both won't start (I have no problem with Windows version):
>>
>> $ pharo
>> This interpreter (vers. 6505) cannot read image file (vers. 6521).
>> Press CR to quit...
>>
>> I'm unable to find report or information about this issue on the web. I
>> think it was like this ~2 months ago as well. Is this a known issue?
>>
>> First time posting question in this mailing list, so I beg your pardon if
>> I break any mailing list rule.
>>
>> --
>> Andreas S
>>
>
>
>
> --
> Bernardo E.C.
>
> Sent from a cheap desktop computer in South America.
>


Re: [Pharo-users] Essential Documentation

2016-09-23 Thread Clément Bera
General documentation on all the base frameworks is present in the *Pharo
by example* book. You can download it for free here:
http://pharobyexample.org/versions/PBE1-2009-10-28.pdf
Or here for the updated version:
https://ci.inria.fr/pharo-contribution/view/Books/job/UpdatedPharoByExample/lastSuccessfulBuild/artifact/book-result/UpdatedPharoByExample.pdf

For frameworks like voyage, the documentation is available in another book
which can also be downloaded for free:
http://files.pharo.org/books/enterprise-pharo/
Chapter 11 is about Voyage


On Fri, Sep 23, 2016 at 6:16 PM, julius  wrote:

> Probably this is a very beginners question but is there a documentation
> online
> or within the Pharo image for all the base-framework components like all
> collections, Morphic, Numbers and so on?
>
> I know Pharo uses a lot the 'see and discover yourself' approach but
> sometimes,
> especially for beginners it would be nice to have a documentation for most
> classes
> and also have programming guides. Coming from macOS and iOS development I
> think about something like Swift or Objective-C has. For example you have
> every
> class there documented but also you have programming guides for how to draw
> graphics. It would be really helpful to have somthing like that for example
> for
> Voyage (maybe it's there but I did not found it).
>
> Thanks for helping me out!
> Julius
>
>
>
> --
> View this message in context: http://forum.world.st/
> Essential-Documentation-tp4916861.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] Fwd: [Vm-dev] unused-method removal vs. Spur compaction

2016-09-19 Thread Clément Bera
Well maybe it would just work. One needs to try.

I am pretty sure we could compress the Pharo image using code run in Squeak
out of the box. We may or may not be able to run it from Pharo out of the
box.

Another interesting thing could be to use that as part of the bootstrap.

I will try to have a look into the compactor in the incoming week. I teach
a lot right now so it's difficult.



On Mon, Sep 19, 2016 at 10:45 AM, Ben Coman  wrote:

> Right mailing list. Wrong assumptions. I guessed it would *just*work*.
> Thanks for the correction.
> cheers -ben
>
> On Mon, Sep 19, 2016 at 3:51 PM, Clément Bera 
> wrote:
> > I am not sure this is the right mailing list.
> >
> > Spur32BitPreen could be used as part of the Pharo release process as
> long as
> > the compactor is not working well. This way released images can be more
> > compact. If the Pharo folks wants to run Spur32BitPreen from Pharo to
> > compact the image, the time spent to make things work may not be worth
> it as
> > the mid-term solution is a new compactor.
> >
> > On Mon, Sep 19, 2016 at 1:42 AM, Ben Coman  wrote:
> >>
> >> Forwarded from squeak & vm lists in case its useful to others...
> >>
> >> On Sun, Sep 18, 2016 at 5:11 AM, Craig Latta <
> cr...@blackpagedigital.com>
> >> wrote:
> >> >
> >> >
> >> > Hi--
> >> >
> >> >  I've got the mass unused-method removal from Spoon working in
> Spur
> >> > in Squeak 5.1. But now I have a juicy 12-megabyte chunk of free space
> in
> >> > the middle of the 35-megabyte image that won't go away. There's just
> one
> >> > Spur segment (I was expecting several?), with no pinned objects.
> >> >
> >> >  Is there a known Squeak image with multiple segments? Is there
> some
> >> > way to split a segment? Am I just supposed to play with the grow
> >> > overhead and shrink threshold in the VM simulator, until the
> compaction
> >> > I want is triggered?
> >> >
> >> >  thanks!
> >> > Craig Latta
> >>
> >>
> >>
> >> -- Forwarded message --
> >> From: tim Rowledge 
> >> Date: Mon, Sep 19, 2016 at 1:17 AM
> >> Subject: Re: [Vm-dev] unused-method removal vs. Spur compaction
> >> To: Squeak Virtual Machine Development Discussion
> >> 
> >>
> >>
> >>
> >> Eliot mentioned using the vmaker sim to load the image and then save
> >> it after removing the empty space. Ah, found it -
> >>
> >> > Build a VMMaker image with image/buildspurtrunkvmmaker.sh and you can
> >> > now use Spur32BitPreen to rewrite the image to be more compact.  We
> can use
> >> > this as part of the release process until Clément and I have fixed
> Spur
> >> > compaction.  e.g.
> >> >
> >> >   Spur32BitPreen new preenImage: '../oscogvm/image/trunk50'
> >> >   Looking for module  ... loaded...computing accessor
> depths...done
> >> >   Looking for module  ... loaded...computing accessor
> >> > depths...done.done.
> >> >   old heap size: 41,897,472   initial new heap size:
> 26,818,472
> >> >   change: -35.99%
> >> >   final new heap size: 26,818,472 change: -35.99%
> >> >
> >> >   Done!
> >> >
> >> tim
> >>
> >
>
>


Re: [Pharo-users] limits on number of instance variables and class variables

2016-09-11 Thread Clément Bera
Hello Ben,

The limit you see for instance variables is due to:
- Class format encoding (Memory manager dependent)
- Bytecode set encoding (Bytecode set dependent)

The 255 inst var limit is enforced both by:
- the V3 Memory manager
- the SqueakV3PlusClosures bytecode set.

Now we have Spur instead of V3 as a memory manager, which allows up to
65535 instance variables.

The SistaV1 bytecodeset should reach production in Pharo 6 alpha any time
soon, and combined with the Spur memory manager, it enforces a limit of
65535 instance variables instead of 255.

Class variables are indeed a dictionary so there's no hard limit.



On Mon, Sep 12, 2016 at 4:51 AM, Ben Coman  wrote:

> Minor curiosity... I was wondering about the limits on the number of
> instance variables and class variables (particularly the latter regarding
> large FFI enumerations), so I produced a script to experiment with.
>
> Results:
> * Class Variables seem to have no practical limit. Although running 6C
> experiment a second time locks the image for about 3 minutes, but
> eventually completes.
> * Instance Variables limit is 255 or 256.  This not clear since 256 works,
> but the error message** for 257 says the limit is 255.
>** Error: genStorePopInstVarLong: index index 256 is out of range 0
> to 255
>
> cheers -ben
>
> Here is the fun script...
> ""
> "The experiment has two parameters (select by changing the #at: index):
>_RANGE - Range of variables assigned.  Note variables are declared
> starting from 0001.
>_TYPE - (i)instance variable or (C)lass variable"
>
> _RANGE := {
> 1->9. "1. code validation"
> 201->256. "2. instance variables limit"
> 201->257. "3. instance variables Error: genStorePopInstVarLong: index
> index 256 is out of range 0 to 255"
> 201->299. "4. class variables keep going"
> 901->999. "5. class variables go extreme"
> 9901->. "6. class variables go ultra extreme"
> } at: 1.
> _TYPE := {
> 'i'. "1. instance variables"
> 'C'"2. class variables"
> } at: 1.
>
> "Choose experiment parameters above"
>
> start := _RANGE key.
> end := _RANGE value.
>
> "DECLARE VARIABLES"
> vars := ''.
> 1 to: end do: [:n| vars := vars, _TYPE, (n printPaddedWith: $0 to: 4), '
>  ' ].
> vars.
> Object subclass: #Test
> instanceVariableNames: ((_TYPE = 'i') ifTrue: [vars] ifFalse: [ '' ])
> classVariableNames: ((_TYPE = 'C') ifTrue: [vars] ifFalse: [ '' ])
> poolDictionaries: ''
> package: ''.
>
> "First run needs to execute above separately to create the class referred
> below"
>
> "ASSIGN VARIABLES"
> body := '
> '.
> start to: end do: [ :n| body := body , _TYPE, (n printPaddedWith: $0 to:
> 4), ':=' , n printString , '.
> ' ].
> body.
> #Test asClass compile: 'assign ' , body.
>
> "INSPECT VARIABLES"
> body := '
> ^{'.
> start to: end do: [ :n| body := body , _TYPE, (n printPaddedWith: $0 to:
> 4) , '. ' ].
> body.
> Test compile: 'inspect ' , body , '} inspect'.
>
> Test new assign ; inspect.
>
>


Re: [Pharo-users] Profiling

2016-09-08 Thread Clément Bera
On Thu, Sep 8, 2016 at 3:44 AM, Vitor Medina Cruz 
wrote:

> Hello,
>
> While profiling some I/O code that takes ~20 seconds to execute under my
> local image, the report says that about ~13 seconds is waste on
> OtherProcesses -> ProcessorScheduler class>>idleProcess. I could not
> understand what this idleProcess do by looking at the code. First I thought
> this could be time waiting the I/O operation to terminate, but that don't
> make much sense because I have the same code on a Digital Ocean Doplet and
> it takes ~6 seconds to execute.
>
> Can someone help me understand what does this time on idleProcess means?
>

The VM is not event-driven. Hence when all the processes are suspended or
terminated, the VM falls back to the idle process. The idle process waits
for 1ms, checks if any event has occurred and/or if a process can restart,
and if not waits for 1 more ms to check again. That's kind of dumb but it
works and we need both time and funds to make the VM event-driven (in the
latter case the VM restarts directly when an event happens, instead of
checking at the next ms).

Basically the idle process profiled time is the time where Pharo has
nothing to do because all processes are terminated or suspended. You can
say that it is the time spent in I/O operations + the time before Pharo
notices the I/O operation is terminated, which can be up to 1ms.


>
> The full report is:
>
>  - 18407 tallies, 18605 msec.
>
> **Tree**
> 
> Process: (40s) Morphic UI Process: nil
> 
> 25.1% {4663ms} UndefinedObject>>DoIt
>   25.1% {4663ms} TweetsServiceRestConsumer(TweetsService)>>hashesTop:
> usingLastTweetsUpTo:fromHandler:
> 25.0% {4656ms} TweetsServiceRestConsumer>>fetchLastTweetsUpTo:
> fromHandler:
>   14.3% {2653ms} OAuthProvider>>httpGet:
> |14.3% {2653ms} ZnOAuth1Service>>httpGet:using:
> |  14.3% {2653ms} ZnOAuth1Service>>executeRequest:token:
> |14.3% {2653ms} ZnOAuth1Service>>executeRequest:token:
> followRedirects:
> |  14.2% {2646ms} ZnClient>>execute
> |14.2% {2646ms} ZnClient>>withProgressDo:
> |  14.2% {2646ms} ZnSignalProgress class(DynamicVariable
> class)>>value:during:
> |14.2% {2646ms} ZnSignalProgress(
> DynamicVariable)>>value:during:
> |  14.2% {2646ms} BlockClosure>>ensure:
> |14.2% {2646ms} ZnSignalProgress(
> DynamicVariable)>>value:during:
> |  14.2% {2646ms} ZnClient>>withProgressDo:
> |14.2% {2646ms} ZnClient>>execute
> |  14.2% {2646ms} ZnClient>>executeWithTimeout
> |14.2% {2646ms} ZnClient>>withTimeoutDo:
> |  14.2% {2646ms} ZnConnectionTimeout
> class(DynamicVariable class)>>value:during:
> |14.2% {2646ms} ZnConnectionTimeout(
> DynamicVariable)>>value:during:
> |  14.2% {2646ms} BlockClosure>>ensure:
> |14.2% {2646ms}
> ZnConnectionTimeout(DynamicVariable)>>value:during:
> |  14.2% {2646ms}
> ZnClient>>withTimeoutDo:
> |14.2% {2646ms}
> ZnClient>>executeWithTimeout
> |  14.2% {2646ms}
> BlockClosure>>on:do:
> |14.2% {2646ms}
> ZnClient>>executeWithTimeout
> |  14.2% {2646ms}
> ZnClient>>executeWithRetriesRemaining:
> |14.2% {2644ms}
> BlockClosure>>on:do:
> |  14.2% {2644ms}
> ZnClient>>executeWithRetriesRemaining:
> |14.2% {2644ms}
> ZnClient>>executeWithRedirectsRemaining:
> |  14.2% {2641ms}
> ZnClient>>getConnectionAndExecute
> |13.8%
> {2569ms} BlockClosure>>ensure:
> |  13.8%
> {2569ms} ZnClient>>getConnectionAndExecute
> |13.8%
> {2569ms} ZnClient>>executeRequestResponse
> |  13.8%
> {2569ms} ZnClient>>readResponse
> |13.8%
> {2569ms} ZnResponse class(ZnMessage class)>>readFrom:
> |
>  13.8% {2569ms} ZnResponse(ZnMessage)>>readFrom:
> |
>  13.8% {2559ms} ZnResponse>>readEntityFrom:
> |
>  13.8% {2559ms} ZnResponse(ZnMessage)>>readEntityFrom:
> |
>13.8% {2559ms} ZnEntityReader>>readEntity
> |
>  13.8% {2559ms} ZnEntityReader>>readEnti

Re: [Pharo-users] Performance vs Ruby performance

2016-09-07 Thread Clément Bera
What ruby runtime exactly ? The standard ruby interpreter, rubinius, JRuby ?

What do you mean by performance ? Smallest time to run long computation ?
Latency for web servers ? Pauses in real time applications ?

The standard ruby interpreter is really slow (likely ~100 times slower than
the Pharo 5 VM), now it binds directly multiple C librairies, such as the
regex librairy, while these librairies are written in Smalltalk in Pharo.
So if you measure regex performance I am pretty sure that ruby is at least
10 times faster, if not 100 times.

So basically it depends on what benchmark you are measuring. We don't do
cross languages benchmarks in our servers, only versus other Smalltalks.
That website (http://benchmarksgame.alioth.debian.org/) compares ruby and
JRuby to VW which has similar speed to Pharo 5.



On Thu, Sep 8, 2016 at 1:28 AM, Vitor Medina Cruz 
wrote:

> Hello,
>
> How is Pharo compared with Ruby in terms of performance? Has someone done
> some comparison benchmark? If yes, that was done with other platforms?
>
> Regards,
> VItor
>


Re: [Pharo-users] Spur problem?

2016-09-07 Thread Clément Bera
Hi,

I've never seen that error before. That looks interesting.

You need to provide more information. For example the backtrace or
something written in PharoDebug.log.

Else, as suggested, set a breakpoint in malloc_error_break and try to
figure out what is going on.

On Wed, Sep 7, 2016 at 4:56 PM, Usman Bhatti  wrote:

> Hi,
>
> While working on a Pharo 5 image for 3-4 hours, I got an image crash and I
> was no more able to start the image from the UI interface. When starting
> the image from the command line I got the following error:
>
> Pharo(50871,0xa02c91a8) malloc: *** error for object 0x1af7a04: incorrect
> checksum for freed object - object was probably modified after being freed.
>
> *** set a breakpoint in malloc_error_break to debug
>
> fish: '/Users/ubhatti/temp/vm-spur/Pha…' terminated by signal SIGBUS
> (Misaligned address error).
>
> The image is about 973 Mb (Moose + seaside + a model for a big industrial
> software). This message might not go beyond reporting an error that I do
> not know how to produce neither can I share the image (it contains client
> proprietary software model and hence we are restricted).
>
> Just to let you know that there was a problem and n ask if someone has
> encountered it before?
>
>
> regards.
>
> Usman
>


Re: [Pharo-users] 64bit support

2016-08-16 Thread Clément Bera
The 64 bits linux and mac VM have been working for more than 6 months.
They've been in production in a company since April or something like that.
Latest product are built by Travis and available here:
https://bintray.com/opensmalltalk/vm/cog#files. Pharo provides a
Pharo-flavored VM with a different logo and additional plugins. No 64 bits
Pharo-flavored VM seems to be available, so the support right now is
incomplete on 64bits due to missing plugins (no FreeType, Cairo binding,
etc.), however I am taking care that the Pharo image still starts and works
normally on the main build, so only some features are not working.

The 64 bits Pharo image is available on http://files.pharo.org/image/60/
(See for example latest-64.zip).

The FFI plugin is working but the UFFI front-end may have little issues.
The issues should be minor so the complete support shouldn't take long.

On Tue, Aug 16, 2016 at 1:04 PM, Peter Uhnák  wrote:

> Is there a timeline for 64bit on Windows?
>

There has been a working 64 bits VM on windows for a month now. It has been
merged with the main code base recently. 64 bits windows VM are not
compiled automatically yet so you have to compile it yourself if you want
to use it. The repo is here:
https://github.com/OpenSmalltalk/opensmalltalk-vm and the build.win64x64
folder has a HowToBuild file.


> Also will it make the Windows VM even more unstable, or can it help?
> #askingforafriend
>

Precise what you are talking about and I can answer.


> On Tue, Aug 16, 2016 at 12:19 PM, Esteban Lorenzano 
> wrote:
>
>>
>> > On 15 Aug 2016, at 23:09, Gour  wrote:
>> >
>> > On Mon, 15 Aug 2016 22:44:49 +0200
>> > "Cyril Ferlicot D."
>> >  wrote:
>> >
>> > Hello Cyril,
>> >
>> >> 64bits support should be ready for Pharo 6!
>> >
>> > That's great to hear!! Any rough estimate about its ETA?
>> >
>> >> In fact there is already a 64bits VM and Image existing for mac almost
>> >> functional. It only miss the support for FFI and libgit2 plugin.
>> >
>> > HAving proper FFI support is certainly on my list of required
>> > things…Cool.
>>
>> FFI should be mostly working (just some details to verify in UFFI, not in
>> the plugin itself)
>> libgit2 is just to sit and doit (something I didn’t do because is not
>> mandatory to have a fully working image)
>>
>> Esteban
>>
>> >
>> >> In some month I think it will be ready for Mac and Linux.
>> >
>> > It looks as the time is ripe to dive into Pharo asap. ;)
>> >
>> >
>> > Sincerely,
>> > Gour
>> >
>> > --
>> > The spirit soul bewildered by the influence of false ego thinks
>> > himself the doer of activities that are in actuality carried out
>> > by the three modes of material nature.
>>
>>
>>
>


Re: [Pharo-users] Programmatic generation of new class

2016-07-29 Thread Clément Bera
On old versions of Pharo you need to use:
#subclass:instanceVariableNames:classVariableNames:poolDictionaries:package:

That might be it.

On Fri, Jul 29, 2016 at 6:14 PM, Peter Uhnak  wrote:

> Can you show the full trace? Because I am regularly doing something
> similar without any problems.
> In fact if I copy/paste your code (and just change the classes that I
> have) it works fine.
>
> Btw. did you override such methods in your system?
>
> Peter
>
> On Fri, Jul 29, 2016 at 07:05:04AM -0700, Brad Selfridge wrote:
> > I'm trying to programmatically generate a new class, but am getting the
> > following error:
> >
> > DynamicDescriptorSystem class(Object)>>doesNotUnderstand:
> > #subclass:instanceVariableNames:classVariableNames:package:
> >
> > This is the method that I'm trying to execute:
> >
> > buildNewDescriptorSystemUsing: aDescriptorSystemClassName
> >
> >   descriptorSystem :=
> >   DynamicDescriptorSystem subclass: aDescriptorSystemClassName
> asSymbol
> >   instanceVariableNames: ''
> >   classVariableNames: ''
> >   package: packageName asString
> >
> > I see examples of this all over Pharo and I copied this code almost
> > verbatim.
> >
> > What am I doing wrong?
> >
> >
> >
> > -
> > Brad Selfridge
> > --
> > View this message in context:
> http://forum.world.st/Programmatic-generation-of-new-class-tp4908659.html
> > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> >
>
>


Re: [Pharo-users] Spur Cog vs VW

2016-06-07 Thread Clément Bera
We measured Spur vs pre-Spur, but I am not sure we can measure VW without
Cincom's approval.

On Tue, Jun 7, 2016 at 7:56 AM, Gerry Weaver  wrote:

> Hi,
>
> I was reading about the VM stuff and assumed (wrongly) that the post
> applied to that. Sorry for the noise.
>
> Thanks,
> -G
>
>
> -Original Message-
> From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf
> Of stepharo
> Sent: Tuesday, June 7, 2016 12:48 AM
> To: Any question about pharo is welcome 
> Subject: Re: [Pharo-users] Spur Cog vs VW
>
> Not that one :)
>
> https://www.youtube.com/watch?v=7spEW4NLbH8
>
> Stef
>
>
>
>


Re: [Pharo-users] parameters of the virtual machine

2016-05-25 Thread Clément Bera
Well the aspects described here either are documented or are being
documented through IWST papers waiting for approval.

The cache accessing technique is detailed in the IWST'16 paper *Inferring
Types by Mining Class Usage Frequency from Inline Caches**. *Hopefully
it'll get accepted and everyone can read it. Nevena worked a lot on it and
I believe it's very good.

The VM parameters are detailed in Pharo in the method comment of
VirtualMachine>>parameterAt: . The comment is self-explanatory so if one
does not understand it one needs to read already available documentation
about the VM internal behavior.

The machine code zone details I added are discussed in my IWST'16 paper *A
low Overhead Per Object Write Barrier for Smalltalk. *Hopefully it'll get
accepted and everyone can read it.

On Wed, May 25, 2016 at 8:46 AM, stepharo  wrote:

> clement
>
>
> you should add that to a simple blog post :)
>
>
> Stef
>
> Le 24/5/16 à 19:35, Clément Bera a écrit :
>
> Hi,
>
> Sorry the mail is quite long... I CC'd Nevena for section II, she used the
> VM caches for type inference.
>
> *Section I. VM parameters*
>
> *  46  size of machine code zone, in bytes*
>
> Well, the size of the machine code zone :-). To speed-up execution, the
> cog uses internally a JIT compiler which translates to machine code
> frequently used bytecoded method and run the machine code to execute them
> instead of using the interpreter. The machine code zone is an executable
> memory zone containing all the machine code versions of methods.
>
> The default size should be between 1Mb and 2Mb for standard applications.
> If memory is a constraint, it can be lowered down to 750kb, under that you
> should use the stack VM else the performance starts to drastically decrease.
>
> This setting is useful to tune your application performance. For example,
> on compilation-intensive benchs, 750kb is the optimal machine code zone
> size. On large benchmarks, 2 Mb, maybe more, is better, but then one may
> see machine code garbage collection pauses. On small benchs all the methods
> fit into this zone so it doesn't really matter.
>
> Growing the machine code zone:
> - increase the number of methods that can be present there, hence
> decreasing machine code zone garbage collection frequency and method jit
> compilation.
> - decrease the machine code zone to cpu instruction cache mapping
> - slow down machine code zone garbage collection
>
> To set the machine code zone you need to use another parameter (47 I
> think) and restart the VM+image.
>
> *  59  number of check event calls since startup (read-only)*
>
> If I remember correctly, the number of times the VM has checked for OS
> events since start-up.
>
>
> * 60  number of stack page overflows since startup (read-only; Cog VMs
> only)  61  number of stack page divorces since startup (read-only; Cog
> VMs only)*
>
> This is related to stack page management. Read the Cog blog to understand
> how it's done. See
> <http://www.mirandabanda.org/cogblog/2009/01/14/under-cover-contexts-and-the-big-frame-up/>
> http://www.mirandabanda.org/cogblog/2009/01/14/under-cover-contexts-and-the-big-frame-up/
> section Stack pages.
>
> *Section II. Accessing the caches*
>
>
>
>
> *Is there a way to get access to the cache? How many caches does Cog has?
> I guess it has - a method call cache (associating (object,symbol)
> -> compiled method - a cache for the JIT-compiled methods right? *
>
>
> *Are there other cache? How can I access them? In particular to query
> about their fill. *
>
> There is indeed a global look-up cache, mapping (receiver type, symbol) ->
> (compiled method, primitive function pointer). In the jitted methods there
> are per send-sites look-up caches, also known as inline caches.
>
> The most useful is the inline cache values, they provide the receiver
> types met for each send site and are fairly reliable. There are ways to
> access those caches. I personally use those caches values for the runtime
> optimizing compiler, but more recently I worked with Nevena Milojkovic (I
> CC'd her) and she was able to use those cache values for type inference,
> while she is not a VM expert. We wrote an IWST paper about that, hopefully
> it'll get accepted and you will be able to read it. In the IWST paper I
> sum-up Eliot's implementation of inline caches and how the VM provides the
> types.
>
> In short, to access the caches:
> 1) add those primitives:
> VirtualMachine>>allMachineCodeMethods
>
>^#()
> CompiledMethod>>sendAndBranchData
>
>^#()
> 2) add glue code to map caches values from

Re: [Pharo-users] parameters of the virtual machine

2016-05-24 Thread Clément Bera
Hi,

Sorry the mail is quite long... I CC'd Nevena for section II, she used the
VM caches for type inference.

*Section I. VM parameters*

*  46  size of machine code zone, in bytes*

Well, the size of the machine code zone :-). To speed-up execution, the cog
uses internally a JIT compiler which translates to machine code frequently
used bytecoded method and run the machine code to execute them instead of
using the interpreter. The machine code zone is an executable memory zone
containing all the machine code versions of methods.

The default size should be between 1Mb and 2Mb for standard applications.
If memory is a constraint, it can be lowered down to 750kb, under that you
should use the stack VM else the performance starts to drastically decrease.

This setting is useful to tune your application performance. For example,
on compilation-intensive benchs, 750kb is the optimal machine code zone
size. On large benchmarks, 2 Mb, maybe more, is better, but then one may
see machine code garbage collection pauses. On small benchs all the methods
fit into this zone so it doesn't really matter.

Growing the machine code zone:
- increase the number of methods that can be present there, hence
decreasing machine code zone garbage collection frequency and method jit
compilation.
- decrease the machine code zone to cpu instruction cache mapping
- slow down machine code zone garbage collection

To set the machine code zone you need to use another parameter (47 I think)
and restart the VM+image.

*  59  number of check event calls since startup (read-only)*

If I remember correctly, the number of times the VM has checked for OS
events since start-up.


* 60  number of stack page overflows since startup (read-only; Cog VMs
only) 61  number of stack page divorces since startup (read-only; Cog
VMs only)*

This is related to stack page management. Read the Cog blog to understand
how it's done. See
http://www.mirandabanda.org/cogblog/2009/01/14/under-cover-contexts-and-the-big-frame-up/
section Stack pages.

*Section II. Accessing the caches*




*Is there a way to get access to the cache? How many caches does Cog has? I
guess it has- a method call cache (associating (object,symbol) ->
compiled method- a cache for the JIT-compiled methods right?*


*Are there other cache? How can I access them? In particular to query about
their fill.*

There is indeed a global look-up cache, mapping (receiver type, symbol) ->
(compiled method, primitive function pointer). In the jitted methods there
are per send-sites look-up caches, also known as inline caches.

The most useful is the inline cache values, they provide the receiver types
met for each send site and are fairly reliable. There are ways to access
those caches. I personally use those caches values for the runtime
optimizing compiler, but more recently I worked with Nevena Milojkovic (I
CC'd her) and she was able to use those cache values for type inference,
while she is not a VM expert. We wrote an IWST paper about that, hopefully
it'll get accepted and you will be able to read it. In the IWST paper I
sum-up Eliot's implementation of inline caches and how the VM provides the
types.

In short, to access the caches:
1) add those primitives:
VirtualMachine>>allMachineCodeMethods
   
   ^#()
CompiledMethod>>sendAndBranchData
   
   ^#()
2) add glue code to map caches values from bytecode pc to the AST,
something like that:
CompiledMethod>>astWithCacheAnnotations
| tmp1 |
tmp1 := self sendAndBranchData.
tmp1
ifEmpty: [ 'No data' logCr.
^ self ast ];
do: [ :arg1 |
(self sourceNodeForPC: arg1 first)
propertyAt: #cacheInformation
put: arg1 allButFirst ].
^ self ast
3) Compile the VM with the SistaCogit and SistaVM=true (Slang compilation
settings).

I guess you could read our IWST paper, that would help. I don't know if
that's possible before the reviewers answer.

Don't build production tools using those values though, the VM is evolving
and the cache values may vary in the future with the sista optimizer.

Regards,

Clement

On Tue, May 24, 2016 at 5:39 PM, Alexandre Bergel 
wrote:

> Hi,
>
> The Cog virtual machine expose some very useful parameters. However, some
> of them are a bit obscure to me. For example, what are the following
> parameters? What do they mean?
>
> 46  size of machine code zone, in bytes
> 59  number of check event calls since startup
> (read-only)
> 60  number of stack page overflows since startup
> (read-only; Cog VMs only)
> 61  number of stack page divorces since startup
> (read-only; Cog VMs only)
>
> Is there a way to get access to the cache? How many caches does Cog has? I
> guess it has
> - a method call cache (associating (object,symbol) -> compiled
> method
> - a cache for the JIT-compiled methods right?
>
> Are there other cache? How can I access them? In particular to query about
> their fill.
>
> Cheers,
> Alexandre
>

Re: [Pharo-users] Presenting Pharo in Greece

2016-05-13 Thread Clément Bera
I usually get it from http://files.pharo.org/

In media, pharoCheatSheet or flyer-cheat-sheet.

On Fri, May 13, 2016 at 10:32 AM, Dimitris Chloupis 
wrote:

> thanks any idea where i can get the card that contains the pharo syntax ?
>
> On Fri, May 13, 2016 at 10:33 AM stepharo  wrote:
>
>> good luck :)
>>
>>
>>
>> Le 12/5/16 à 12:50, Dimitris Chloupis a écrit :
>> > Hey I wanted to inform you that I will be doing a 30 minutes
>> > presentation of Pharo in Hackerspace , Athens so if there are any
>> > Greeks watching the list they are more than welcomed to join. My talk
>> > will focus on live coding and no familiarity with Pharo/Smalltalk or
>> > programming experience required.
>> >
>> > The talk will be 30 minutes and it will be given in 15:30 28th of May
>> > 2016 (Saturday) as part of Hackfest 2016 organized by Hackerspace in
>> > Athens.
>> >
>> > More info can be found here
>> >
>> > https://hackfest.gr/
>> >
>> > This will be both the first time Pharo is presented in Greece and my
>> > first presentation so I am pretty excited about how it will go. Wish
>> > me luck :)
>> >
>> >
>> >
>> >
>>
>>
>>


Re: [Pharo-users] What frameworks/libraries are available for creating programming languages with Pharo

2016-03-22 Thread Clément Bera
I think in addition of the parser/compilation chain, a language is about
having a good IDE.

The Pharo IDE depends more and more on the AST and not on the source code,
so if your new language uses an AST polymorphic with the Smalltalk AST I
guess you can have IDE tools for free (at least partly).

At least you can consider frameworks to build code browser such as Glamour
as an available library to create a programming language.

In addition, Omnibrower, which is the default code browser in Pharo 1.4,
can browse the code of any language. You provide Omnibrowser a language
model and it browses your code based on your model.



2016-03-22 9:48 GMT+01:00 Dimitris Chloupis :

> If lisp is ideal for creating new languages so is Smalltalk so I was
> wondering what kind of libraries there are out there for helping with the
> creation of new languages in Pharo. I know about SmaCC and PettitParser ,
> what else is out there ?
>


Re: [Pharo-users] Beginner's question on morphs

2016-03-13 Thread Clément Bera
Alternatively, I do that using a SDL window. This way, the production game
can be launched using SDL and pharo headless, and not have the overhead of
the morphic rendering loop.

2016-03-13 15:22 GMT+01:00 Henrik Nergaard :

> http://ws.stfx.eu/1RCNV18R5J7E
>
> Best regards,
> Henrik
>
> -Original Message-
> From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf
> Of Markus Stumptner
> Sent: Sunday, March 13, 2016 2:49 PM
> To: pharo-users@lists.pharo.org
> Subject: [Pharo-users] Beginner's question on morphs
>
> Hi, I'm trying to refamiliarize with Pharo again after a few years...
> trying to set up a simple game window  that uses a very large scrollable
> game board with a huge image as the background, so that game pieces placed
> on that background would scroll in and out of view. Any hints as how to
> best set that up in Morphic?
>
> Thanks
> Markus
>
>


Re: [Pharo-users] Get the code of a method - Artefact

2016-03-10 Thread Clément Bera
sourceCode is the best way to do it. It answers the original sources if
available, and the decompiled sources if not available.

2016-03-10 11:22 GMT+01:00 Cyril Ferlicot :

> Hi,
>
> Do you really need to decompile the method? A CompiledMethod know his
> source code.
>
> See: Object methods first sourceCode
>
> But you can get the decompiled code with:
>
> Object methods first codeForNoSource
>
> I hope this help you
>
> On Thu, Mar 10, 2016 at 11:14 AM, Guillaume Ongenae <
> guillaume.onge...@gmail.com> wrote:
>
>> Hello,
>>
>> I'm a student at Lille 1 university, so I'm still a beginner in Pharo
>>
>> I'm working on Artefact to create a more understable and complete
>> demonstration.
>> To do that I would like to print the code of a given method. However I
>> can find how to decompiled the given method.
>> Any help is welcome.
>>
>> --
>>
>>
>> [image: --]
>>
>> Guillaume Ongenae
>> [image: https://]about.me/guillaume.ongenae
>>
>> 
>>
>
>
>
> --
> Cheers
> Cyril Ferlicot
>


Re: [Pharo-users] A new idea for a project: WarpSpeed (a C inliner)

2016-02-28 Thread Clément Bera
Hello,

As Stephan Eggermont said, you need to make some measurements.

There are a few big problems.

In short, if the FFI call is going to do quite some computation (at least a
few millisecond), assuming tinyC has performance similar to gcc or llvm,
you may get faster, if the FFI call is going to do very little (calling
Math.abs() for example as Pharo has no primitive for abs), the overhead of
the call is going to be too big. Maybe you can make your runtime with C
worth it, but for example it's clear that if you write tiny methods in C
for reusability / modularity of your code and you bind each tiny method to
the smalltalk runtime, using those tiny methods one by one is not going to
be worth it. However, if you write a merge sort or another algorithm fully
in C and do a single call to the algorithm to sort a collection, on large
collection and large collections only, it's going to be worth it.

In details, the main problems are:

- the Smalltalk stack has specific constraints, like hand-written stack
page management to support heavy stack manipulation (setting sender of a
context from the image). Hence, a C stack cannot just grow inside the
Smalltalk stack as in other languages directly integrated to C. The way FFI
tackles this problem is by using the interpreter C stack to execute C code.
This is problematic as the runtime needs to switch from assembly runtime
(Smalltalk method generated from the jit) to C runtime for the FFI call and
then switch back, which induces overhead in jitted code, i.e., performance
critical code. Maybe you could change the way the jitted code activates C
code by checking the stack size needed by the dynamic lib API and if there
is enough room on the smalltalk stack, then call it on the Smalltalk stack,
though it creates other problems (what if garbage collection happens from
another native thread while the FFI call is performed in non blocking FFI
?).

- you need to convert types between Smalltalk to C at each call inducing
FFI call overhead or makes the C code aware of your data structures which
you have to support for those Smalltalk data structure yourself and induces
some overhead in the C runtime.

In Smalltalk/X, the C runtime is directly integrated in the Smalltalk
runtime. You can ask Jan Vrany how he does it. But I think he doesn't have
our hand written stack management (I am not 100% sure).

2016-02-28 2:04 GMT+01:00 Stephan Eggermont :

> On 26/02/16 20:30, Dimitris Chloupis wrote:
>
>> I was thinking it would still be cool to have some kind of library that
>> will help us boost the speed of pharo . So I was thinking about a C
>> inliner which is far easier than an Assembly inliner (see AsmJIT) I also
>> found TinyC
>>
>
> The first thing to test is if TinyC is actually faster than Pharo.
>
> Stephan
>
>
>
>


Re: [Pharo-users] I wish there were ePUB versions of Pharo books

2016-02-26 Thread Clément Bera
Alternatively, convertor from pdf to epub are available and free. Pillar
can generate pdf.

I know converting does not produce a file as good as if there were a pillar
exporter, but that's a good enough temporary solution to me.



2016-02-25 22:54 GMT+01:00 stepharo :

> Hi martin
>
> Why don't you give a try?
> Pillar has
> - a nice document
> - some nice visitors
> - nice test system
> So someone can extend it.
> Because we cannot do everything. You cannot imagine how we are busy right
> now.
> Stef
>
> Le 25/2/16 19:04, MartinW a écrit :
>
> I like Pharo's new book site: http://files.pharo.org/books/
>>
>> And since I use a tablet more often, I wish there were ePUB versions of
>> the
>> books.
>>
>> Why is it important?
>> You could change the color scheme to light text on dark background and
>> increase font sizes and thus have a much more comfortable reading
>> experience
>> than with PDFs.
>>
>> I remember there was some talk about this some time ago.
>>
>> Best regards,
>> Martin.
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/I-wish-there-were-ePUB-versions-of-Pharo-books-tp4880836.html
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>>
>>
>>
>
>


Re: [Pharo-users] Compiling Pharo to C++

2016-02-16 Thread Clément Bera
Ok.

Then I guess you can do something like Slang, which is used for the VM.
Slang is a restrictive Smalltalk compiling to C.

The slang compiler parses the code using the Smalltalk Compiler parser,
then translate the Smalltalk AST to its own AST, do some manipulation based
on pragmas available in Slang methods and inlines different things based on
a closed world (you can know what method is called at each send site) /
frozen state assumptions (The value of literal variable will not change).

Some selectors are specifically mapped to C instructions / macros, for
example #cppIf:ifTrue: maps to #IFDEF, or bitShift: maps to signed long
bitShift. Comment are translated from Smalltalk to C and they are really
useful.

Another interesting thing is that due to inlining part of the allocation /
deallocation can be avoided.

You can't really use Slang directly as its implementation is tied with the
VM (each time we have a slang bug in the vm code, we choose to either
change the slang compiler or the slang code depending on how much work is
each task).

I am not saying that slang is a nice language and that you should do
something similar. Slang is horrible. But in the case of the VM is has some
significant advantages over C++ and method templates.






2016-02-16 11:30 GMT+01:00 kilon.alios :

> "Hi Kilon,
>
> the way your are explaining it, it seems you are trying to build a
> Smalltalk-like syntax in C++ via templates?
>
> It could make moving a software architecture from Smalltalk to C++
> significantly easier (and open maybe some opportunities).
>
> Thierry"
>
> Bingo ! You get it !
>
> Thats what is all about about moving code from Pharo to C++ and NOT
> reimplementing Pharo in C++ as some people assumed. Yes if I can go for
> smalltalk-syntax that would be a fair compromise, ideally i want to keep
> Pharo syntax intact and introduce C++ features like static types , pointers
> etc through the use of pharo objects.
>
> For example I can make an object to represent a C++ int, what stops me from
> taking pharo class variable make it initialise with that int object then
> later on use a string instead ?
>
> Nothing, my compiler wont even complain, but when you turn it to C++ code
> and try to compile it you will get C++ errors.
>
> On the subject of templates, again there wont be magical transormation of
> dynamic types to C++ templates at least not in the start since C++ expect
> to
> be explicity about the use of a template that will carry on to my tool as
> well. That means that the pharo code will have to be explicit and leave
> nothing to chance like a C++ coder does.
>
> Essentially you coding C++ using pharo syntax or pharo like syntax
> depending
> on how succesful I will be with this. Also creating readable code is a must
> do.
>
> For example I have taken a look at chicken and gambit scheme that take
> scheme (lisp variant) and turn to C and then call the c compiler to make
> the
> machine code executable. The problem is that C code is unreeadable because
> it tries to emulate dynamic types etc. My goal is so not to retain Pharo
> features and dynamism but rather to produce C++ that is not only readable
> but proper C++ code with comments , good names, etc.
>
> My thinking however is like this:
>
> 1) Prototype in Pharo and make sure it works well using all the features
> and
> tools of pharo (dynamic types, GC, live coding, live debugging etc)
> 2) convert your code to my language that looks a lot like pharo but with
> all
> the C++ features leaving no ambiguities for the compiler
> 3) use my compiler to turn a specific fragment of code to C++
> 4) go back to to (1)
> 3)
>
>
>
> --
> View this message in context:
> http://forum.world.st/Compiling-Pharo-to-C-tp485p4877838.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] Compiling Pharo to C++

2016-02-16 Thread Clément Bera
Are you sure C++ compilation is the best way ? There are a lot of flaws:
Smalltalk needs to be restrictive or will be compiled to very slow code,
you will loose debugging features, etc.

I would try to integrate Pharo the same way lua is integrated in engines
like Source2 from valve: you run your Unreal engine and have it call Pharo
as a scripting language to code some features. In such case, one needs to
make the VM embeddable in a C++ app, but on the vm-dev mailing list people
can help you to do so. Then you need to define some APIs based on what
exist in the interpreter proxy to easily call Pharo methods and share
struct / objects from C++. Lastly, you may consider adding a few settings
in FFI. By default the Smalltalk stack and the C stack are separated to to
Smalltalk specific stack page handling. I guess with some annotation in
Pharo API code called from C++ you could define the case where the stack
could be shared or not.

While compiling to C++, how to you plan your compiler to manage memory ?


2016-02-16 9:52 GMT+01:00 kilon.alios :

> So doing further research into Unreal , I have reached the conclusion that
> the best way to integrate Pharo is make a compiler that takes Pharo code
> and
> compiles it to C++.
>
> I have barely scratch such area when I was playing around with Pharo AST
> nodes. Any advice / ideas how to accomplish this ?
>
> Currently my goal is to start super simple, with compiling small pharo code
> fragments to C++ code and then much later on even introduce extensions to
> the pharo language to accommodate for C++ features like templates ,
> pointers
> (FFI probably already cover this) , static types etc. Obviously if I can
> keep the pharo syntax intact would be the ideal option.
>
>
>
> --
> View this message in context:
> http://forum.world.st/Compiling-Pharo-to-C-tp485.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] Recommended VM on Raspberry Pi ?

2016-02-13 Thread Clément Bera
Hello Sven,

You can use the VM with the JIT on the Pie now (Spur Cog VM). It is
deployed by default on the recent raspberry pis and has millions of users
for Squeak and Scratch since August 2015 (the raspberry pie fondation paid
Tim for the ARM JIT on the Cog because of the size of their user base).

As far as I know there is no way to build it in the Pharo VM branch. Just
pick a version compiled from the trunk, that should work fine with the
latest Pharo 5 (note that it requires a Spur image, so it needs one of the
latest Pharo 5). Here is where you can get it:
http://www.mirandabanda.org/files/Cog/VM/VM.r3427/cogspurlinuxhtARM-15.33.3427.tgz


Now even with performance improvement of the VM, some people reported that
the UI of the Pharo image is too slow to be usable on the raspberry pi 1
(Nautilus takes *many* seconds to open for example, same for GT tools). Try
and report your experience.

On many benchs, the JIT VM for the pie has been reported on average 3 to 5x
faster than the Stack VM. Note that the new FFI, even if it reuses the VM
FFI backend, is dependent on x86, hence you need to use the old FFI syntax
to have it working on the raspberry pie (there is some code to load in the
image to do so).

Have fun and report your experience with the raspberry pi and Pharo please,

Clement


2016-02-12 23:05 GMT+01:00 Sven Van Caekenberghe :

> Hi,
>
> I have been using the PharoS VM for a Pharo 4 based app on Raspberry Pi
> (Rasbian).
>
> This VM is quite slow.
>
> Now that Pharo 5 is Spur based, what is the recommended VM on that
> platform ?
>
> I was hoping to use a faster VM, if that is available.
>
> Is anyone having some concrete experience in this area ?
>
> Thx,
>
> Sven
>
>
>


Re: [Pharo-users] OS(Sub)Process on Raspberry Pi ?

2016-02-13 Thread Clément Bera
The latest FFI uses the old VM FFI which works on x86 and ARM and a new
front-end which is seemingly x86 dependent.

So OSSubProcess will work if you use FFI, but the old syntax not the new
one.

2016-02-13 0:23 GMT+01:00 Mariano Martinez Peck :

> Hi Sven,
>
> Since OSSubprocess uses the latest FFI, it works only in Pharo 5.0 AND
> Spur (and after certain Pharo 5.0 release). So you should grab latest
> Spur-based Pharo 5.0 for OSSubprocess.
>
> Since Raspbian is based on Debian, I guess it should work (OSSubprocess
> uses libc), but I cannot tell as I don't have a Raspberry Pi here.
>
> If you get a Spur based Pharo 5.0 image and VM working in Raspberry Pi I
> can help you to see if it works.
>
> Let me know,
>
>
> On Fri, Feb 12, 2016 at 6:59 PM, Sven Van Caekenberghe 
> wrote:
>
>> Hi,
>>
>> What is the state of OS(Sub)Process on Raspberry Pi ?
>>
>> I want a Pharo application to be able to execute some (simple, no IO) OS
>> commands on Raspbian. Can that be done ? Does it work for Pharo 4, 5 ? What
>> should I load ?
>>
>> Thx,
>>
>> Sven
>>
>>
>>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>


Re: [Pharo-users] stupid spur question

2016-02-02 Thread Clément Bera
Hello,

Both classes (SmallFloat64 and BoxedFloat64) are present on 32 bits and 64
bits by default right now. The code base is common between 32 and 64 bit
images. It is possible to run a 32 bit image without the class
SmallFloat64, but it is not the default behavior. There are no instances of
SmallFloat64 in 32 bits and there can't be any. There are details, such as
the SmallFloat64 class needs to be present to convert a 32 bit image to 64
bits with the offline converter and if the code base remains common between
32 and 64 bit images, then the specialObjectsArray will hold a reference to
SmallFloat64 which needs to be updated if one removes the SmallFloat64
class.

For servers and desktop application it does not really make sense any more
to remove these classes in 32 bits as they represent very few kb compared
to Gb of RAM for laptops and Tb for servers. The Smalltalk image is already
much smaller than let's say, the JVM default runtime. In addition, most
computers are 64 bits now so it usually does not make sense to release in
32 bits.

On embedded devices, one can consider deploying without classes such as
SmallFloat64 or LargeInteger to minimize the memory footprint. The support
for such feature is not very good currently, but it is getting slowly
better. It could make sense to remove such classes if you are targeting a
connected object with let's say an ARM Cortex-M4. This is part of a larger
problem which consists in making the Pharo Kernel modular so that we can
load only part of it in specific contexts to save memory or to reduce the
system capabilities.


2016-02-02 14:43 GMT+01:00 Werner Kassens :

> On 02/02/2016 02:30 PM, Sven Van Caekenberghe wrote:
>
>> Maybe those classes could exist in a 32-bit image as empty subclasses of
>> float ?
>>
> that is, what i hope 
>
> werner
>
>


Re: [Pharo-users] OSWindowSDL2

2016-01-24 Thread Clément Bera
Yeah I did in in early version of Pharo 5 (50155).

2016-01-24 10:10 GMT+01:00 stepharo :

> the support for SDL2.0 should be better in Pharo50 (even if due to ffi
> changes and new objcte format we may have some
> glitches).
>
>
> Le 23/1/16 22:45, Edwin Ancaer a écrit :
>
>> I'm not a smalltalk expert, but from time to time I like to do some
>> experiments.
>>
>> Recently, we talked about making a small 2D-Game, to do something else
>> than  a traditional CRUD database application.
>>
>
> cool
> you can ask clement bera because he did a bomberman using SDL2 now I guess
> that it was in Pharo 50.
>
>
>> I downloaded  pharo 4.0 for Linux (the default version).  My OS version
>> is 3.13.0-46-generic #79-Ubuntu:
>>
>> Then I installed SDL2 with apt-get. All seemed to he OK.
>>
>> I started pharo, and executed  the following code in the playground:
>>
>> |ex |
>> ex := SDL2Example new .
>> ex osWindow .
>>
>> I got an error: Failed to find SDL2 library.
>> ,
>> Should I have been doing some extra initialization to load the library in
>> Pharo, or is there something else that I forgot to do?
>>
>> Kind regards
>>
>> Edwin
>>
>>
>
>


Re: [Pharo-users] Failling Tests are green if BlockCannotReturn exception

2016-01-11 Thread Clément Bera
2016-01-12 0:40 GMT+01:00 Vincent BLONDEAU <
vincent.blond...@polytech-lille.net>:

> Hi,
>
>
>
> It is expected.
>
> When you evaluate a block with a return, the method containing the block
> definition (here testBlock) will return.
>
> So the test will pass.
>
>
>
> BTW, you don’t need to put a return in a block. By default, the last
> instruction will be returned.
>
>
>

[ ^ 1 ] => non local return
[ 1 ] => local return

The 2 blocks are very different from each other. One returns to the closure
activation sender, while the other returns to the closure creating context
sender.

See the chapter 14.4 Returning from inside a Block from the free book Deep
Into Pharo 

So I would not say you don't need to put a return in a block. You want to
put a return or not depending on the behavior you want.



> Cheers,
>
> Vincent
>
>
>
> *From:* Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] *On
> Behalf Of *abdelghani ALIDRA
> *Sent:* mardi 12 janvier 2016 00:26
> *To:* Any Question About Pharo Is Welcome
> *Subject:* [Pharo-users] Failling Tests are green if BlockCannotReturn
> exception
>
>
>
> Hi,
>
>
>
> I observed this unexpected behavior in test classes.
>
> In a test class define a method :
>
>
>
>
>
>
>
> *testBlock|aBlock|aBlock := [ ^1 ].aBlock value.self
> assert: false.*
>
>
>
> Althought the assertion is false at the end of the test, the test is green.
>
> Actually, It does not matter what you put after *aBlock value*, the test
> always succedes (I tried to put a self halt, it does not execute)
>
> I tried this both in Pharo 4 and 5 under Windows and MacOS.
>
>
>
> Any ideas?
>
>
>
> Cheers
>
> Abdelghani
>
>
>
>
>


Re: [Pharo-users] Block that doesn't leak memory

2015-12-27 Thread Clément Bera
There is no way of creating such blocks currently.

In fact only non local returns and debugging are problems as remote
variables are accessed through an indirection. A lightweight block (to
reuse your terms) with no outer context but accesses to remote temporary
variables would work fine.

The common terminology is as follow:
- Blocks are called clean blocks if there are no remote temporary variable
access and no outer context references
- They're called copying block if there are remote temporary access but
still no outer context
- They're called full blocks if they have an outer context (One can
sometimes distinguish also full and fullcopying blocks, but it does not
matter)

Pharo supports only full blocks, on the contrary to other smalltalk such as
VW. I did a working implementation of clean blocks, as you describe, but I
didn't integrate it because I didn't like loosing part of the debugging
features. That was years ago I am not sure I can find the code anymore. I
can explain the design though as it's pretty straightforward.

To implement such blocks, you need to share a fake outerContext between all
the clean blocks created in the same method. You can't have nil as an outer
context else the VM behaves badly. Instead of the block creation bytecode,
you can use the pushLiteral instruction to push the BlockClosure created at
compilation time and stored in the literal frame of the method. You can put
the bytecode of clean blocks at the end of the bytecode zone of the method,
followed by a returnTop instruction at the end (without the return
instruction the JIT is confused on where the end of the bytecoded method
is). Let me know if you want to implement that I can help. I still think it
should be an external library and not in the base Pharo though for
debugging purpose.

To solve your problem of moving blocks around, it may also be possible to
use ephemerons to remove the dependency. Maybe some ephemeron experts can
help you there.

2015-12-26 16:47 GMT+01:00 webwarrior :

> BlockClosure objects hold reference to object that created them via
> outerContext receiver. This can cause memory leaks when moving blocks
> around/deepcopying/serializing.
>
> Is there a way to get "lightweight" block that has empty outerContext (like
> when executing code in Playground) or is there another class for such
> "lightweight" blocks somewhere?
>
> Obviously I'm talking about blocks that don't reference variables in
> enclosing scope and don't do nonlocal return.
>
>
>
> --
> View this message in context:
> http://forum.world.st/Block-that-doesn-t-leak-memory-tp4868529.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] [Question] Inspecting a collection of strings in Pharo 5 -- edit pane for a string?

2015-12-20 Thread Clément Bera
2015-12-20 8:15 GMT+01:00 Marcus Denker :

>
>
> On Sat, Dec 19, 2015 at 9:24 PM, Tudor Girba  wrote:
>
>> Hi,
>>
>> Strings are supposed to be immutable, and that is why we do not support
>> editing by default :).
>>
>>
> I do not think this is good... yes, it would be nice if *literal* strings
> *would* be immutable, but they are not.
>

Actually, that is something I work on and that should be the case in the
incoming months. All literals will be immutable by default, except if you
explicitly ask the compiler to compile mutable literals.


> The tools should not put artificial constraints on the language model.
> Strings can be changed, so the inspector
> has to allow that. It is a debugging tool, after all...
>
>
Agreed, the strings should be able to be changed, if they are immutable you
will have a runtime error anyway.


> Marcus
>


Re: [Pharo-users] Installation

2015-12-02 Thread Clément Bera
Have you tried this (from this page:
http://pharo.org/gnu-linux-installation#ubuntu-ppa-headless-vm ):
Ubuntu (ppa)

Ubuntu users can use the dedicated ppa to install Pharo in various ways:
Install the headless Pharo VM only

sudo add-apt-repository ppa:pharo/stable
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install pharo-vm-core

Install PharoLauncher
,
our experimental new GUI Dashboard

sudo add-apt-repository ppa:pharo/stable
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install pharo-launcher


   - If you don't have the add-apt-repository command, google
    is your
   best bet as getting it varies by distribution version
   - For reference, the ppa page on launchpad.net
   



2015-12-02 17:26 GMT+01:00 Rodrigo Coimbra <
rodrigotavarescoim...@yahoo.com.br>:

> How do I definitely install Pharo on Ubuntu 15.04?
>


Re: [Pharo-users] How to play audio files with Pharo ?

2015-11-18 Thread Clément Bera
PharoSound was not working on Mac on my machine a few month ago. It was
reported to be working on the Raspberry Pie and windows.

2015-11-18 12:23 GMT-03:00 Merwan Ouddane :

> This summer I made a wav parser, there is an example to play wav files
> with OpenAL.
>
> https://pharoweekly.wordpress.com/2015/08/23/wav-parser-available/
>
> Cheers,
> Merwan
>
>
> On 18/11/2015 15:49, Dimitris Chloupis wrote:
>
>> I want a cross platform solution for playing audio files for my project
>> ChronosManager. By cross platform I mean MacOS, Ubuntu and Windoom.
>>
>> I assume that playback of MP3 is out of the question ?
>>
>> Any ideas /suggestions ?
>>
>
>
>


Re: [Pharo-users] Woden?

2015-07-18 Thread Clément Bera
Hello,

You can try to reload ConfigurationOfOSWindow or try to get the latest
ConfigurationOfOSWindow then load the bleeding edge, that might be it.

Else for the #doSemanticAnalysisIn: you can try to flush the ASTCache (I
think it's "ASTCache rest")

Have fun

2015-07-18 17:54 GMT+02:00 Hilaire :

> Hi,
> I want to make a demo of woden.
> But does not work, and I don't know why.
>
> Installed version from Smalltalkhub following instruction found there,
> or download directly an image from jenkins, in both case I have error
> when executing:
>
> WDFPSSimpleExample13 new open
>
> MNU: receiver #doSemanticAnalysisIn: is nil
>
> Thanks
>
> Hilaire
>
>
> PS: the Woden classes are almost completely uncommented!
>
> --
> Dr. Geo
> http://drgeo.eu
> http://google.com/+DrgeoEu
>
>
>
>


Re: [Pharo-users] PharoJS

2015-07-15 Thread Clément Bera
2015-07-15 12:34 GMT+02:00 Sean P. DeNigris :

> Noury Bouraqadi-2 wrote
> > Regarding the naming PharoJS is more than a bridge. It allows:
> > -Develop and test apps in Pharo
> > -Generate a javascript file for a standalone app
>
> How does it compare to Amber? Similar use case?
>
>
The resulting application is the same in PharoJS and Amber, you have
javascript files to deploy only and no dependence with Smalltalk, so I'd
say similar use-cases for sure.

I've just tried PharoJS and the main difference with Amber is that you
develop from Pharo instead of from the browser, allowing to reuse the Pharo
IDE for development instead of building a new one. In fact it is the same
as Amber's sub-project Nemo where you develop in Amber from Pharo.

Why doesn't PharoJS use the Amber compiler to compile from Smalltalk to
javascript and the Amber kernel to map native Javascript objects ? Amber's
compiler and JS kernel were polished and optimized during years, I don't
understand why you need to do it again ...

It's really nice to be able to develop and commit from Pharo.


>
> -
> Cheers,
> Sean
> --
> View this message in context:
> http://forum.world.st/PharoJS-tp4837593p4837621.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] PharoJS

2015-07-14 Thread Clément Bera
What is PharoJS ? Are you talking about Pharo on top of the Bert's SqueakJS
VM ?

If so, it starts, but some primitives fail making it freeze after a short
while as you describe.

It would be fun to have it running even though most of the Pharo folks went
into the Amber direction for Pharo on Javascript.

2015-07-14 19:46 GMT+02:00 Esteban A. Maringolo :

> Where can I download it?
>
> Regards!
>
> Esteban A. Maringolo
>
> 2015-07-13 22:26 GMT-03:00 Andy Burnett :
>
>> Is anyone experimenting with PharoJS?
>>
>> I managed to get the page with the core javascript functions to load - as
>> localhost - but I couldn't get any of the actions in the workspace to have
>> any effect on the web browser console.
>>
>> Has anyone had any success?
>>
>> Cheers
>> Andy
>>
>
>


Re: [Pharo-users] Slow compilation on one of my Windows PCs

2015-06-29 Thread Clément Bera
What about "1 tinyBenchmarks" ?

Just to know if the VM is slower as a whole or only compilation / source
access ?

2015-06-30 0:36 GMT+02:00 Jan Blizničenko :

> And one another benchmark of linux in VM on that desktop PC:
> Roassal loading - 58 s
> compilations per second - avg: 262.4682, min: 257.194, max: 289.684
> ...so the desktop PC is capable of better result and problem is somewhere
> in
> Windows, which I was afraid of...
>
> I'd also like to add to previous Windows tests that with antivirus turned
> on
> everything takes more time approximately by half of original time.
>
> Jan
>
>
> Jan Blizničenko wrote
> > Desktop: 386 s.
> > Notebook: 48 s.
> > Linux in VM on notebook: 27 s.
> >
> >
> > Notebook: compilations per second - avg: 217.7153, min: 5.0, max: 247.258
> > Desktop: compilations per second - avg: 23.1337, min: 19.448, max: 28.155
> > Linux in VM on notebook: compilations per second - avg:
> 529.006660001,
> > min: 5.0, max: 573.97
>
>
>
>
>
> --
> View this message in context:
> http://forum.world.st/Slow-compilation-on-one-of-my-Windows-PCs-tp4834668p4834713.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] Silent compilation

2015-05-19 Thread Clément Bera
Silent compilation is when the compilation is done without telling any
other objects.

In the regular compilation of a method, for example, you tell all the class
browsers opened that the method was compiled so that if a class browser
shows an old version of the same method it is refreshed to show the new
version. If you use silent compilation, the class browsers won't be updated.

Silent compilation can be used in specific frameworks that wants to edit
the methods without the tools to be aware, for example, when you do
bytecode manipulation, which does not change the source code of methods,
and that the bytecode manipulation is done frequently so that you don't
want the overhead of the tool updates.

2015-05-19 12:55 GMT+02:00 Sergio Fedi :

> Hi guys,
>
> What is a silent compilation?
>
> When should it be used?
>


Re: [Pharo-users] questionable questionable code critic

2015-04-24 Thread Clément Bera
Code critics relies on simple rules, such as the use of the selector
#isKindOf: .

It does not detect the second case because the rule is simple, though both
are questionable.

Best,

2015-04-24 18:24 GMT+02:00 Peter Uhnák :

> Why does CodeCritic (QualityAssistant) considers this questionable
>
> 
> canBeTargetFor: aController
> ^ aController isKindOf: DMNodeController
> 
>
> and yet this seems fine to him
>
> 
> canBeTargetFor: aController
> ^ aController class = DMNodeController
> 
>
> shouldn't it be the same?
>
> Peter
>


Re: [Pharo-users] Bytecodes in Nautilus

2015-04-01 Thread Clément Bera
Seemingly, UI-wise, it was not good to have a button for the bytecode.

As I use it al the time, I reintroduced it in the menu and you can use the
shortcut Cmd+b+b, which reportedly was better.

In other IDE tools that nautilus you can't see anymore the bytecodes though.

2015-04-01 8:06 GMT-07:00 Sean P. DeNigris :

> Hmm... I found it in the method pane's context menu. What is the rationale
> for the change?
>
>
>
> -
> Cheers,
> Sean
> --
> View this message in context:
> http://forum.world.st/Bytecodes-in-Nautilus-tp4816678p4816679.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] Proxies: Subclassing nil

2015-03-31 Thread Clément Bera
Hey Sean,

Now to create a proxy you need to subclass ProtoObject and not nil.

This was changed years ago to avoid some issues. An example of issue that
existed: when you subclass nil, as
#doesNotUnderstand: is not implemented by default on your proxy, any proxy
created receiving a message would crash the VM if you had not overridded
#doesNotUnderstand:. Another example is that when you iterate over memory
using #nextObject, if the proxy does not answer it you can end with severe
VM crashes. In these examples I am talking about the expected VM behavior
and not about bugs.

So basically the purpose of ProtoObject was to limit the number of VM
crashes when playing with proxies / ProtoObjects, instead having a default
behavior for several messages such as #doesNotUnderstand: or nextObject.

Note that the IDE support for ProtoObject is limited as ProtoObject API is
very restricted so it does not have methods such as #inspect, ... That's
also on purpose because Proxies may not implement introspection methods.





2015-03-31 14:53 GMT-07:00 Sean P. DeNigris :

> Denis Kudriashov wrote
> > http://smalltalkhub.com/#!/~CAR/Ghost/ or
> http://ss3.gemstone.com/ss/Ghost
>
> Thanks, Denis! I'll check it out. I'm not sure which repo either. Mariano's
> commits are all in both places, but there seems to be some parallel
> development after that...
>
>
>
> -
> Cheers,
> Sean
> --
> View this message in context:
> http://forum.world.st/Proxies-Subclassing-nil-tp4816443p4816503.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] topics.pharo.org - Deep learning

2015-03-27 Thread Clément Bera
Hello,

I believe that topics related to robotics are supervised by Noury Bouraqadi
and / or Luc Fabresse.

I think you should ask them for more information.

You can find their mail on their web page (just type their names on google)

Good luck,

Clement



2015-03-27 9:51 GMT+01:00 Damien Cassou :

> Hi Julien,
>
> Julien Delplanque  writes:
>
> > I'm currently searching for a subject for a project to do during my
> > first year of master. I want to do something that is linked to pharo.
> > Following Stéphane Ducasse advises, I had a look in topics.pharo.org
> > and I saw a subject that could interest me named "Deep learning". But
> > there is no supervisor.
>
>
> I think you will get more feedback if you put the topic content in the
> thread:
>
> Robotics, drones and the internet of things will gather data from
> sensors that will need interpretation and modelling. All sorts of AI
> will use deep learning techniques and Pharo would be a great
> orchestrator of that modelling.
>
> http://www.quora.com/What-is-the-best-deep-learning-library-at-the-current-stage-for-working-on-large-data
>
>
> I don't know anything about that topic but I could supervise you on
> topics related to either the Pharo Launcher or Pillar (or anything else
> where my name is written in http://topics.pharo.org/):
>
> - http://www.smalltalkhub.com/#!/~Pharo/PharoLauncher
> - http://www.smalltalkhub.com/#!/~Pier/Pillar
>
> --
> Damien Cassou
> http://damiencassou.seasidehosting.st
>
> "Success is the ability to go from one failure to another without
> losing enthusiasm." --Winston Churchill
>
>


Re: [Pharo-users] Fwd: [Pharo Consortium] Your organization application has been rejected.

2015-03-03 Thread Clément Bera
Well, this year google it looks like accepted less organizations.

2012: 180 organizations accepted.
2013: 177 organizations accepted.
2014: 190 organizations accepted.
2015: 137 organizations accepted.

A few projects with ESUG could be nice for sure. But there we will have in
the same issues again: typically, a student cannot in 3 months make his
project working for all existing smalltalk, ...

2015-03-03 9:12 GMT+01:00 Joachim Tuchel :

> Bad news. I am eager to hear if there is something to learn from their
> feedback.
>
> Now that both ESUG and Pharo have been rejected two years in a row, maybe
> it is time to think about ways to revive, or re-promote, the ESUG
> initiatives to sponsor student projects.
>
> Joachim
>
> Am 03.03.2015 08:59 schrieb Serge Stinckwich :
> >
> > Bad news from Google ...
> > We will ask some explanations with Uko.
> >
> >
> > -- Forwarded message --
> > From:  
> > Date: Mon, Mar 2, 2015 at 7:56 PM
> > Subject: [Pharo Consortium] Your organization application has been
> rejected.
> > To: serge.stinckw...@gmail.com
> >
> >
> > Thank you for submitting Pharo Consortium's application to Google
> > Summer of Code 2015. Unfortunately, we were unable to accept your
> > organization's application at this time. Every year we receive many
> > more applications than we are able to accommodate, and we would
> > encourage you to reapply for future instances of the program.
> >
> > If you would like some general feedback on why your organization was
> > not accepted, please consider attending the IRC meeting in #gsoc on
> > Freenode on Friday, 6 March, 2015 at 16:00 UTC. Please note that the
> > feedback meeting will be limited to the first 50 organizations to
> > queue up (queuing in the channel will begin at 15:30 UTC). You are
> > also more than welcome to just email the OSPO team at
> > ospot...@gmail.com directly for email feedback about your application
> > as well.
> >
> > Best regards,
> >
> >
> > --
> > Serge Stinckwich
> > UCBN & UMI UMMISCO 209 (IRD/UPMC)
> > Every DSL ends up being Smalltalk
> > http://www.doesnotunderstand.org/
> >
> >
>


Re: [Pharo-users] i feel dumb / Pharo3 > OrderedCollection >> do:

2015-02-20 Thread Clément Bera
It depends on your OrderedCollection implementation.

OrderedCollection has a variable size in memory. When instantiated, it has
for example 10 slots, and if you have more than 10 objects, it needs to
change its size to hold more slots.

The current implementation relies on an indirection to an array, when the
array overflows, the orderedCollection allocates a new bigger array and
copy the slots from the existing array. There are some heuristics on array
size to avoid having to grow the array too often.

If you want the shallowCopy to work, you have to use the old implementation
of OrderedCollection, which encodes in its field directly the values it
holds. In this case however when the collection overflows you create a new
orderedCollection so you need to use #become: to migrate references to the
old orderedCollection to the new one. This used to be a bad idea because
the become primitive was slow, but since we have Spur, it may be relevant
to look at it again. This old implementation is more memory efficient too.

2015-02-20 8:05 GMT+01:00 Marcus Denker :

>
> On 20 Feb 2015, at 06:23, S Krish 
> wrote:
>
>
> I presumed shallowCopy for literal arrays / OrderedCollection should have
> been a true copy. Perhaps need to understand this..
>
>
> OrderdCollection is not just one object, but it holds on to an Array that
> has it’s content. You copy the outside collection object, but share
> the Array.
>
> shallowCopy
> "Answer a copy of the receiver which shares the receiver's instance
> variables. It should never be overridden. I'm invoked from the copy
> template method. Subclasses that need to specialize the copy should
> specialize the postCopy hook method."
>...
> 
> class := self class.
> class isVariable
> ifTrue:
> [...   newObject :=* class basicNew: index*. ]
> ifFalse: [newObject := *class basicNew*].
> ..
> whileTrue:
> [newObject instVarAt: index put: (self instVarAt: index).
>...
> ^ newObject
>
> On Wed, Feb 18, 2015 at 10:52 PM, Marcus Denker 
> wrote:
>
>>
>> On 18 Feb 2015, at 18:13, Cameron Sanders via Pharo-users <
>> pharo-users@lists.pharo.org> wrote:
>>
>>
>> *Date: *18 Feb 2015 18:12:33 CET
>> *Subject: **i feel dumb / Pharo3 > OrderedCollection >> do:*
>> *From: *Cameron Sanders 
>> *To: *Any question about pharo is welcome 
>>
>>
>> I must be making some silly error here that i cannot see clearly. Why
>> does the following leave anything in the list 'a'? Run it in a workspace.
>> With or without the shallowCopy, i am left with a list with half of the
>> elements in it. Always half.
>>
>> This version of Pharo3 (21.0) was downloaded last week. I am running on a
>> Mac.
>>
>> Thanks in advance. ... Maybe I just need more coffee.
>> -Cam
>>
>> | a  |
>> a := {  #a. #b. #c. #d. } asOrderedCollection.
>> a shallowCopy do: [ :item | (a includes: item) ifTrue: [ a remove: item
>> ]].
>> a size
>>
>>
>> shallowCopy is not enough… OrderedCollection is made up of an internal
>> array.
>>
>> #copy does the right thing, just copies the array:
>>
>> postCopy
>> array := array copy
>>
>> and for Array, copy is a shallowCopy.
>>
>> Marcus
>>
>>
>>
>>
>
>


Re: [Pharo-users] What happens to saved inspectors?

2015-02-18 Thread Clément Bera
Hey,

Inspectors are different between Moose and Pharo 3. Can you precise, are
you using the Glamour inspector, the EyeInspector or the old Morphic
inspector ?

I have never seen that in Pharo. Are your titles dynamic (I mean, when the
object changes, can your title change ?) ?

2015-02-18 11:35 GMT+01:00 PBKResearch :

> Hello
>
>
>
> I am using Moose 5, which is essentially Pharo 3, downloaded late December
> 2014. I have a development project which mainly consists of a collection of
> workspaces and inspectors (I really do intend to turn it into a properly
> structured set of classes one day!). I have noticed that, whenever I save
> an image with some inspectors open and then reopen the image, the title
> bars of the inspectors have become red rectangles with a cross
> superimposed. Often I can work out what the title should be and carry on,
> but in many cases all I can do is close down the inspector and reopen it.
> Is this a known problem, and is there any way to work round it?
>
>
>
> Thanks for any help
>
>
>
> Peter Kenny
>


Re: [Pharo-users] Small benchmark

2015-02-17 Thread Clément Bera
2015-02-17 12:29 GMT+01:00 Andrea Ferretti :

> Unfortunately, I was not able to run the benchmark at all on the
> latest Spur image+VM.
>
> As soon as I try writing anything in the Workspace, I get
> PrimitiveFailed: primitive #basicNew: in Array class failed. Since the
> stacktrace mentions font rendering, I thought it had something to do
> with the fonts not loaded and tried
>
> FreeTypeFontProvider current updateFromSystem
>
> (at least, I was able to paste it) but it seems it has nothing to do
> with it. For the records, I am on Ubuntu 14.04 running gnome shell.
>

I am on Mac OS X 10.8 and it works for me.

I had once this bug but when I reopened the Workspace it did not happen
again and I could not reproduce it anymore.

Well this VM is an alpha version. Esteban is changing it very often so a
bug may have been introduced. The stable release should work better for
sure...

>
> Looking forward to the next stable release!
>
> thank you again
> Andrea
>
>
> 2015-02-17 11:54 GMT+01:00 Andrea Ferretti :
> > Thank you for the quick response! I will try what I get from the 4.0
> > VM, and of course publish the updated result once Pharo4 is out.
> >
> > Of course, you can add the benchmark and tweak it for your needs.
> >
> > Thank you for all the good work you are doing! Reaching a speed near
> > pypy would be a real game changer!
> >
> > 2015-02-17 11:24 GMT+01:00 Sven Van Caekenberghe :
> >>
> >>> On 17 Feb 2015, at 11:06, Clément Bera  wrote:
> >>>
> >>> Hello Andrea,
> >>>
> >>> The way you wrote you algorithm is nice but makes extensive use of
> closures and iterates a lot over collections.
> >>
> >> I was about to say the same thing.
> >>
> >>> Those are two aspects where the performance of Pharo have issues.
> Eliot Miranda and myself are working especially on those 2 cases to improve
> Pharo performance. If you don't mind, I will add your algorithm to the
> benchmarks we use because it really makes extensive uses of cases we are
> trying to optimize so its results on the bleeding edge VM are very
> encouraging.
> >>>
> >>>
> >>> About your implementation, someone familiar with Pharo may change
> #timesRepeat: by #to:do: in the 2 places you use it.
> >>>
> >>> For example:
> >>> run: points times: times
> >>> 1 to: times do: [ :i | self run: points ].
> >>>
> >>> I don't believe it makes it really harder to read but depending on the
> number of times you're using, it may show some real improvements because
> #to:do: is optimized at compile-time, though I tried and I got a -15% on
> the overall time to run only in the bleeding edge VM.
> >>
> >> That is a lot of difference for such a small change.
> >>
> >>> Another thing is that #groupedBy: is almost never used in the system
> and it's really *not* optimized at all. Maybe another collection protocol
> is better and not less readable, I don't know.
> >>>
> >>>
> >>> Now about solutions:
> >>>
> >>> Firstly, the VM is getting faster.
> >>> The Pharo 4 VM, to be released in July 2015, should be at
> least 2x faster than now. I tried it on your benchmark, and I got 5352.7
> instead of 22629.1 on my machine, which is over x4 performance boost, and
> which put Pharo between factor and clojure performance.
> >>
> >> Super. Thank you, Esteban and of course Eliot for such great work,
> eventually we'll all be better off thanks to these improvements.
> >>
> >>> An alpha release is available here:
> https://ci.inria.fr/pharo/view/4.0-VM-Spur/ . You need to use
> PharoVM-spur32 as a VM and Pharo-spur32 as an image (Yes, the image changed
> too). You should be able to load your code, try your benchmark and have a
> similar result.
> >>
> >> I did a quick test (first time I tried Spur) and code loading was
> spectacularly fast. But the ride is still rough ;-)
> >>
> >>> In addition, we're working on making the VM again much faster
> on benchmarks like yours in Pharo 5. We hope to have an alpha release this
> summer but we don't know if it will be ready for sure. For this second
> step, I'm at a point where I can barely run a bench without a crash, so I
> can't tell right now the exact performance you can expect, but except if
> there's a miracle it should be somewhere between pypy and scala performance
> (It'll reach full performance once it gets more mature and not at first
> release an

Re: [Pharo-users] Small benchmark

2015-02-17 Thread Clément Bera
Hello Andrea,

The way you wrote you algorithm is nice but makes extensive use of closures
and iterates a lot over collections. Those are two aspects where the
performance of Pharo have issues. Eliot Miranda and myself are working
especially on those 2 cases to improve Pharo performance. If you don't
mind, I will add your algorithm to the benchmarks we use because it really
makes extensive uses of cases we are trying to optimize so its results on
the bleeding edge VM are very encouraging.


About your implementation, someone familiar with Pharo may change
#timesRepeat: by #to:do: in the 2 places you use it.

For example:
run: points times: times
   * 1 to: times do:* [ :i | self run: points ].

I don't believe it makes it really harder to read but depending on the
number of times you're using, it may show some real improvements because
#to:do: is optimized at compile-time, though I tried and I got a -15% on
the overall time to run only in the bleeding edge VM.

Another thing is that #groupedBy: is almost never used in the system and
it's really *not* optimized at all. Maybe another collection protocol is
better and not less readable, I don't know.


Now about solutions:

Firstly, the VM is getting faster.
The Pharo 4 VM, to be released in July 2015, should be at least 2x
faster than now. I tried it on your benchmark, and I got 5352.7 instead of
22629.1 on my machine, which is over x4 performance boost, and which put
Pharo between factor and clojure performance. An alpha release is available
here: https://ci.inria.fr/pharo/view/4.0-VM-Spur/ . You need to use
PharoVM-spur32 as a VM and Pharo-spur32 as an image (Yes, the image changed
too). You should be able to load your code, try your benchmark and have a
similar result.
In addition, we're working on making the VM again much faster on
benchmarks like yours in Pharo 5. We hope to have an alpha release this
summer but we don't know if it will be ready for sure. For this second
step, I'm at a point where I can barely run a bench without a crash, so I
can't tell right now the exact performance you can expect, but except if
there's a miracle it should be somewhere between pypy and scala performance
(It'll reach full performance once it gets more mature and not at first
release anyway). Now I don't think we'll reach any time soon the
performance of languages such as nim or rust. They're very different from
Pharo: direct compilation to machine code, many low level types, ... I'm
not even sure a Java implementation could compete with them.

Secondly, you can use bindings to native code instead. I showed here how to
write the code in C and bind it with a simple callout, which may be what
you need for your bench:
https://clementbera.wordpress.com/2013/06/19/optimizing-pharo-to-c-speed-with-nativeboost-ffi/
. Now this way of calling C does not work on the latest VM. There are 3
existing frameworks to call C from Pharo, all having pros and cons, we're
trying to unify them but it's taking time. I believe for the July release
of Pharo 4 there will be an official recommended way of calling C and
that's the one you should use.


I hope I wrote you a satisfying answer :-). I'm glad some people are deeply
interested in Pharo performance.

Best,

Clement



2015-02-17 9:03 GMT+01:00 Andrea Ferretti :

> Hi, a while ago I was evaluating Pharo as a platform for interactive
> data exploration, mining and visualization.
>
> I was fairly impressed by the tools offered by the Pharo distribution,
> but I had a general feeling that the platform was a little slow, so I
> decided to set up a small benchmark, given by an implementation of
> K-means.
>
> The original intention was to compare Pharo to Python (a language that
> is often used in this niche) and Scala (the language that we use in
> production), but since then I have implemented a few other languages
> as well. You can find the benchmark here
>
> https://github.com/andreaferretti/kmeans
>
> Unfortunately, it turns out that Pharo is indeed the slowest among the
> implementations that I have tried. Since I am not an expert on Pharo
> or Smalltalk in general, I am asking advice here to find out if maybe
> I am doing something stupid.
>
> To be clear: the aim is *not* to have an optimized version of Kmeans.
> There are various ways to improve the algorithm that I am using, but I
> am trying to get a feeling for the performance of an algorithm that a
> casual user could implement without much thought while exploring some
> data. So I am not looking for:
>
> - better algorithms
> - clever optimizations, such as, say, invoking native code
>
> I am asking here because there is the real possibility that I am just
> messing something up, and the same naive algorithm, written by someone
> more competent, would show real improvements.
>
> Please, let me know if you find anything
> Best,
> Andrea
>
>


Re: [Pharo-users] Image growing size

2015-02-03 Thread Clément Bera
Hello,

There could be many reasons why you would have such a big image.

The most common reason is the monticello metadata, as Phil said.

Another reason could be because some caches and objects that are flushed on
snapshot, so if you looked at the image size at runtime and not the file
size (for example, the Display object, which is huge, is not in the
snapshot, same thing for the AST cache) it is bigger.

Another reason is that you may have kept persistent some data that refers
to a huge graph of objects /  a lot of objects. In the past, it happened to
me that I kept errors in a collection to be able to debug them after the
program execution (debugging directly the error would crash the image
because it was errors in critical processes), but those errors were
referencing a huge graph of nodes and after several thousands errors the
image was overflowing its 1Gb limit.

So what do you keep persistent in your application ? Does it refer to a lot
of objects without you knowing it ?


2015-02-03 18:31 GMT+01:00 p...@highoctane.be :

> Try to open monticello and select any repo, right click and clear the
> package cache.
>
> If you are using monticello that is.
>
> Also close all windows, open a workspace and do the
>
> 10 timesRepeat: [ Smalltalk garbageCollect].
>
> HTH
> Phil
>  Le 3 févr. 2015 17:49, "Laura Risani"  a écrit :
>
> Hi all,
>>
>> The official image i've downloaded weighted about 40 MB. Now its size is
>> about 200 MB. What is the explanation? Is this normal or have i done
>> something wrong?
>>
>> I haven't been using globals, just downloaded and defined some packages.
>> The only over persistent thing i've done is to keep an instance variable in
>> some classes i wanted to have a unique instance.
>>
>>
>> Best,
>> Laura
>>
>


Re: [Pharo-users] Why single inheritance?

2015-01-28 Thread Clément Bera
2015-01-28 16:41 GMT+01:00 Laura Risani :

> Hi all,
>
> What is the explanation why Smalltalk designers preferred single
> inheritance+traits to multiple inheritance? Why is the former better than
> the latter?
> Do traits let you share state also or only behavior?
>

Traits only share behaviors.

As you guessed, it is still questionable to many people if multiple
inheritance is good because state can be inherited multiple times. For
example, what do happen if C inherits from A and B and that both A and B
have a field name i. There are existing solutions for this problem but
they're all not perfect.

Traits were implemented language-side only. If you want you can implement
multiple inheritance language side only too (as for traits, you'll have to
add virtual copies of methods and if state is shared too you'll have
virtual copies of instance variables to run on our current VM), and see
which one you prefer. I'd be glad to hear your feedback on that.


> Best,
> Laura
>


Re: [Pharo-users] Waiting object

2015-01-27 Thread Clément Bera
Hello,

Or simpler:

1 second wait.

In your example:

Transcript open.
[
10 timesRepeat:[Transcript crShow:(DateAndTime now).
1 second wait]
] fork.


2015-01-27 20:21 GMT+01:00 Nicolai Hess :

>
> 2015-01-27 19:46 GMT+01:00 Laura Risani :
>
>> Hi all,
>>
>> I need an object/method like this one
>>
>> Waiting>> wait : seconds
>> "i take the flow control during 'seconds' without halting image morphs
>> stepping/handling (as Delay>>wait: does) and then return to the sender "
>>
>
> Hi Laura,
>
> Delay>>wait:
> it just halts the image UI (morphs, display update, etc), if you call it
> from the active UI process.
>
> If you want to use "wait", you need to tell "what" should wait.
> You may create your own Process with #fork.  ["your code here"] fork.
>
> For example.
> Transcript open.
> [
> 10 timesRepeat:[Transcript crShow:(DateAndTime now).
> (Delay forSeconds:1) wait]
> ] fork.
>
>
>
>
>
>>
>> How can i implement it?
>> Where can i borrow for reuse an existing one from?
>>
>>
>> Best,
>> Laura
>>
>
>


Re: [Pharo-users] Running Pharo headless

2015-01-21 Thread Clément Bera
2015-01-21 10:31 GMT+01:00 nacho <0800na...@gmail.com>:

> philippeback wrote
> > why running pharo with a squeakvm?
> >
> > I do it, in my Raspberry Pi :p and its slo
>

Actually I think only the UI is slow on the Pi because on the squeak VM
made by Tim he reimplemented differently BitBlt.

Is it also slower in headless ? It shouldn't.


> >
> >
> > I am runnin headless with PharoVM here.
> >
> > Your vm params look like weird.
> >
> > I'll give you a copy of my CLI when I have access to my Pc.
> >
> > Phil
> > Le 21 janv. 2015 03:59, "sergio_101" <
>
> > sergio.rrd@
>
> > > a écrit :
> >
> >> #!/bin/bash
> >>
> >> # settings
> >> USER="badgesoup"
> >> VM="/usr/lib/squeak/4.10.2-2614/squeakvm"
> >> VM_PARAMS="-mmap 256m -vm-sound-null -vm-display-null"
> >> IMAGE="/home/badgesoup/badgesoup_image/Pharo3.0.image"
> >>
> >> # start the vm
> >> exec \
> >> setuidgid "$USER" \
> >> "$VM" $VM_PARAMS "$IMAGE"
> >>
> >> On Tue Jan 20 2015 at 9:32:04 PM Esteban A. Maringolo <
> >>
>
> > emaringolo@
>
> >> wrote:
> >>
> >>> What is in the 'run' file?
> >>>
> >>> Esteban A. Maringolo
> >>>
> >>>
> >>> 2015-01-20 23:26 GMT-03:00 sergio_101 <
>
> > sergio.rrd@
>
> > >:
> >>> > i am ready to put my seaside app online, and am finding that all the
> >>> > information i am finding is outdated.
> >>> >
> >>> > I am running the latest Pharo (as of last night), and ubuntu14.04.
> >>> >
> >>> > when i try to run using squeakvm, i get:
> >>> >
> >>> > $ sudo ./run
> >>> > 'Your VM is too old for this image. Please download the latest VM.'
> >>> > 'Pharo cannot locate the sources file named
> >>> > /usr/lib/squeak/4.10.2-2614/PharoV30.sources.
> >>> >
> >>> > Please check that the file is named properly and is in the
> >>> > same directory as this image.'
> >>> > A PharoCommandLineHandler is x.
> >>> >
> >>> > everywhere i look, the information seems several years old..
> >>> >
> >>> > ideas? thanks!
> >>> >
> >>> >
> >>>
> >>>
>
>
>
>
>
> -
> Nacho
> Smalltalker apprentice.
> Buenos Aires, Argentina.
> --
> View this message in context:
> http://forum.world.st/Running-Pharo-headless-tp4800750p4800768.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] Running Pharo headless

2015-01-21 Thread Clément Bera
2015-01-21 9:29 GMT+01:00 Michal Balda :

>  Hi all,
> is there any difference between -vm-display-null and --no-display (and
> using both)?
>

no-display is deprecated, whereas vm-display-null is not. It does the same
but use vm-display-null or your script will stop working in the future.

>
> I used this command to successfully run a Seaside app on a headless Linux
> server, with a standard Pharo VM (not the Squeak one from the repositories):
>
> ./pharo-vm/pharo \
> -vm-display-null \
> -vm-sound-null \
> --plugins ./pharo-vm \
> --encoding utf8 \
> ./image/Seaside.image \
> --no-quit
>
> Or, to run a script at startup to initialize the app/server:
>
> ./pharo-vm/pharo \
> -vm-display-null \
> -vm-sound-null \
> --plugins ./pharo-vm \
> --encoding utf8 \
> ./image/Seaside.image \
> st ./startServer.st \
> --no-quit
>
> Apart from running it under a limited user/group, it is also possible to
> chroot it for an extra security measure.
>
>
> Michal
>
>
>
>
> On 21.1.2015 09:16, Clément Bera wrote:
>
> Just a detail. When you run headless with the latest pharo-vm (that you
> can download here: http://files.pharo.org/vm/pharo/ in your OS directory,
> file stable.zip), add --no-quit after --no-display in the VM start-up
> options.
>
> 2015-01-21 7:21 GMT+01:00 p...@highoctane.be :
>
>> why running pharo with a squeakvm?
>>
>> I am runnin headless with PharoVM here.
>>
>> Your vm params look like weird.
>>
>> I'll give you a copy of my CLI when I have access to my Pc.
>>
>> Phil
>> Le 21 janv. 2015 03:59, "sergio_101"  a écrit :
>>
>>  #!/bin/bash
>>>
>>>  # settings
>>> USER="badgesoup"
>>> VM="/usr/lib/squeak/4.10.2-2614/squeakvm"
>>> VM_PARAMS="-mmap 256m -vm-sound-null -vm-display-null"
>>> IMAGE="/home/badgesoup/badgesoup_image/Pharo3.0.image"
>>>
>>>  # start the vm
>>> exec \
>>> setuidgid "$USER" \
>>> "$VM" $VM_PARAMS "$IMAGE"
>>>
>>> On Tue Jan 20 2015 at 9:32:04 PM Esteban A. Maringolo <
>>> emaring...@gmail.com> wrote:
>>>
>>>> What is in the 'run' file?
>>>>
>>>> Esteban A. Maringolo
>>>>
>>>>
>>>> 2015-01-20 23:26 GMT-03:00 sergio_101 :
>>>> > i am ready to put my seaside app online, and am finding that all the
>>>> > information i am finding is outdated.
>>>> >
>>>> > I am running the latest Pharo (as of last night), and ubuntu14.04.
>>>> >
>>>> > when i try to run using squeakvm, i get:
>>>> >
>>>> > $ sudo ./run
>>>> > 'Your VM is too old for this image. Please download the latest VM.'
>>>> > 'Pharo cannot locate the sources file named
>>>> > /usr/lib/squeak/4.10.2-2614/PharoV30.sources.
>>>> >
>>>> > Please check that the file is named properly and is in the
>>>> > same directory as this image.'
>>>> > A PharoCommandLineHandler is x.
>>>> >
>>>> > everywhere i look, the information seems several years old..
>>>> >
>>>> > ideas? thanks!
>>>> >
>>>> >
>>>>
>>>>
>
>


Re: [Pharo-users] Running Pharo headless

2015-01-21 Thread Clément Bera
Just a detail. When you run headless with the latest pharo-vm (that you can
download here: http://files.pharo.org/vm/pharo/ in your OS directory, file
stable.zip), add --no-quit after --no-display in the VM start-up options.

2015-01-21 7:21 GMT+01:00 p...@highoctane.be :

> why running pharo with a squeakvm?
>
> I am runnin headless with PharoVM here.
>
> Your vm params look like weird.
>
> I'll give you a copy of my CLI when I have access to my Pc.
>
> Phil
> Le 21 janv. 2015 03:59, "sergio_101"  a écrit :
>
> #!/bin/bash
>>
>> # settings
>> USER="badgesoup"
>> VM="/usr/lib/squeak/4.10.2-2614/squeakvm"
>> VM_PARAMS="-mmap 256m -vm-sound-null -vm-display-null"
>> IMAGE="/home/badgesoup/badgesoup_image/Pharo3.0.image"
>>
>> # start the vm
>> exec \
>> setuidgid "$USER" \
>> "$VM" $VM_PARAMS "$IMAGE"
>>
>> On Tue Jan 20 2015 at 9:32:04 PM Esteban A. Maringolo <
>> emaring...@gmail.com> wrote:
>>
>>> What is in the 'run' file?
>>>
>>> Esteban A. Maringolo
>>>
>>>
>>> 2015-01-20 23:26 GMT-03:00 sergio_101 :
>>> > i am ready to put my seaside app online, and am finding that all the
>>> > information i am finding is outdated.
>>> >
>>> > I am running the latest Pharo (as of last night), and ubuntu14.04.
>>> >
>>> > when i try to run using squeakvm, i get:
>>> >
>>> > $ sudo ./run
>>> > 'Your VM is too old for this image. Please download the latest VM.'
>>> > 'Pharo cannot locate the sources file named
>>> > /usr/lib/squeak/4.10.2-2614/PharoV30.sources.
>>> >
>>> > Please check that the file is named properly and is in the
>>> > same directory as this image.'
>>> > A PharoCommandLineHandler is x.
>>> >
>>> > everywhere i look, the information seems several years old..
>>> >
>>> > ideas? thanks!
>>> >
>>> >
>>>
>>>


Re: [Pharo-users] "Improper store into indexable object" and weird variable names

2015-01-20 Thread Clément Bera
Typically, if the image can still access the change file but not the source
file (or the other way around), some methods still show temporary variable
names, whereas other methods show t1, t2, etc , depending on which files
their sources were in.







2015-01-20 10:21 GMT+01:00 Sven Van Caekenberghe :

>
> > On 20 Jan 2015, at 10:00, Davide Varvello via Pharo-users <
> pharo-users@lists.pharo.org> wrote:
> >
> >
> > Date: 20 Jan 2015 09:56:45 CET
> > From: Davide Varvello 
> > To: pharo-users@lists.pharo.org
> > Subject: Re: "Improper store into indexable object" and weird variable
> names
> >
> >
> > Sven Van Caekenberghe-2 wrote
> >>> On 19 Jan 2015, at 22:46, Davide Varvello via Pharo-users <
> >
> >> pharo-users@.pharo
> >
> >> > wrote:
> >>>
> >>>
> >>> Date: 19 Jan 2015 22:43:13 CET
> >>> From: Davide Varvello <
> >
> >> varvello@
> >
> >> >
> >>> To:
> >
> >> pharo-users@.pharo
> >
> >>> Subject: Re: "Improper store into indexable object" and weird variable
> >>> names
> >>>
> >>>
> >>> H Sven,
> >>> I didn't move nor rename any of them. In fact some methods have t1, t2,
> >>> t3,
> >>> ... but some others have real variable names.
> >>
> >> That is weird. Any details on which work and which do not ? System code
> or
> >> your code ?
> >
> > Both, my code and system code. Looking at changes it seems it lost all
> code
> > before 7:01:06 pm CET of yesterday (see http://imgur.com/V8eis9Z), I
> can try
> > to restore from my backup, but I'm wondering what happened.
>
> It has been years that I developed in 2.0, but I very vaguely remember
> having seen something similar. Going back and recovering from backup seems
> the only choice.
>
> I find it hard to believe that, say some Collection methods are OK, and
> some say String methods are decompiled, and some of your own code is OK and
> some is not - totally arbitrary ? Is it even constant ?
>
> > Davide
> >
> >
> >
> > --
> > View this message in context:
> http://forum.world.st/Improper-store-into-indexable-object-and-weird-variable-names-tp4800514p4800591.html
> > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> >
> >
> >
>
>
>


Re: [Pharo-users] Notification on GC of an object?

2015-01-13 Thread Clément Bera
Yeah Object>>#finalize is supposed to do what you said but unfortunately it
does not work...

Maybe it's a VM bug or maybe it's not supported any more.

We'll see if Eliot answer the thread.

2015-01-13 15:55 GMT+01:00 Johan Fabry :

>
> No, just putting the cleanup code in a finalize method does not seem to be
> working, sadly.
>
> > On Jan 13, 2015, at 11:18, Sven Van Caekenberghe  wrote:
> >
> > Object>>#finalize ?
> >
> >> On 13 Jan 2015, at 15:13, Johan Fabry  wrote:
> >>
> >> Hi all,
> >>
> >> does anybody here have experience with hooking into the GC mechanism so
> that an object gets notified when it is collected? I have a setup here with
> auto generated classes that I would like to remove when their unique
> instance disappears. So I’d like to let the GC figure out all the
> complicated tracking and inform me whenever such an object is collected,
> then I’ll zap the class as well.
> >>
> >> Experience reports, hints and tips are most welcome!
> >>
> >> ---> Save our in-boxes! http://emailcharter.org <---
> >>
> >> Johan Fabry   -   http://pleiad.cl/~jfabry
> >> PLEIAD lab  -  Computer Science Department (DCC)  -  University of Chile
> >>
> >>
> >
> >
> >
>
>
>
> ---> Save our in-boxes! http://emailcharter.org <---
>
> Johan Fabry   -   http://pleiad.cl/~jfabry
> PLEIAD lab  -  Computer Science Department (DCC)  -  University of Chile
>
>
>


Re: [Pharo-users] Traveling to PharoDays

2014-12-27 Thread Clément Bera
There's a direct train from Paris CDG airport to Lille. It's usually more
complex to go from brussels airport to Lille.

There's an airport in Lille but there's very few flights from there (only
to Marseilles and Porto AFAIK).

2014-12-27 12:21 GMT+01:00 Udo Schneider :

> All,
>
> what's the best international Airport to reach Lille? I'm currently
> thinking of flying to Brussels and take a train from there? Any other
> recommendations?
>
> CU,
>
> Udo
>
>
>


Re: [Pharo-users] New Pharo Collections

2014-12-16 Thread Clément Bera
2014-12-17 7:42 GMT+01:00 Damien Cassou :
>
>
> Le 16 déc. 2014 22:48, "dboeren"  a écrit :.
> > Off the top of my head, I would be interested in support for "slices"
> > meaning taking being able to treat a subset of a larger
> OrderedCollection as
> > its own OrderedCollection rather than using copyFrom:to: to create a
> > duplicate object to work with.  It seems to me that this would be a more
> > efficient method and should not be difficult to implement I think.
>
> Here is an email I sent about that :
>
> I see you are working on new collections for Pharo. That's great news,
> I'm convinced we can do much better (even if what we already have is
> already much better than what can be found in most other languages).
> One thing you could work on is the notion of iterator. There are
> plenty of ways to iterate over a collection:
>
> 1/ from the first to the last item
> 2/ from the last to the first
> 3/ from the 2nd item to the 5th
> 4/ only even items (2, 4, 6, ...)
> 5/ ...
>
> Currently, we have to create new collections to iterate in strange
> ways. For example, to iterate from the last to the first item, we
> create a new collection by sending #reversed to the original
> collection. I think that is bad because it creates a copy and that
> should not be necessary.
>
I don't understand that example. #reverseDo: do not create a copy and do
not send reversed. To iterate over items from last to first I always do, as
recommended in Smalltalk best practice pattern:

mySequenceableCollection reverseDo: [:item | .. ].

#reverseDo: is implemented on SequenceableCollection but iterating from
last to first item does not make sense in the case of non sequenceable
collection.


> What we miss is the notion of iterator. An
> iterator is an object that is specialized in iterating over any kind
> of collection and has methods like #select:, #reject:, #allSatisfy:.
> From a collection, you can access different kinds of iterators
> (reusing the same ordering as before):
>
> 1/ aCollection iterator
> 2/ aCollection reverseIterator
> 3/ aCollection from: 2 to: 5
> 4/ aCollection iterator select: [ :each | each isEven ] --> that
> returns an iterator as well, so you can call #select:/#reject:
> multiple times without creating any intermediate collection
> 5/ ...
>
That makes sense and would be lovely. What is the syntax for multiple
operations ? Have you already think and find something nice about it ?

aCollection iterator
select: [ :each | each isOdd ];
reject: [ :each | each is isPrime ];
iterate

???

Of course there are backward compatibility issue which needs to be very
well adressed here or one would crash every single framework in the system.

> Lukas Renggli implemented a prototype that looks really nice but is
> unfinished: http://source.lukas-renggli.ch/unsorted/Container-lr.7.mcz.
>
> I think the notion of Sequences in Clojure is very related as well.
> Sequence functions are very generic and can be applied to any kind of
> collection. http://clojure.org/sequences
>


Re: [Pharo-users] Beginner of smalltalk 80 - first graphic windows and GUI - need help

2014-11-26 Thread Clément Bera
Hello,

I don't really know how to answer.

Are your examples really from smalltalk-80 ? Were they running on the
Xerox-D microcoded machine ? Because I don't think there are anymore
smalltalk-80 available right now, nor machine that can run it. There's a
smalltalk-78 running on javascript on the web but that's a bit different.

Here you're on the Pharo mailing list, which is a smalltalk which has
evolved during 35 years starting from smalltalk-80, so it's quite different
from smalltalk-80 right now (for example, closures and exceptions were
added, support for modern computers too).

To use window as you are doing something like that works:

| window |
window := StandardWindow new.
window title: 'Hello World' .
window open

However nowadays people use frameworks to build UIs in Pharo, not such
APIs. So it depends what you want to do.



2014-11-26 14:16 GMT+01:00 Hans Schueren :

> To whom it may concern ,
>
>
> may i ask for some help about standard graphic routines ?
>
> As a beginner i just have learned all the first level SYNTAX of smalltalk
> 80.
>
> Now , you can imagine , i am interested in writing little GUI windows and
> graphics for
>
> placing some text in the right positions.
>
>
> Theese are the statements i have studied from my material.
>
>
> Does anybody know why the statements not work?
>
> Are there any "replacements" for the syntax that i posted here as example ?
>
> Have a nice day
>
>
>
>
> HERE ARE THE EXAMPLES :
>
>
>
>
> | window |
> window := ScheduledWindow new.
> window component: 'Hello World' asComposedText.
> window open
>
>
>
>
> | window |
> window := ScheduledWindow new.
> window label: 'Fenster ohne Inhalt'.
> window minimumSize: 200 @ 100; maximumSize: 400 @ 300.
> window open
>
>
>
>
> displayOn: aGraphicsContext
> 1 to: 10 do:
> [:i|
> aGraphicsContext translation printString
>asComposedText displayOn: aGraphicsContext.
> aGraphicsContext translateBy: 15 @ 15]
>
>
>
>
> Greetings
>
>
> Hans
> The Byte Surfer
>
>


Re: [Pharo-users] Building 64-bit pharo VM

2014-11-18 Thread Clément Bera
Hello,

What you want to do is difficult because the vm internals rely on the word
size.

There are two solutions:
1) editing the VM (JIT native code back end + memory manager) to support 64
bits. That's a work in progress. You can discuss about it on the Squeak
vm-dev mailing list.
2) compiling the current VM for 64bits whereas internally it runs in
32bits. Reportedly, it works for the interpreter based VM but not
everything is working (like no FFI I think). Again discuss that on the
squeak vm-dev mailing list.

Right now in 32bits it is ok to open image up to 2Gb. You have to be
careful with GC though so there are not too many user pauses.

On Pharo 4, you will also very soon be able to use Spur the new memory
manager. An image is working using it but it's not a 100% stable right now.
With spur you can open image up to 3Gb in 32bits. The GC is better so
you'll have less user pauses in large images.
Spur image: https://ci.inria.fr/pharo/view/4.0-VM-Spur/job/Pharo-spur32/
Spur VM: https://ci.inria.fr/pharo/view/4.0-VM-Spur/job/PharoVM-spur32/

Regards,

2014-11-19 1:07 GMT+01:00 Evan Donahue :

> Hello,
>
> I am working on building a 64-bit pharo vm to open large files, as per a
> previous question to the list. I have gone down a few roads from different
> dates and with different basic strategies and met with little success so
> far. Could someone recommend the best place to look for the vm build
> instructions that would be the closest fit to building a current pharo vm
> for pharo4 in 64 bits on a 64 bit arch linux os?
>
> Thanks,
> Evan
>


Re: [Pharo-users] Reloading a shared c library after been modified?

2014-10-12 Thread Clément Bera
Hello,

this is possible but non trivial.

I think the easiest way is to bind the C functions to manage C libraries:
dlopen, dlsym, dlclose, dlerror. Then you can manually open and close the
dynamic libs (dlopen, dlclose) and call the function dynamically loaded
with dlsym. dlerror is used for error handling (else you don't know why
your call failed).

Clement.




2014-10-13 0:49 GMT+02:00 Bernardo Ezequiel Contreras 
:

> hi all,
>   i've made a simple shared c library for learning purposes
> that i call using nativeboost. Now the problem i'm facing
> it's that after i changed the library i have to close and
> open the image to get those changes, so the question
> is there a way to update the library loaded in the image without
> closing and opening the image?
>
> thanks.
>
>
>
> --
> Bernardo E.C.
>
> Sent from a cheap desktop computer in South America.
>
>


Re: [Pharo-users] Passed by references and by value

2014-09-25 Thread Clément Bera
Depending on the VM you use, different objects are passed by values.

Currently -> only smallintegers
on Spur 32 bits VM -> smallintegers and characters
on Spur 64 bits VM -> smallintegers, characters and smallfloat

But as Stef said it does not really matter in smalltalk.

2014-09-25 21:55 GMT+02:00 nacho <0800na...@gmail.com>:

> "
> stepharo wrote
> >> Hi,
> >> In PBE says that ordinary objects' ivars are passed by references and
> >> small
> >> integers are passed by value.
> >
> > Strange I do not remember having written that.
> > Especially because in Smalltalk this has no real interest.
> >
> >
> > Well you also wrote that :p
> >
> > "Deep in the implementation of Smalltalk, there are three different kinds
> > of objects. There are (1) ordinary objects with instance variables that
> > are passed by references, there are (2) small integers that are passed by
> > value, and there are (3) indexable objects like arrays that hold a
> > contiguous portion of memory. The beauty of Smalltalk is that you
> normally
> > don’t need to care about the differences between these three kinds of
> > object.
> >
> >> Is there a way to know if a class is passed by reference or by value?
> > In Smalltalk consider that everything is an object and that you pass a
> > reference to the object.
> >> Only small integers are passed as value?
> >> Thanks in advance
> >> Nacho
> >>
> >>
> >>
> >>
> >>
> >> -
> >> Nacho
> >> Smalltalker apprentice.
> >> Buenos Aires, Argentina.
> >> --
> >> View this message in context:
> >> http://forum.world.st/Passed-by-references-and-by-value-tp4780289.html
> >> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> >>
> >>
>
>
>
>
>
> -
> Nacho
> Smalltalker apprentice.
> Buenos Aires, Argentina.
> --
> View this message in context:
> http://forum.world.st/Passed-by-references-and-by-value-tp4780289p4780321.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] Calling Pharo from C

2014-09-18 Thread Clément Bera
Let's say no.

It will be possible in the future but it requires quite some work in the
VM. If you want to do this work, ask the question on VM-dev mailing list
they will tell you what you need to do to make it possible.

2014-09-18 22:05 GMT+02:00 Annick Fron :

>
> Is it possible to call pharo from C ?
>
> Annick
>
>


Re: [Pharo-users] New compiler: variable and recursive bloc of code

2014-09-10 Thread Clément Bera
Hello,

The additional assignment is not needed.

You get a warning because the warning detection is approximate and
sometimes raises warning whereas it should not, but if you proceed, it
compiles fine.

2014-09-10 8:54 GMT+02:00 Hilaire :

> Hello,
>
> I noticed this change described bellow and I just want to have
> confirmation about it:
>
> The new Pharo 2.0 compiler need to have variable assigned with a value
> before it used in a recursive bloc of code. Of course it is a bit
> inelegant. Or is it something else and does it need to be reported?
>
> Thanks to let me know
>
> Hilaire
>
> For example this Dr. Geo code break in Pharo 2.0:
>
> | triangle c |
> triangle := [:s1 :s2 :s3 :n |
> c segment: s1 to: s2;
> segment: s2 to: s3;
> segment: s3 to: s1.
> n > 0 ifTrue:
> [triangle
> value: s1
> value: (c middleOf: s1 and: s2) hide
> value: (c middleOf: s1 and: s3) hide
> value: n-1].
> [...]
> ].
>
> It must be changed to:
>
> | triangle c |
> triangle := []. <= CHANGE HERE
> triangle := [:s1 :s2 :s3 :n |
> c segment: s1 to: s2;
> segment: s2 to: s3;
> segment: s3 to: s1.
> n > 0 ifTrue:
> [triangle
> value: s1
> value: (c middleOf: s1 and: s2) hide
> value: (c middleOf: s1 and: s3) hide
> value: n-1].
> [...]
> ].
>
>
>
> --
> Dr. Geo - http://drgeo.eu
> iStoa - http://istao.drgeo.eu
>
>
>


Re: [Pharo-users] Math Ontologie on Pharo 3.0

2014-09-09 Thread Clément Bera
2014-09-09 14:12 GMT+02:00 Alain Busser :

> Is this a reproducible case?
> http://ss3.gemstone.com/ss/MathsOntologie/MathsOntologie-AlainBusser.68.mcz
>
>
Well I tried to merge that in the latest Pharo 4.

With Opal I got the error 'unknown character'

With the old compiler I got unmatched string quote.

If it's French, could it be a ' ?

It looks like a parser bug to me...


I hope not :-)
>
> Alain
>
> On Tue, Sep 9, 2014 at 5:43 AM, Clément Bera 
> wrote:
>
>> What kind of bug do you have with accent ? Do you have a stack trace ?
>>
>> More importantly, can you give us a reproducible case ? I will
>> investigate tomorrow if you have a reproducible case to check if this is
>> due to Opal.
>>
>> It may also be recent changes related to fonts.
>>
>> 2014-09-08 21:07 GMT+02:00 Sven Van Caekenberghe :
>>
>>> I don't think it is related to Opal: I made a test class with an
>>> instance variable, accessor and class comment with accents - which I can
>>> file out and file in:
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> I tested in 3.0 and 4.0
>>>
>>> The problem might be with Monticello.
>>>
>>>
>>> On 08 Sep 2014, at 20:05, Hilaire  wrote:
>>>
>>> > Oh, by the way, it looks like the accents are on the instance variable
>>> names.
>>> >
>>> > I edited the subject to not pollute the original discussion thread.
>>> >
>>> > Hilaire
>>> >
>>> > Le 08/09/2014 20:01, Hilaire a écrit :
>>> >> Marcus,
>>> >>
>>> >> Alain's MathOntologie package provide Classes and Messages with French
>>> >> accent, to ease the understanding of programming to high school
>>> students.
>>> >> I am suspecting the new compiler or something related does not
>>> accepted
>>> >> accented caracters or something different to ASCII.
>>> >>
>>> >> Alain, in your package I noted the sources is not utf-8 but
>>> iso-8859-15
>>> >> (8 bits), I converted it to utf-8 and tried to get it loaded in
>>> Pharo3,
>>> >> but still accent characters caused problem, see screenshot.
>>> >>
>>> >> Enclosed source file utf-8 converted and improper imported source code
>>> >> with accented variable name.
>>> >>
>>> >> Hilaire
>>> >>
>>> >> Le 08/09/2014 12:18, Alain Busser a écrit :
>>> >>> Hi,
>>> >>>
>>> >>> I don't know if it is related but I have problems importing french
>>> files
>>> >>> inside Pharo 3: Anytime when there is an accentuated character there
>>> is
>>> >>> an error, and the file is not imported. Even if the character is a
>>> quote
>>> >>> inside double quotes (like in "it don't work") there is an error
>>> >>> message. Right now I can't import MathsOntologie
>>> >>> (
>>> http://ss3.gemstone.com/ss/MathsOntologie/MathsOntologie-AlainBusser.68.mcz
>>> )
>>> >>>
>>> >>> into Pharo 3 and I have to go on developing it in Pharo 1.4...
>>> >>>
>>> >>> Alain
>>> >>>
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > Dr. Geo - http://drgeo.eu
>>> > iStoa - http://istao.drgeo.eu
>>> >
>>> >
>>>
>>>
>>>
>>
>


Re: [Pharo-users] Math Ontologie on Pharo 3.0

2014-09-08 Thread Clément Bera
What kind of bug do you have with accent ? Do you have a stack trace ?

More importantly, can you give us a reproducible case ? I will investigate
tomorrow if you have a reproducible case to check if this is due to Opal.

It may also be recent changes related to fonts.

2014-09-08 21:07 GMT+02:00 Sven Van Caekenberghe :

> I don't think it is related to Opal: I made a test class with an instance
> variable, accessor and class comment with accents - which I can file out
> and file in:
>
>
>
>
>
>
>
> I tested in 3.0 and 4.0
>
> The problem might be with Monticello.
>
> On 08 Sep 2014, at 20:05, Hilaire  wrote:
>
> > Oh, by the way, it looks like the accents are on the instance variable
> names.
> >
> > I edited the subject to not pollute the original discussion thread.
> >
> > Hilaire
> >
> > Le 08/09/2014 20:01, Hilaire a écrit :
> >> Marcus,
> >>
> >> Alain's MathOntologie package provide Classes and Messages with French
> >> accent, to ease the understanding of programming to high school
> students.
> >> I am suspecting the new compiler or something related does not accepted
> >> accented caracters or something different to ASCII.
> >>
> >> Alain, in your package I noted the sources is not utf-8 but iso-8859-15
> >> (8 bits), I converted it to utf-8 and tried to get it loaded in Pharo3,
> >> but still accent characters caused problem, see screenshot.
> >>
> >> Enclosed source file utf-8 converted and improper imported source code
> >> with accented variable name.
> >>
> >> Hilaire
> >>
> >> Le 08/09/2014 12:18, Alain Busser a écrit :
> >>> Hi,
> >>>
> >>> I don't know if it is related but I have problems importing french
> files
> >>> inside Pharo 3: Anytime when there is an accentuated character there is
> >>> an error, and the file is not imported. Even if the character is a
> quote
> >>> inside double quotes (like in "it don't work") there is an error
> >>> message. Right now I can't import MathsOntologie
> >>> (
> http://ss3.gemstone.com/ss/MathsOntologie/MathsOntologie-AlainBusser.68.mcz
> )
> >>>
> >>> into Pharo 3 and I have to go on developing it in Pharo 1.4...
> >>>
> >>> Alain
> >>>
> >>
> >>
> >
> >
> > --
> > Dr. Geo - http://drgeo.eu
> > iStoa - http://istao.drgeo.eu
> >
> >
>
>
>


Re: [Pharo-users] FFI with compile flags

2014-08-13 Thread Clément Bera
I don't understand, do you want to compile your library using FFI or do you
want to bind a library compiled your way with FFI ?

If you want to compile your library using FFI, then use OSProcess to run
the compilation line you showed.

If you want to bind a library compiled your way with FFI, the easiest way
is to compile the C files as a dylib with something like:

*gcc -shared -m32 -Wall helloworld.c -o helloworld.dylib $(pkg-config
--cflags --libs gstreamer-1.0)*

(replace .dylib by .so or .dll if you're on windows or on Mac).
Then you can bind the dynamic library generated with FFI. I am not sure
about the FFI syntax but with NativeBoost it would look like:
Integer>>fib4NB

^ self
nbCall: #( int functionToCall (int self) )
module: '/Users/myName/Desktop/helloWorld.dylib'

Regards,

Clement


2014-08-13 11:55 GMT+02:00 Annick Fron :

> Hi,
>
> I would like to compile a FFI program but the compiling implies compile
> flags like in the following :
>
> *gcc -Wall helloworld.c -o helloworld $(pkg-config --cflags --libs
> gstreamer-1.0)*
>
> *How do I do this with FFI ?*
>
> *Annick*
>


Re: [Pharo-users] Seeing all the methods that is used in a method

2014-08-07 Thread Clément Bera
2014-08-07 10:47 GMT+02:00 aria2end :

> Yes Exactly. I want to see all the potential methods called from from this
> method which is the second case. but I receive error using that script.
>
> MessageNotUnderstood: ByteSymbol>>implementors
>
> Ok this method is implemented in the image I use (Pharo-40151).

The code is
Symbol>>implementors
^SystemNavigation new allImplementorsOf: self

Sorry I didn't know this code was not in Pharo 3.

>
>
>
>
> --
> View this message in context:
> http://forum.world.st/Seeing-all-the-methods-that-is-used-in-a-method-tp4772099p4772160.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] Seeing all the methods that is used in a method

2014-08-07 Thread Clément Bera
2014-08-07 5:11 GMT+02:00 aria2end :

> Hi, I know that I can see senders and implementers of a method but is there
> any way to see all methods that are used in a method ?
>

This is impossible. The method called for each message send can only been
known at runtime, because it depends on the receiver class. The only thing
you could see is the list of selectors (name of methods) called from this
method. This is possible by sending #messages to the compiledMethod.

Example:

you have a method named #foo:bar: implemented in MyClass:
MyClass>>foo: arg1 bar: arg2
^ self baz: arg1 + arg2

You can open a workspace, and run:
(MyClass >>#foo:bar:) messages

which answers:
a Set(#baz: #+)

but you cannot see the methods called, because depending on the class of
arg1, the method called for #+ may be any of these methods:
AJMem>>#+ Collection>>#+ Color>>#+ DateAndTime>>#+ Duration>>#+ Float>>#+
FloatArray>>#+ Fraction>>#+ Integer>>#+ Interval>>#+ KMComposedModifier>>#+
KMKeyCombinationSequence>>#+ KMModifier>>#+ KMNoShortcut>>#+
LargeInteger>>#+ Number>>#+ Point>>#+ ROAbstractComponent>>#+ ROShape>>#+
ROShape class>>#+ ScaledDecimal>>#+ SmallInteger>>#+ String>>#+
Timespan>>#+ TraitComposition>>#+ TraitDescription>>#+
TraitTransformation>>#+ WordArray>>#+ TComposingDescription>>#+

Or perhaps you want to see all the potential methods called. Then you can
open a workspace and run this script:

| methods mb |
methods := ((CompiledMethod>>#foo:bar:) messages collect: [ :selector |
selector implementors ]) flattened.
mb := MethodBrowser new.
mb openWithSpec.
mb methods: methods



>  or any way to see
> all the send messages to other methods limited to scope of a method ?
>

all the send messages to other methods ?

Well for that you'll need type inference to find out which variables are
actually methods, and then see what messages are sent to those variables.
But why would one want to do that ?

>
> Thanks,
> Aria
>
>
>
>
>
> --
> View this message in context:
> http://forum.world.st/Seeing-all-the-methods-that-is-used-in-a-method-tp4772100.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] I need some explaination about arguements assignment

2014-08-07 Thread Clément Bera
2014-08-07 6:38 GMT+02:00 aria2end :

> Hi james,
>
> Your post not only resolved the issue but also introduced me a new approach
> which I was looking for it.
> Thank you
>
> do you know the reason why assigning to a passed-in argument is illegal by
> any chance ?
>
> This is illegal because then you may lose the original argument value and
the debugger does not work well any more.

Assigning to an argument should raise an error, but the new compiler does
not raise it (it is a known bug).

>
>
> --
> View this message in context:
> http://forum.world.st/I-need-some-explaination-about-arguements-assignment-tp4772102p4772108.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Re: [Pharo-users] FFI Basic

2014-07-10 Thread Clément Bera
Well the method with the code you give was compiled without any problem in
my image (Pharo #30851 with FFI loaded with configuration browser as
explained in the other thread).

Perhaps this is related to your bug in the other thread where you were
(probably) missing a package ?




2014-07-10 18:15 GMT+02:00 Annick Fron :

>
> Hi,
>
> I made another attempt , a very basic one on window : trying to use the
> abs method in the standard lib.
>
> abs: aNumber
>
> 
> self externalCallFailed
>
> I get the error ‘cannot return the given type’.
>
> But now if I use long as argument and long as return  it works.
>
> Annick
>


  1   2   >