Re: [Pharo-users] How to silently generate and remove code
On 05 Apr 2015, at 10:46, Thierry Goubier thierry.goub...@gmail.com wrote: Le 04/04/2015 18:02, stepharo a écrit : Thierry this means that generating ring objects would help you? Maybe. Or maybe unifying Ring with what RB already does with its models (RBClass, etc...), and ensuring that Opal can work with those (at least do the bindings part, count the literals, etc...). I feel like Pharo has three competing ways of modeling software items: MCDefinition stuff, Ring, RB stuff. Yes! We should look at unifying RB and Ring… Marcus
Re: [Pharo-users] How to silently generate and remove code
2015-04-05 15:07 GMT+02:00 Ben Coman b...@openinworld.com: What would be exciting is in a host-image being able to generate an empty special-object Root-Object (like is held by the VM) as a guest-image inside the host-image, so you can push core elements into it until the guest is a running minimal-image, but standard tools can be used to debug it. I guess this might be like the simulator (which I haven't used) - but maybe that just simulates the VM so there are differences. /dreaming you should read Guille's PhD because this is exactly what he did ;-) Luc btw (and just for interest), are there any tutorials for running the simulator. A quick google didn't bring up anything useful. cheers -ben
Re: [Pharo-users] How to silently generate and remove code
On Sun, Apr 5, 2015 at 12:01 AM, stepharo steph...@free.fr wrote: Le 30/3/15 09:10, Marcus Denker a écrit : On 29 Mar 2015, at 10:32, stepharo steph...@free.fr wrote: Before that I would like that the compiler outputs classes definition in an environment (that can be the default one) but that can be the one I want and specified from the outside of the compiler. For installing, it is the ClassInstaller that does that (and yes, it has an environment). What the compiler does not have is to look up references e.g. to symbols regarding to an environment, but that is because we don’t have that concept right now in the system in general. globals/class vars are requested from the class (which defines its environment). So in general, we first need a use case, else it is not clear what to do… Sc1: Imagine that Max wants to load code that if the code is incomplete or contains Undefined the code is not loaded at all. To do so we need to be able to compile the code in a separate namespace. Then on success copy/install to another one. sd := SystemDictionary new. OpalCompiler inputEnvironment: Smalltalk globals outputEnvironment: sd. This shows that probably sd should be linked to Smalltalk globals to be able to find new added class (that will not be found in sd). Sc2: We should be able to compile Opal beside Opal in a sister environment, modify it by compiling method there. Sc3: Guillermo's Tornado Infrastructure. Instead of installing, copying manually and hacking, probably that guillermo needs a compiling infrastructure were we can say - look for literals in this special array or environemtn - look for globals in this one - put the returns in the other literalas environment and globals. Stef What would be exciting is in a host-image being able to generate an empty special-object Root-Object (like is held by the VM) as a guest-image inside the host-image, so you can push core elements into it until the guest is a running minimal-image, but standard tools can be used to debug it. I guess this might be like the simulator (which I haven't used) - but maybe that just simulates the VM so there are differences. /dreaming btw (and just for interest), are there any tutorials for running the simulator. A quick google didn't bring up anything useful. cheers -ben
Re: [Pharo-users] How to silently generate and remove code
Le 04/04/2015 18:02, stepharo a écrit : Thierry this means that generating ring objects would help you? Maybe. Or maybe unifying Ring with what RB already does with its models (RBClass, etc...), and ensuring that Opal can work with those (at least do the bindings part, count the literals, etc...). I feel like Pharo has three competing ways of modeling software items: MCDefinition stuff, Ring, RB stuff. Thierry I guess so. stef Le 30/3/15 16:25, Thierry Goubier a écrit : A use case: the ability to test and debug the code generation part of SmaCC. SmaCC, when compiling a parser, generates dozens of classes and hundreds of methods, some of those very long, as a sequence of refactorings (and optimise them). Then SmaCC apply them all in one step. I'd dream of having a virtual environment where I could test-compile and check all those methods, via a system browser, before they are compiled. Thierry 2015-03-30 9:10 GMT+02:00 Marcus Denker marcus.den...@inria.fr mailto:marcus.den...@inria.fr: On 29 Mar 2015, at 10:32, stepharo steph...@free.fr mailto:steph...@free.fr wrote: Before that I would like that the compiler outputs classes definition in an environment (that can be the default one) but that can be the one I want and specified from the outside of the compiler. For installing, it is the ClassInstaller that does that (and yes, it has an environment). What the compiler does not have is to look up references e.g. to symbols regarding to an environment, but that is because we don’t have that concept right now in the system in general. globals/class vars are requested from the class (which defines its environment). So in general, we first need a use case, else it is not clear what to do… Marcus
Re: [Pharo-users] How to silently generate and remove code
Thierry this means that generating ring objects would help you? I guess so. stef Le 30/3/15 16:25, Thierry Goubier a écrit : A use case: the ability to test and debug the code generation part of SmaCC. SmaCC, when compiling a parser, generates dozens of classes and hundreds of methods, some of those very long, as a sequence of refactorings (and optimise them). Then SmaCC apply them all in one step. I'd dream of having a virtual environment where I could test-compile and check all those methods, via a system browser, before they are compiled. Thierry 2015-03-30 9:10 GMT+02:00 Marcus Denker marcus.den...@inria.fr mailto:marcus.den...@inria.fr: On 29 Mar 2015, at 10:32, stepharo steph...@free.fr mailto:steph...@free.fr wrote: Before that I would like that the compiler outputs classes definition in an environment (that can be the default one) but that can be the one I want and specified from the outside of the compiler. For installing, it is the ClassInstaller that does that (and yes, it has an environment). What the compiler does not have is to look up references e.g. to symbols regarding to an environment, but that is because we don’t have that concept right now in the system in general. globals/class vars are requested from the class (which defines its environment). So in general, we first need a use case, else it is not clear what to do… Marcus
Re: [Pharo-users] How to silently generate and remove code
Le 30/3/15 09:10, Marcus Denker a écrit : On 29 Mar 2015, at 10:32, stepharo steph...@free.fr wrote: Before that I would like that the compiler outputs classes definition in an environment (that can be the default one) but that can be the one I want and specified from the outside of the compiler. For installing, it is the ClassInstaller that does that (and yes, it has an environment). What the compiler does not have is to look up references e.g. to symbols regarding to an environment, but that is because we don’t have that concept right now in the system in general. globals/class vars are requested from the class (which defines its environment). So in general, we first need a use case, else it is not clear what to do… Sc1: Imagine that Max wants to load code that if the code is incomplete or contains Undefined the code is not loaded at all. To do so we need to be able to compile the code in a separate namespace. Then on success copy/install to another one. sd := SystemDictionary new. OpalCompiler inputEnvironment: Smalltalk globals outputEnvironment: sd. This shows that probably sd should be linked to Smalltalk globals to be able to find new added class (that will not be found in sd). Sc2: We should be able to compile Opal beside Opal in a sister environment, modify it by compiling method there. Sc3: Guillermo's Tornado Infrastructure. Instead of installing, copying manually and hacking, probably that guillermo needs a compiling infrastructure were we can say - look for literals in this special array or environemtn - look for globals in this one - put the returns in the other literalas environment and globals. Stef
Re: [Pharo-users] How to silently generate and remove code
On Mar 30, 2015, at 09:23, Christophe Demarey christophe.dema...@inria.fr wrote: Le 30 mars 2015 à 09:10, Marcus Denker a écrit : On 29 Mar 2015, at 10:32, stepharo steph...@free.fr wrote: Before that I would like that the compiler outputs classes definition in an environment (that can be the default one) but that can be the one I want and specified from the outside of the compiler. For installing, it is the ClassInstaller that does that (and yes, it has an environment). What the compiler does not have is to look up references e.g. to symbols regarding to an environment, but that is because we don’t have that concept right now in the system in general. globals/class vars are requested from the class (which defines its environment). So in general, we first need a use case, else it is not clear what to do… A first use case could be to install new code in a sandbox, check if the loading is good, and then move the code to the default environment, else drop the sandbox. It is also a part of the feature asked by Johan: install code in a sandbox for tests purposes and then drop it without perturbing the system. To be clear: I want to be able to generate code (classes and methods in these classes), and remove them when needed without it being logged in the changes file. This is because it may end up to be a lot of code that changes extremely frequently, so it will pollute the change file a lot. And for debugging, I want to be able to see the source for the methods, even though they are not in .changes. (I will never want to version this code nor do anything else ‘serious’ with it, it’s all generated stuff). --- 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] How to silently generate and remove code
On 03/30/2015 09:10 AM, Marcus Denker wrote: What the compiler does not have is to look up references e.g. to symbols regarding to an environment, but that is because we don’t have that concept right now in the system in general. globals/class vars are requested from the class (which defines its environment). So in general, we first need a use case, else it is not clear what to do… Hi Marcus, i dont know whether this really applies to the things you are talking about here, but it sounds a bit like it eventually could, hence i'll mention it: i had a little program, that constructs an array of blocks (no object methods) via opal from scratch (using strings). now this worked of course without problems, but there are situations where it would be nice if those blocks would have - in a _simple_ way - access to common variables constructed by the program, iow if all those blocks would live in the same 'space' as those variables - or however thats called correctly. does this scenario apply as a possible use case (obviously completely different from Johan's use case) ? werner
Re: [Pharo-users] How to silently generate and remove code
A use case: the ability to test and debug the code generation part of SmaCC. SmaCC, when compiling a parser, generates dozens of classes and hundreds of methods, some of those very long, as a sequence of refactorings (and optimise them). Then SmaCC apply them all in one step. I'd dream of having a virtual environment where I could test-compile and check all those methods, via a system browser, before they are compiled. Thierry 2015-03-30 9:10 GMT+02:00 Marcus Denker marcus.den...@inria.fr: On 29 Mar 2015, at 10:32, stepharo steph...@free.fr wrote: Before that I would like that the compiler outputs classes definition in an environment (that can be the default one) but that can be the one I want and specified from the outside of the compiler. For installing, it is the ClassInstaller that does that (and yes, it has an environment). What the compiler does not have is to look up references e.g. to symbols regarding to an environment, but that is because we don't have that concept right now in the system in general. globals/class vars are requested from the class (which defines its environment). So in general, we first need a use case, else it is not clear what to do... Marcus
Re: [Pharo-users] How to silently generate and remove code
Le 30 mars 2015 à 09:10, Marcus Denker a écrit : On 29 Mar 2015, at 10:32, stepharo steph...@free.fr wrote: Before that I would like that the compiler outputs classes definition in an environment (that can be the default one) but that can be the one I want and specified from the outside of the compiler. For installing, it is the ClassInstaller that does that (and yes, it has an environment). What the compiler does not have is to look up references e.g. to symbols regarding to an environment, but that is because we don’t have that concept right now in the system in general. globals/class vars are requested from the class (which defines its environment). So in general, we first need a use case, else it is not clear what to do… A first use case could be to install new code in a sandbox, check if the loading is good, and then move the code to the default environment, else drop the sandbox. It is also a part of the feature asked by Johan: install code in a sandbox for tests purposes and then drop it without perturbing the system. smime.p7s Description: S/MIME cryptographic signature
Re: [Pharo-users] How to silently generate and remove code
On Mar 30, 2015, at 11:01, Werner Kassens wkass...@libello.com wrote: i had a little program, that constructs an array of blocks (no object methods) via opal from scratch (using strings). now this worked of course without problems, but there are situations where it would be nice if those blocks would have - in a _simple_ way - access to common variables constructed by the program, iow if all those blocks would live in the same 'space' as those variables - or however thats called correctly. does this scenario apply as a possible use case (obviously completely different from Johan's use case) ? Werner, let me surprise you: what I am doing is in the end exactly that! :-) I am compiling blocks, written by the user of the system, that need references to variables that are outside the block, and they are shared between the different blocks. (The blocks have been written in a plain text textfield). So how do I have them access the variables? Here is the setup: - I generate a class (MyGeneratedClass) with as *class variables* all the variables that need to be accessed by the different blocks - For each block I generate a string with method source code (myGeneratedMethod_timestamp), whose body is: return the block - I compile the method and add it to MyGeneratedClass class (add it at class side) - I execute each method (MyGeneratedClass myGeneratedMethod_timestamp) , which gives me a BlockContext that has captured the variables. - sending value to that executes the block, and all blocks share the variables in MyGeneratedClass. Simple :-) And thanks to Marcus for discussing this with me a couple of years ago ... --- 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] How to silently generate and remove code
Ok, I noted all the use cases. On 30 Mar 2015, at 16:25, Thierry Goubier thierry.goub...@gmail.com wrote: A use case: the ability to test and debug the code generation part of SmaCC. SmaCC, when compiling a parser, generates dozens of classes and hundreds of methods, some of those very long, as a sequence of refactorings (and optimise them). Then SmaCC apply them all in one step. I'd dream of having a virtual environment where I could test-compile and check all those methods, via a system browser, before they are compiled. Thierry 2015-03-30 9:10 GMT+02:00 Marcus Denker marcus.den...@inria.fr mailto:marcus.den...@inria.fr: On 29 Mar 2015, at 10:32, stepharo steph...@free.fr mailto:steph...@free.fr wrote: Before that I would like that the compiler outputs classes definition in an environment (that can be the default one) but that can be the one I want and specified from the outside of the compiler. For installing, it is the ClassInstaller that does that (and yes, it has an environment). What the compiler does not have is to look up references e.g. to symbols regarding to an environment, but that is because we don’t have that concept right now in the system in general. globals/class vars are requested from the class (which defines its environment). So in general, we first need a use case, else it is not clear what to do… Marcus
Re: [Pharo-users] How to silently generate and remove code
Here is a class that can be of use for you then :-) It’s a bit more complicated than what you need exactly, because I have lexical scoping and subscopes et cetera, but you can ignore that really. The relevant methods for you are generateNamedClass:withSuper: and compileBlock:forScope: Success! LRPCodeGenerator.st Description: Binary data On Mar 30, 2015, at 12:06, Werner Kassens wkass...@libello.com wrote: Hi Johan, g you did surprise me! thanks for that info, i can use that indeed. werner On 03/30/2015 04:47 PM, Johan Fabry wrote: Werner, let me surprise you: what I am doing is in the end exactly that! :-) ... --- 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] How to silently generate and remove code
Hi Johan, thanks, i see how it works and removes the object later. werner On 03/30/2015 06:42 PM, Johan Fabry wrote: Here is a class that can be of use for you then :-)
Re: [Pharo-users] How to silently generate and remove code
Before that I would like that the compiler outputs classes definition in an environment (that can be the default one) but that can be the one I want and specified from the outside of the compiler. May be this is already the case Stef Le 28/3/15 23:03, Marcus Denker a écrit : On 28 Mar 2015, at 20:05, Johan Fabry jfa...@dcc.uchile.cl wrote: On Mar 28, 2015, at 08:06, stepharo steph...@free.fr wrote: Le 28/3/15 08:53, Marcus Denker a écrit : I think we have not yet any good API for this… one problem is that the .changes is not only a transaction log, but in addition the place where the source of a method is stored. I would like to - make transaction log + source storage independent. - add a kind of “virtual” package for these generated entities so that there is no package that gets dirty when generating code reflectively - have a good API so one can distinguishes “system notifications are send” from “change is logged” and “source is stored”. + 1 +1 for that also. Priority for Pharo 5 ? Yes! Marcus
Re: [Pharo-users] How to silently generate and remove code
On Mar 28, 2015, at 08:06, stepharo steph...@free.fr wrote: Le 28/3/15 08:53, Marcus Denker a écrit : I think we have not yet any good API for this… one problem is that the .changes is not only a transaction log, but in addition the place where the source of a method is stored. I would like to - make transaction log + source storage independent. - add a kind of “virtual” package for these generated entities so that there is no package that gets dirty when generating code reflectively - have a good API so one can distinguishes “system notifications are send” from “change is logged” and “source is stored”. + 1 +1 for that also. Priority for Pharo 5 ? --- 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] How to silently generate and remove code
On Mar 28, 2015, at 19:03, Marcus Denker marcus.den...@inria.fr wrote: On 28 Mar 2015, at 20:05, Johan Fabry jfa...@dcc.uchile.cl wrote: On Mar 28, 2015, at 08:06, stepharo steph...@free.fr wrote: Le 28/3/15 08:53, Marcus Denker a écrit : I think we have not yet any good API for this… one problem is that the .changes is not only a transaction log, but in addition the place where the source of a method is stored. I would like to - make transaction log + source storage independent. - add a kind of “virtual” package for these generated entities so that there is no package that gets dirty when generating code reflectively - have a good API so one can distinguishes “system notifications are send” from “change is logged” and “source is stored”. + 1 +1 for that also. Priority for Pharo 5 ? Yes! That sounds like an interesting challenge. Keep me up to date and tell me if I can help! --- 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] How to silently generate and remove code
On 28 Mar 2015, at 20:05, Johan Fabry jfa...@dcc.uchile.cl wrote: On Mar 28, 2015, at 08:06, stepharo steph...@free.fr wrote: Le 28/3/15 08:53, Marcus Denker a écrit : I think we have not yet any good API for this… one problem is that the .changes is not only a transaction log, but in addition the place where the source of a method is stored. I would like to - make transaction log + source storage independent. - add a kind of “virtual” package for these generated entities so that there is no package that gets dirty when generating code reflectively - have a good API so one can distinguishes “system notifications are send” from “change is logged” and “source is stored”. + 1 +1 for that also. Priority for Pharo 5 ? Yes! Marcus
Re: [Pharo-users] How to silently generate and remove code
Le 28/3/15 08:53, Marcus Denker a écrit : I think we have not yet any good API for this… one problem is that the .changes is not only a transaction log, but in addition the place where the source of a method is stored. I would like to - make transaction log + source storage independent. - add a kind of “virtual” package for these generated entities so that there is no package that gets dirty when generating code reflectively - have a good API so one can distinguishes “system notifications are send” from “change is logged” and “source is stored”. + 1 On 27 Mar 2015, at 21:15, Johan Fabry jfa...@dcc.uchile.cl wrote: Hi all, for LRP I am auto generating classes and methods, and removing them when I no longer need them. This however produces a lot of entries in the change file that are not needed at all. So I am looking into generating and removing them silently, however with not much success. Can anybody help me out in how to do the following without having entries in the changes file? - add a class (The standard subclass:instanceVariableNames:classVariableNames:category: message does not seem to have a ‘silent’ equivalent) - remove a class ( aClass removeFromSystem: false. still logs to changes, apparently) - compile a method (aClass compileSilently: methodstring classified: #generated. still logs to changes, apparently) - remove a method (removeSelector: does not seem to have a ‘silent’ option) - add / remove class variables (again, no ‘silent’ option) - run a RBCreateAccessorsForVariableRefactoring Thanks in advance! --- 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] How to silently generate and remove code
Not sure if it is silent enough for you, but perhaps have a look at use of ClassFactoryForTestCase. cheers -ben On Sat, Mar 28, 2015 at 4:15 AM, Johan Fabry jfa...@dcc.uchile.cl wrote: Hi all, for LRP I am auto generating classes and methods, and removing them when I no longer need them. This however produces a lot of entries in the change file that are not needed at all. So I am looking into generating and removing them silently, however with not much success. Can anybody help me out in how to do the following without having entries in the changes file? - add a class (The standard subclass:instanceVariableNames:classVariableNames:category: message does not seem to have a ‘silent’ equivalent) - remove a class ( aClass removeFromSystem: false. still logs to changes, apparently) - compile a method (aClass compileSilently: methodstring classified: #generated. still logs to changes, apparently) - remove a method (removeSelector: does not seem to have a ‘silent’ option) - add / remove class variables (again, no ‘silent’ option) - run a RBCreateAccessorsForVariableRefactoring Thanks in advance! --- 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] How to silently generate and remove code
I think we have not yet any good API for this… one problem is that the .changes is not only a transaction log, but in addition the place where the source of a method is stored. I would like to - make transaction log + source storage independent. - add a kind of “virtual” package for these generated entities so that there is no package that gets dirty when generating code reflectively - have a good API so one can distinguishes “system notifications are send” from “change is logged” and “source is stored”. On 27 Mar 2015, at 21:15, Johan Fabry jfa...@dcc.uchile.cl wrote: Hi all, for LRP I am auto generating classes and methods, and removing them when I no longer need them. This however produces a lot of entries in the change file that are not needed at all. So I am looking into generating and removing them silently, however with not much success. Can anybody help me out in how to do the following without having entries in the changes file? - add a class (The standard subclass:instanceVariableNames:classVariableNames:category: message does not seem to have a ‘silent’ equivalent) - remove a class ( aClass removeFromSystem: false. still logs to changes, apparently) - compile a method (aClass compileSilently: methodstring classified: #generated. still logs to changes, apparently) - remove a method (removeSelector: does not seem to have a ‘silent’ option) - add / remove class variables (again, no ‘silent’ option) - run a RBCreateAccessorsForVariableRefactoring Thanks in advance! --- 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] How to silently generate and remove code
Hi, As far as I know the source code is not stored in the image, but in the changes file. So from that perspective the changes files is more than just logs, it actually store our code, so not recording that entry would be similar as having a method without the actual code. Maybe a possible solution would be a way to clean the change file, but I have no idea if something like that exist. Cheers, Alejandro On Mar 27, 2015, at 5:15 PM, Johan Fabry jfa...@dcc.uchile.cl wrote: Hi all, for LRP I am auto generating classes and methods, and removing them when I no longer need them. This however produces a lot of entries in the change file that are not needed at all. So I am looking into generating and removing them silently, however with not much success. Can anybody help me out in how to do the following without having entries in the changes file? - add a class (The standard subclass:instanceVariableNames:classVariableNames:category: message does not seem to have a ‘silent’ equivalent) - remove a class ( aClass removeFromSystem: false. still logs to changes, apparently) - compile a method (aClass compileSilently: methodstring classified: #generated. still logs to changes, apparently) - remove a method (removeSelector: does not seem to have a ‘silent’ option) - add / remove class variables (again, no ‘silent’ option) - run a RBCreateAccessorsForVariableRefactoring Thanks in advance! --- Save our in-boxes! http://emailcharter.org --- Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile