Re: [Pharo-users] Versionner: Specifying un-configured packages as dependencies

2014-05-22 Thread Christophe Demarey

Le 22 mai 2014 à 01:02, Johan Fabry a écrit :

 
 On May 21, 2014, at 5:07 AM, Christophe Demarey christophe.dema...@inria.fr 
 wrote:
 
 To me, it is preferable to add a configuration (even if very small) for each 
 dependency outside your project. It is the way it should be done (that's why 
 Versionner only allows that) but they are always other ways or workarounds.
 
 Thanks for the answers, my trick now was to ask Alex to include the required 
 package inside the configuration of Roassal. :-)
 
 In general I am not so sure that adding configurations for one simple package 
 are the way to go though. It seems like adding extra layers of indirection 
 for reasons that are unclear to me.

The reason is that any package* should be self described. Your configuration 
describes your project. If you use another piece of software, it should also be 
self-described.
Let's take the following example:
for now, it's easy for you to add a direct dependency to Roassal2Spec, just as 
if it was a part of your project ... = no problem
... but it is not. Maybe tomorrow, Alex will need to add a dependency to one or 
more packages for Roassal2Spec = you will have problems because you will not 
get these dependencies. Of course, you can still add them to your configuration 
but you can easily see that you will end with a configuration including all 
flatten dependencies, and with a lot of dependencies not directly related to 
your project (transitive dependencies). Flatten dependencies is really 
something that we should avoid, else maintenance of dependencies will be a hell.
That's why I'm really in favor of having configurations, even for one single MC 
package inside the configuration.

* I mean, not a Monticello package but a piece of software that you want to 
deliver independently. It may be a whole project or part of it. It may also 
refers to one or many Monticello packages

smime.p7s
Description: S/MIME cryptographic signature


Re: [Pharo-users] Ghost Proxy

2014-05-22 Thread stepharo


In general, we should think about if is would make sense that the 
language comes with

a good proxy model by default.


+ 1
We should do that with Camille.
(this way we would avoid that everyone creates one that is not 
completely working)





Re: [Pharo-users] Ghost Proxy

2014-05-22 Thread stepharo

We will discuss.

Stef


2014-05-21 8:37 GMT+02:00 Marcus Denker marcus.den...@inria.fr 
mailto:marcus.den...@inria.fr:


In general, we should think about if is would make sense that the
language comes with
a good proxy model by default.
(this way we would avoid that everyone creates one that is not
completely working)


I completely agree with that.
I think that most people come back to DNU because it is there and 
simple to implement.


But some others also told me that they use a different design from the 
one of Ghost and I do not know what they change and why.


Luc



On 21 May 2014, at 08:31, Luc Fabresse luc.fabre...@gmail.com
mailto:luc.fabre...@gmail.com wrote:


Hi François,

The code is here http://ss3.gemstone.com/ss/Ghost.html/Latest
the configuration is working but I do not remember if I tested in
Pharo 3 now

Cheers,

#Luc


2014-05-20 18:15 GMT+02:00 François Stephany
tulipe.mouta...@gmail.com mailto:tulipe.mouta...@gmail.com:

What is the best way to load Ghost in Pharo 3.0? Is there a
configuration somewhere?

Is anyone using it? Voyage does seem to use the
ProtoObject+dnu+becomeForward trick. Is there any reason for
that?









Re: [Pharo-users] Versionner: Specifying un-configured packages as dependencies

2014-05-22 Thread Johan Fabry

On May 22, 2014, at 5:00 AM, Christophe Demarey christophe.dema...@inria.fr 
wrote:

 In general I am not so sure that adding configurations for one simple 
 package are the way to go though. It seems like adding extra layers of 
 indirection for reasons that are unclear to me.
 
 The reason is that any package* should be self described. Your configuration 
 describes your project. If you use another piece of software, it should also 
 be self-described.
 Let's take the following example:
   • for now, it's easy for you to add a direct dependency to 
 Roassal2Spec, just as if it was a part of your project ... = no problem
   • ... but it is not. Maybe tomorrow, Alex will need to add a dependency 
 to one or more packages for Roassal2Spec = you will have problems because 
 you will not get these dependencies. Of course, you can still add them to 
 your configuration but you can easily see that you will end with a 
 configuration including all flatten dependencies, and with a lot of 
 dependencies not directly related to your project (transitive dependencies). 
 Flatten dependencies is really something that we should avoid, else 
 maintenance of dependencies will be a hell.
 That's why I'm really in favor of having configurations, even for one single 
 MC package inside the configuration.

I understand what you are saying, but my point of view is different. I put a 
high priority on the simplicity rule: if it is just one package with no special 
dependencies the Monticello package is the simplest solution, so you use that. 
If there are special dependencies, then the simplest solution for that package 
to work is to have a configuration for it, so you create it.

The latter is still not so obvious apparently, Alex has tried 2 times to 
include Roassal2Spec in the Roassal config, and it still does not load in a 
default Pharo 3. Alex, can you try again? ( hint hint :-) ) 

--- Save our in-boxes! http://emailcharter.org ---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD lab  -  Computer Science Department (DCC)  -  University of Chile




[Pharo-users] 3D with Pharo and OpenGL ?

2014-05-22 Thread RIOU Judith
Hy,

I'm working at Thales for a year internship and I would like to do some OpenGL 
demos in smalltalk.  I'm searching a demo which shows the capacity to implement 
3D drawing with Pharo. Does a demo already available on Pharo 3.0 ?

I aim to code my own demo and for example begin with a 3D drawing of the earth 
(earth texture and arcball camera).

Thanks.

Judith
[@@ THALES GROUP INTERNAL @@]



Re: [Pharo-users] Versionner: Specifying un-configured packages as dependencies

2014-05-22 Thread Sean P. DeNigris
jfabry wrote
 I put a high priority on the simplicity rule

It's good to know the dangers, but for single packages with no dependencies,
I often just add it to my project.



-
Cheers,
Sean
--
View this message in context: 
http://forum.world.st/Versionner-Specifying-un-configured-packages-as-dependencies-tp4759683p4760030.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Ghost Proxy

2014-05-22 Thread Camille Teruel

On 22 mai 2014, at 11:54, stepharo steph...@free.fr wrote:

 
 In general, we should think about if is would make sense that the language 
 comes with
 a good proxy model by default.
 
 + 1
 We should do that with Camille.

Yes.
Now the problem is to agree on what is a good model.
There is many use cases for proxies and they come with their own models and 
problems.
Here are some requirements I can think of:

- Uniformity: all objects can be wrapped, even special ones (it's a 
technicality but it's still important)
- Interception of all message: currently we cannot intercept #== and optimized 
control-flow messages like #ifTrue:ifFalse #to:do:, #whileTrue:, etc...
- Encapsulation (a.k.a the self problem): avoid leaking of references to the 
target. E.g. aProxy yourself should return the proxy not the target.
- Behavioral intercession: Not everything is a message send. What other events 
do we want to intercept? IV access is a must-have for me. 
- Composition: Wrapping a proxy with another one should work as expected, i.e. 
applying both policies in order.
- Performances: intercepting message sends is slow, intercepting iv accesses is 
even worse (relying on code instrumentation). We would need VM support. 
- Security: It shouldn't be possible to by-pass or corrupt a proxy policy.
- Delimited replacement: Ensure that a proxy is always used in place of its 
target throughout the processing of a message send, no matter the alias used 
(that is not necessarily self). Think about a read-only proxy for example.

Right now, to intercept messages we have to rely on #cannotInterpret: hack. To 
intercept iv access or other events we have to rely on code instrumentation and 
delegation.
It would be easier if the VM would allow to create an object that controls its 
own interpretation (via a metaobject that defines a MOP for example). Such an 
object should at least be able to specify its message lookup and how to reads 
and writes IVs. 
And optionally:
- how it sends messages
- how it resolves other variables (temporaries, arguments, globals, class 
variables) 
- how it resolves literals
- how it executes primitives (because else the VM may cry) 
- how it is assigned to a variable or passed in a message (to control 
static/dynamic aliasing respectively)
- ... many others ...
With such objects (+ operating by delegation instead of forwarding) we can 
solve most of the requirements listed above (well except performant delimited 
replacement).
All that to say that it is not easy...

 (this way we would avoid that everyone creates one that is not completely 
 working)
 
 




[Pharo-users] Pillar annotations for Latex

2014-05-22 Thread Ben Coman

The Pillar documentation [1] says...
   An annotated paragraph starts a line with @@ followed by either 
todo or note. For example,

   @@note this is a note annotation.
   generates
Note: this is a note annotation.
   And,
   @@todo this is a todo annotation
   generates a todo annotation that is not visible in the output.

However this does not work when rendering to LaTex.
   * The notes do not start with Note:
   * The todos are visible

This seemed to be handled by...
   PRMarkdownWritervisitAnnotatedParagraph: anAnnotatedParagraph
   Pier seams to lack consistensy here ...  
   needsABreak ifTrue: [ canvas addInvisibleSeparator ].


   anAnnotatedParagraph annotation asLowercase = 'todo'
   ifTrue: [ ^ self visitCommentedLine: anAnnotatedParagraph ].

   self nest: [ :brush |   
   brush

   name: ''
   with: [ :nestedStream |
   self writeRawDuring: [
   nestedStream  'Note: '.
   nestedStream  anAnnotatedParagraph text 
trimBoth ] ] ].  
   needsABreak := true.


but that there is no equivalent PRLaTexWritervisitAnnotatedParagraph:
and the following is used by default...
   PRVisitorvisitAnnotatedParagraph: aDocument
   self visitParagraph: aDocument


In seeking to fix this for LaTex I found...
* /needsABreak/ is an ivar of PRMarkdown and I guess not applicable to LaTex
* #nest: and the /nest/ ivar it references belong to PRMarkdown, and I'm 
not sure of their purpose.


So I cut those out, which left the following...
   PRLaTexWritervisitAnnotatedParagraph
   anAnnotatedParagraph annotation asLowercase = 'todo'
   ifTrue: [ ^ self visitCommentedLine: anAnnotatedParagraph ].

   self writeRawDuring: [
   nestedStream  'Note: '.
   nestedStream  anAnnotatedParagraph text trimBoth ].

...which works well enough for the usage I see so far in 
PharoLaserGameTutorial. [2]


Now is there any important function missing, or is there a better way to 
do this?

I also want add an annotation type, which I'll describe in a following post.

cheers -ben

[1] https://github.com/pillar-markup/pillar-documentation
[2] https://github.com/bencoman/PharoLaserGameTutorial



Re: [Pharo-users] 3D with Pharo and OpenGL ?

2014-05-22 Thread kilon alios
you can find plenty of code in Roassal3d that I think uses the NBOpenGL
library here

http://www.smalltalkhub.com/#!/~ronsaldo/roassal3d

NBOpenGL is basically a wrapper for OpenGL with Nativeboost. So if you are
familiar with OpenGL , C and Nativeboost you are good to go using Roassal3d
as an example to help you figure things out.

I tried to make a set of tutorial but OpenGL proven very hard to tame. My
main problem with my previous iMac was that Apple did not give error
reporting for OpenGL which made it close to impossible to figure what went
wrong with my OpenGL code. I have not tried to see if the situation
improved with my new iMac that I purchased in the beginning of this year.

Please note that previous iMac was 7 years old and still using Lion.

Another tool that uses NBOpenGL is codecity. Bare in mind that OpenGL is
pure graphics operation for the GPU so it does not provide with file
loaders etc but I am sure using the tools I told you about you will fill in
the gaps.


On Thu, May 22, 2014 at 6:11 PM, RIOU Judith judith.r...@fr.thalesgroup.com
 wrote:

 Hy,



 I’m working at Thales for a year internship and I would like to do some
 OpenGL demos in smalltalk.  I’m searching a demo which shows the capacity
 to implement 3D drawing with Pharo. Does a demo already available on Pharo
 3.0 ?



 I aim to code my own demo and for example begin with a 3D drawing of the
 earth (earth texture and arcball camera).



 Thanks.



 Judith

 [@@ THALES GROUP INTERNAL @@]





Re: [Pharo-users] Ghost Proxy

2014-05-22 Thread Luc Fabresse
2014-05-22 18:06 GMT+02:00 Camille Teruel camille.ter...@gmail.com:


 On 22 mai 2014, at 11:54, stepharo steph...@free.fr wrote:

 
  In general, we should think about if is would make sense that the
 language comes with
  a good proxy model by default.
 
  + 1
  We should do that with Camille.

 Yes.
 Now the problem is to agree on what is a good model.
 There is many use cases for proxies and they come with their own models
 and problems.


yes sure


 Here are some requirements I can think of:

 - Uniformity: all objects can be wrapped, even special ones (it's a
 technicality but it's still important)
 - Interception of all message: currently we cannot intercept #== and
 optimized control-flow messages like #ifTrue:ifFalse #to:do:, #whileTrue:,
 etc...
 - Encapsulation (a.k.a the self problem): avoid leaking of references to
 the target. E.g. aProxy yourself should return the proxy not the target.
 - Behavioral intercession: Not everything is a message send. What other
 events do we want to intercept? IV access is a must-have for me.
 - Composition: Wrapping a proxy with another one should work as expected,
 i.e. applying both policies in order.
 - Performances: intercepting message sends is slow, intercepting iv
 accesses is even worse (relying on code instrumentation). We would need VM
 support.
 - Security: It shouldn't be possible to by-pass or corrupt a proxy policy.
 - Delimited replacement: Ensure that a proxy is always used in place of
 its target throughout the processing of a message send, no matter the alias
 used (that is not necessarily self). Think about a read-only proxy for
 example.

 Right now, to intercept messages we have to rely on #cannotInterpret: hack


why do you call it a hack?
do you consider DNU as hack too?


 . To intercept iv access or other events we have to rely on code
 instrumentation and delegation.


yes but I would like to investigate if cannot achieve iv interception using
special slots



 It would be easier if the VM would allow to create an object that controls
 its own interpretation (via a metaobject that defines a MOP for example).
 Such an object should at least be able to specify its message lookup and
 how to reads and writes IVs.
 And optionally:
 - how it sends messages

this one is possible with cannotInterpret
you intercept and then you decide what to do and maybe execute something
else so you control message sending


 - how it resolves other variables (temporaries, arguments, globals, class
 variables)
 - how it resolves literals
 - how it executes primitives (because else the VM may cry)
 - how it is assigned to a variable or passed in a message (to control
 static/dynamic aliasing respectively)


all of those ones are submethod level and yes Ghost stops at the object
granularity currently


 - ... many others ...
 With such objects (+ operating by delegation instead of forwarding) we can
 solve most of the requirements listed above (well except performant
 delimited replacement).
 All that to say that it is not easy...


yes but it is interesting ;-)
and we also discuss some parts of that with Nick

Luc


  (this way we would avoid that everyone creates one that is not
 completely working)
 
 





[Pharo-users] Initializing a class with a Dictionary

2014-05-22 Thread sergio_101
is it possible to initialize a class with a dictionary? my first thought
would be to create a method like:

intializeWithDictionary: aDictionary

then, loop through the elements and do something like:

instVarNamed: key put: value

but the book says:

Caveat: Although these methods are useful for building development tools,
using them to develop conventional applications is a bad idea: these
reflective methods break the encapsulation boundary of your objects and can
there- fore make your code much harder to understand and maintain.--

should i avoid this?



peace,
sergio
photographer, journalist, visionary
#BitMessage BM-2D8VWUJSS41RFKh1ec83preVabHrnniExa

http://www.Village-Buzz.com
http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101


[Pharo-users] Calling an arbitrary method

2014-05-22 Thread sergio_101
In many cases, an object might have a method (filter, selector, etc)
attached to it so that the object can run the correct method..

for instance, an object might have a filterMethod variable with a value
'filterByArtist'..

in ruby, i would do something like:

instance.send(filter_method)

how would i do that in pharo, and is this a bad idea?

thanks!


-- 

peace,
sergio
photographer, journalist, visionary
#BitMessage BM-2D8VWUJSS41RFKh1ec83preVabHrnniExa

http://www.Village-Buzz.com
http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101


Re: [Pharo-users] Calling an arbitrary method

2014-05-22 Thread Camille Teruel

On 22 mai 2014, at 19:46, sergio_101 sergio@gmail.com wrote:

 In many cases, an object might have a method (filter, selector, etc) attached 
 to it so that the object can run the correct method..
 
 for instance, an object might have a filterMethod variable with a value 
 'filterByArtist'..
 
 in ruby, i would do something like:
 
 instance.send(filter_method)
 
 how would i do that in pharo, and is this a bad idea?

instance perform: filterMethod asSymbol
If filterMethod is already a symbol you can omit asSymbol. 
It is slower than regular message send but it's also the safest reflective 
operation since it's the only one that doesn't break object encapsulation.
 
 
 thanks!
 
 
 -- 
 
 peace,
 sergio
 photographer, journalist, visionary
 #BitMessage BM-2D8VWUJSS41RFKh1ec83preVabHrnniExa
 
 http://www.Village-Buzz.com
 http://www.ThoseOptimizeGuys.com
 http://www.CodingForHire.com
 http://www.coffee-black.com
 http://www.painlessfrugality.com
 http://www.twitter.com/sergio_101
 http://www.facebook.com/sergio101



Re: [Pharo-users] Initializing a class with a Dictionary

2014-05-22 Thread sergio_101
great! looking at STON next! thanks!


On Thu, May 22, 2014 at 2:26 PM, Clément Bera bera.clem...@gmail.comwrote:

 Hello,

 I think you should look at the STON framework. STON looks like JSON for
 smalltalk objects. Basically it does the same as your idea but instead of a
 dictionary it loads fields of an objects from a STON file which looks like
 a JSON file (a STON is kind of an extended Dictionary exported as a string,
 but it has support for more that instance variables).

 Now if you want to go your way, to me what you want to do looks fine.
 These methods can be used for development tools but also for frameworks and
 stuff like that. The thing to do it is to add this method in Object and add
 support so it can work on all objects in the system.

 Object#intializeWithDictionary: aDictionary
 self class isVariable ifTrue: [specific case ?]
 self class isBytes ifTrue: [specific case ?]
 self class isCompiledMethod ifTrue: [specific case ?]
 self class isSmallInteger ifTrue: [specific case]
 aDictionary keysAndValuesDo: [ :key :value |
 self instVarNamed: key put: value ifAbsent: [ self error: 'no ',
 key , ' found'].

 But as you can see there are many specific cases: CompiledMethod, bytes
 objects, word objects, immediate objects, variable-sized objects, weak
 objects and for Pharo 4 even others that you may need to handle in your
 code (Ephemerons, 2bytes and 4 bytes objects).

 If you don't get the specific cases (you may not know programming language
 internals), then imagine how you would make your code work to initialize an
 Array, a ByteArray or a CompiledMethod from a dictionary. Not easy, huh ?

 That's why I strongly recommend to use something like STON, because it is
 very easy to use, handle already all the specific cases, well documented
 (Sven always does fancy documentation) and it will be maintained in Pharo 4
 for recent changes (because Sven likes to use the bleeding edge version of
 Pharo).

 Regards,

 Clement


 2014-05-22 19:37 GMT+02:00 sergio_101 sergio@gmail.com:


 is it possible to initialize a class with a dictionary? my first thought
 would be to create a method like:

 intializeWithDictionary: aDictionary

 then, loop through the elements and do something like:

 instVarNamed: key put: value

 but the book says:

 Caveat: Although these methods are useful for building development tools,
 using them to develop conventional applications is a bad idea: these
 reflective methods break the encapsulation boundary of your objects and can
 there- fore make your code much harder to understand and maintain.--

 should i avoid this?


 
 peace,
 sergio
 photographer, journalist, visionary
 #BitMessage BM-2D8VWUJSS41RFKh1ec83preVabHrnniExa

 http://www.Village-Buzz.com
 http://www.ThoseOptimizeGuys.com
 http://www.CodingForHire.com
 http://www.coffee-black.com
 http://www.painlessfrugality.com
 http://www.twitter.com/sergio_101
 http://www.facebook.com/sergio101





-- 

peace,
sergio
photographer, journalist, visionary
#BitMessage BM-2D8VWUJSS41RFKh1ec83preVabHrnniExa

http://www.Village-Buzz.com
http://www.ThoseOptimizeGuys.com
http://www.CodingForHire.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101


Re: [Pharo-users] Pillar annotations for Latex

2014-05-22 Thread Damien Cassou
Hi Ben,

On Thu, May 22, 2014 at 6:09 PM, Ben Coman b...@openinworld.com wrote:
 Now is there any important function missing, or is there a better way to do
 this?

thank you for your contribution.

I would try to generate this instead:

\begin{note}
  foo bar baz
\end{note}

This environment is meant for this. To output the \begin and \end parts, use

canvas environment

(look at the senders of #environment in the PRLaTeXWriter class for examples)

To output the text, you can just write

   super visitAnnotatedParagraph: aParagraph


 I also want add an annotation type, which I'll describe in a following post.


I should we should think a bit how these should be handled. In the
meantime, you can just hack around :-). And please add unit tests.

-- 
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] Ghost Proxy

2014-05-22 Thread Luc Fabresse
2014-05-22 20:37 GMT+02:00 Esteban A. Maringolo emaring...@gmail.com:

 2014-05-22 13:06 GMT-03:00 Camille Teruel camille.ter...@gmail.com:
 
  On 22 mai 2014, at 11:54, stepharo steph...@free.fr wrote:
 
 
  In general, we should think about if is would make sense that the
 language comes with
  a good proxy model by default.
 
  + 1
  We should do that with Camille.
 
  Yes.
  Now the problem is to agree on what is a good model.
  There is many use cases for proxies and they come with their own models
 and problems.
  Here are some requirements I can think of:
 
  - Uniformity: all objects can be wrapped, even special ones (it's a
 technicality but it's still important)
  - Interception of all message: currently we cannot intercept #== and
 optimized control-flow messages like #ifTrue:ifFalse #to:do:, #whileTrue:,
 etc...

  - Encapsulation (a.k.a the self problem): avoid leaking of references to
 the target. E.g. aProxy yourself should return the proxy not the target.

 Funny thing is that Glorp proxies materialize the referenced object
 when they receive #yourself

  - Behavioral intercession: Not everything is a message send. What other
 events do we want to intercept? IV access is a must-have for me.
  - Composition: Wrapping a proxy with another one should work as
 expected, i.e. applying both policies in order.
  - Performances: intercepting message sends is slow, intercepting iv
 accesses is even worse (relying on code instrumentation). We would need VM
 support.
  - Security: It shouldn't be possible to by-pass or corrupt a proxy
 policy.

  - Delimited replacement: Ensure that a proxy is always used in place of
 its target throughout the processing of a message send, no matter the alias
 used (that is not necessarily self). Think about a read-only proxy for
 example.

 One thing is a Proxy that ALWAYS sits in between the real object and
 its consumer forwarding messages or doing any other instrumentation,
 and a different thing is a Stub which once materialized replaces all
 references to the proxy with references to the new object
 (#becomeForward:) and then vanishes (GCed).

 Having proxies in hashed collections can get very tricky if the hash
 of the proxy/stub is different from the hash of the materialized
 object.


yes exactly
That is why in Ghost, you can choose what to intercept
because it is application dependent

Luc




 Esteban A. Maringolo




Re: [Pharo-users] Ghost Proxy

2014-05-22 Thread Camille Teruel

On 22 mai 2014, at 22:29, Luc Fabresse luc.fabre...@gmail.com wrote:

 
 
 
 2014-05-22 19:49 GMT+02:00 Camille Teruel camille.ter...@gmail.com:
 
 On 22 mai 2014, at 19:07, Luc Fabresse luc.fabre...@gmail.com wrote:
 
 
 
 
 
 2014-05-22 18:06 GMT+02:00 Camille Teruel camille.ter...@gmail.com:
 
 On 22 mai 2014, at 11:54, stepharo steph...@free.fr wrote:
 
 
  In general, we should think about if is would make sense that the 
  language comes with
  a good proxy model by default.
 
  + 1
  We should do that with Camille.
 
 Yes.
 Now the problem is to agree on what is a good model.
 There is many use cases for proxies and they come with their own models and 
 problems.
 
 yes sure
  
 Here are some requirements I can think of:
 
 - Uniformity: all objects can be wrapped, even special ones (it's a 
 technicality but it's still important)
 - Interception of all message: currently we cannot intercept #== and 
 optimized control-flow messages like #ifTrue:ifFalse #to:do:, #whileTrue:, 
 etc...
 - Encapsulation (a.k.a the self problem): avoid leaking of references to the 
 target. E.g. aProxy yourself should return the proxy not the target.
 - Behavioral intercession: Not everything is a message send. What other 
 events do we want to intercept? IV access is a must-have for me.
 - Composition: Wrapping a proxy with another one should work as expected, 
 i.e. applying both policies in order.
 - Performances: intercepting message sends is slow, intercepting iv accesses 
 is even worse (relying on code instrumentation). We would need VM support.
 - Security: It shouldn't be possible to by-pass or corrupt a proxy policy.
 - Delimited replacement: Ensure that a proxy is always used in place of its 
 target throughout the processing of a message send, no matter the alias used 
 (that is not necessarily self). Think about a read-only proxy for example.
 
 Right now, to intercept messages we have to rely on #cannotInterpret: hack
 
 why do you call it a hack?
 
 Because it's a hijack a safety check of the VM.
 We set the method dictionary of the proxy's class to nil (or of its 
 superclass if the proxy must understand some messages). 
 Since the VM doesn't know what to do with that, it calls #cannotInterpret: 
 starting the lookup in the superclass of that class.
 This superclass then redefines #cannotInterpret: to hand over the message 
 interception to the proxy's handler...
 
 I know the mechanism ;-)

I know you know, but there is many people on this mailing list :). 
It was to stress that we need three indirections (1st lookup, 2nd lookup, 
forward request to handler) where 1 would be enough if done at the vm side.
I call it a hack but it's not pejorative. It's the best we can do without vm 
modification after all.

 but to me it is not hack it is a clever idea that let the programmer to 
 decide what to do at the image side to implement crazy stuff without 
 modifying the VM

That sure is clever and it's great to not have to modify the vm, but modifying 
it to support proxies worth it in my opinion.

 The VM is simple (one interception hook) while it enables to capture a lot of 
 things.
 Of course we can imagine something else at the VM side but the more code in 
 the VM the less flexible it will be
  
 
 do you consider DNU as hack too?
 
 Using it to implement proxies? Yes.
 But in addition, DNU is bad since you can only intercept messages that are 
 not understood.
 And you can also by-pass the message the proxy does understand by sending 
 directly #doesNotUnderstand: to the proxy with a specific message as argument.
 
 we also explained that in the Ghost paper...
 that is why cannotInterpret is better but yet incompelete to capture 
 everything 

Only because of compilation optimizations. It is a real problem for certain 
applications.

  
 
  
 . To intercept iv access or other events we have to rely on code 
 instrumentation and delegation.
 
 yes but I would like to investigate if cannot achieve iv interception using 
 special slots
 
 I doubt we can since it is the target's slots that are taken into account 
 during compilation. 
 Or else every slot in the system must be special = really poor performances.
 
 I have no clear idea yet on that so I must have look and you are certainly 
 right
 
 Luc
 
 
 It would be easier if the VM would allow to create an object that controls 
 its own interpretation (via a metaobject that defines a MOP for example). 
 Such an object should at least be able to specify its message lookup and how 
 to reads and writes IVs.
 And optionally:
 - how it sends messages
 this one is possible with cannotInterpret
 you intercept and then you decide what to do and maybe execute something 
 else so you control message sending
 
 I was talking about interception of message sending (the message the target 
 would have sent) not of interception of message reception (the living wage of 
 any proxy implementation :) ).  
 Like the others events, it also lies at the submethod level.
 

[Pharo-users] TWM keybindings

2014-05-22 Thread Matthew Chadwick
hi, I installed version 3.0.1 of TWM for Pharo3, but the keybindings don't work 
in OSX - any idea what I need to do to make them work ? Cheers. 


Re: [Pharo-users] deep into pharo(esug 2013) translate to korean draft version.

2014-05-22 Thread peter yoo
Deep into Pharo make use xetex.

im dont have latex file. make from my templete.


need more touch. but can use.

thank you for all authur~



look here please.

http://ta.onionmixer.net/wordpress/?attachment_id=265

ps. have a little problem. because wiki2latex using then need check for
some special chracters (ex:^ or *) have a time then check more.


Re: [Pharo-users] Initializing a class with a Dictionary

2014-05-22 Thread Clément Bera
2014-05-22 21:11 GMT+02:00 sergio_101 sergio@gmail.com:

 great! looking at STON next! thanks!

 You can find it in the configuration browser


 On Thu, May 22, 2014 at 2:26 PM, Clément Bera bera.clem...@gmail.comwrote:

 Hello,

 I think you should look at the STON framework. STON looks like JSON for
 smalltalk objects. Basically it does the same as your idea but instead of a
 dictionary it loads fields of an objects from a STON file which looks like
 a JSON file (a STON is kind of an extended Dictionary exported as a string,
 but it has support for more that instance variables).

 Now if you want to go your way, to me what you want to do looks fine.
 These methods can be used for development tools but also for frameworks and
 stuff like that. The thing to do it is to add this method in Object and add
 support so it can work on all objects in the system.

 Object#intializeWithDictionary: aDictionary
 self class isVariable ifTrue: [specific case ?]
 self class isBytes ifTrue: [specific case ?]
 self class isCompiledMethod ifTrue: [specific case ?]
 self class isSmallInteger ifTrue: [specific case]
 aDictionary keysAndValuesDo: [ :key :value |
 self instVarNamed: key put: value ifAbsent: [ self error: 'no ',
 key , ' found'].

 But as you can see there are many specific cases: CompiledMethod, bytes
 objects, word objects, immediate objects, variable-sized objects, weak
 objects and for Pharo 4 even others that you may need to handle in your
 code (Ephemerons, 2bytes and 4 bytes objects).

 If you don't get the specific cases (you may not know programming
 language internals), then imagine how you would make your code work to
 initialize an Array, a ByteArray or a CompiledMethod from a dictionary. Not
 easy, huh ?

 That's why I strongly recommend to use something like STON, because it is
 very easy to use, handle already all the specific cases, well documented
 (Sven always does fancy documentation) and it will be maintained in Pharo 4
 for recent changes (because Sven likes to use the bleeding edge version of
 Pharo).

 Regards,

 Clement


 2014-05-22 19:37 GMT+02:00 sergio_101 sergio@gmail.com:


 is it possible to initialize a class with a dictionary? my first thought
 would be to create a method like:

 intializeWithDictionary: aDictionary

 then, loop through the elements and do something like:

 instVarNamed: key put: value

 but the book says:

 Caveat: Although these methods are useful for building development
 tools, using them to develop conventional applications is a bad idea: these
 reflective methods break the encapsulation boundary of your objects and can
 there- fore make your code much harder to understand and maintain.--

 should i avoid this?


 
 peace,
 sergio
 photographer, journalist, visionary
 #BitMessage BM-2D8VWUJSS41RFKh1ec83preVabHrnniExa

 http://www.Village-Buzz.com
 http://www.ThoseOptimizeGuys.com
 http://www.CodingForHire.com
 http://www.coffee-black.com
 http://www.painlessfrugality.com
 http://www.twitter.com/sergio_101
 http://www.facebook.com/sergio101





 --
 
 peace,
 sergio
 photographer, journalist, visionary
 #BitMessage BM-2D8VWUJSS41RFKh1ec83preVabHrnniExa

 http://www.Village-Buzz.com
 http://www.ThoseOptimizeGuys.com
 http://www.CodingForHire.com
 http://www.coffee-black.com
 http://www.painlessfrugality.com
 http://www.twitter.com/sergio_101
 http://www.facebook.com/sergio101