[Pharo-project] Loading platform-specific code
In working on ExternalWebBrowser, I got thinking about loading platform-specific (i.e. Mac/Windows) code. ExternalWebBrowser does a check in a class>>initialization, and only installs a library that is required for operation on Macs, if the image is running on a Mac. Something about this feels wrong. I want to be able to put my image and a VM on a USB key and bring it to a client, who may be running on Windows (gasp!), and run the image. It's easy enough to bring or download a VM, but ExternalWebBrowser is now locked in "Mac-mode." In a service with equivalent Windows/Unix-specific requirements, it might be difficult (or impossible) to get it to work. It seems to me better to either: * install all such requirements right off the bat (for one thing - you probably have an internet connection to download them) * or, put a lazy initialization for it, so the first time the functionality is used, the packages are installed. I guess this would depend on there being a single access point to all the platform code. What do you all think? Thanks. Sean -- View this message in context: http://forum.world.st/Loading-platform-specific-code-tp2318610p2318610.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
On 09.08.2010, at 17:02, Sean P. DeNigris wrote:
In working on ExternalWebBrowser, I got thinking about loading platform-specific (i.e. Mac/Windows) code.
ExternalWebBrowser does a check in a class>>initialization, and only installs a library that is required for operation on Macs, if the image is running on a Mac.
Which ExternalWebBrowser do you use? I've checked the newest source which is ExternalWebBrowser-mtf.11.1.mcz on squeaksource. The initialization of ExternalWebBrowser does a Smalltalk addToStartUpList: self. And the code to select the platform specific library is called in startUp. That means the platform should be chosen every time you start your image. Looks perfectly what you want, right? Can you elaborate on the situation where it does not work? Norbert
Something about this feels wrong. I want to be able to put my image and a VM on a USB key and bring it to a client, who may be running on Windows (gasp!), and run the image. It's easy enough to bring or download a VM, but ExternalWebBrowser is now locked in "Mac-mode." In a service with equivalent Windows/Unix-specific requirements, it might be difficult (or impossible) to get it to work.
It seems to me better to either: * install all such requirements right off the bat (for one thing - you probably have an internet connection to download them) * or, put a lazy initialization for it, so the first time the functionality is used, the packages are installed. I guess this would depend on there being a single access point to all the platform code.
What do you all think?
Thanks. Sean -- View this message in context: http://forum.world.st/Loading-platform-specific-code-tp2318610p2318610.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Norbert Hartl wrote:
The initialization of ExternalWebBrowser does a Smalltalk addToStartUpList: self.
Ha ha, I didn't know about startUp. I thought "why the heck is it called startUp"... and changed it to initializeMe! Playing with the image, and thanks to your comment, I just got an interesting education on registering for startup and shutdown - thanks! I'm adding some info to SmalltalkImage's class comment and writing up some sample code. So now the question is: is it better to lazily load external projects required for other platforms, or load them all when you (most probably) have an internet connection? Sean -- View this message in context: http://forum.world.st/Loading-platform-specific-code-tp2318610p2318906.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
On 09.08.2010, at 20:48, Sean P. DeNigris wrote:
Norbert Hartl wrote:
The initialization of ExternalWebBrowser does a Smalltalk addToStartUpList: self.
Ha ha, I didn't know about startUp. I thought "why the heck is it called startUp"... and changed it to initializeMe!
Playing with the image, and thanks to your comment, I just got an interesting education on registering for startup and shutdown - thanks!
I'm adding some info to SmalltalkImage's class comment and writing up some sample code.
So now the question is: is it better to lazily load external projects required for other platforms, or load them all when you (most probably) have an internet connection?
I think I don't fully understand what you mean with "lazily load" and "required for other platforms". But if it is just a choice when to load something then I would do while having a internet connection ;) Norbert
Sean, I didn't read all the thread, but did you know that Metacello let you handle platform specific code? Thus, you can define this in the ConfigurationOFfExternalWebBrowser, and not depend on a class side initialize. cheers mariano On Tue, Aug 10, 2010 at 9:14 AM, Norbert Hartl <norbert@hartl.name> wrote:
On 09.08.2010, at 20:48, Sean P. DeNigris wrote:
Norbert Hartl wrote:
The initialization of ExternalWebBrowser does a Smalltalk addToStartUpList: self.
Ha ha, I didn't know about startUp. I thought "why the heck is it called startUp"... and changed it to initializeMe!
Playing with the image, and thanks to your comment, I just got an interesting education on registering for startup and shutdown - thanks!
I'm adding some info to SmalltalkImage's class comment and writing up
some
sample code.
So now the question is: is it better to lazily load external projects required for other platforms, or load them all when you (most probably) have an internet connection?
I think I don't fully understand what you mean with "lazily load" and "required for other platforms". But if it is just a choice when to load something then I would do while having a internet connection ;)
Norbert
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Mariano Martinez Peck wrote:
...did you know that Metacello let you handle platform specific code?
I'm assuming you mean [Squeak|Pharo...] platform - we're talking [Mac|Windows...] Mariano Martinez Peck wrote:
Thus, you can define this in the ConfigurationOFfExternalWebBrowser, and not depend on a class side initialize.
Yes, it all started when I decided to move the load out of the class>>initialization and into the Config, and I just wanted to poll to see if my thinking was correct. Norbert Hartl wrote:
I think I don't fully understand what you mean with "lazily load" and "required for other platforms". But if it is just a choice when to load something then I would do while having a internet connection ;)
Yes, that is the choice, and that answers the question. Thanks. Sean -- View this message in context: http://forum.world.st/Loading-platform-specific-code-tp2318610p2319751.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
On Tue, Aug 10, 2010 at 3:03 PM, Sean P. DeNigris <sean@clipperadams.com>wrote:
Mariano Martinez Peck wrote:
...did you know that Metacello let you handle platform specific code?
I'm assuming you mean [Squeak|Pharo...] platform - we're talking [Mac|Windows...]
ahhh sorry....and what about conditional loading? and using spec:for or something like that? once I suggested Dale to add OS dependency to Metacello...I don't rememeber what happened.
Mariano Martinez Peck wrote:
Thus, you can define this in the ConfigurationOFfExternalWebBrowser, and not depend on a class side initialize.
Yes, it all started when I decided to move the load out of the class>>initialization and into the Config, and I just wanted to poll to see if my thinking was correct.
Norbert Hartl wrote:
I think I don't fully understand what you mean with "lazily load" and "required for other platforms". But if it is just a choice when to load something then I would do while having a internet connection ;)
Yes, that is the choice, and that answers the question. Thanks.
Sean -- View this message in context: http://forum.world.st/Loading-platform-specific-code-tp2318610p2319751.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Mariano Martinez Peck wrote:
ahhh sorry....and what about conditional loading? and using spec:for or something like that?
After this discussion, it seems to me that the best strategy is to load the required code for all OSes, so the image remains cross-OS. This seems like a better default option, and someone who has special requirements (e.g. a deployment on a specific OS that will never change) can take whatever extra steps to slim it down. Sean -- View this message in context: http://forum.world.st/Loading-platform-specific-code-tp2318610p2320471.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Let's talk about OS dependency at ESUG... Dale Mariano Martinez Peck wrote:
On Tue, Aug 10, 2010 at 3:03 PM, Sean P. DeNigris <sean@clipperadams.com <mailto:sean@clipperadams.com>> wrote:
Mariano Martinez Peck wrote: > > ...did you know that Metacello let you > handle platform specific code? > I'm assuming you mean [Squeak|Pharo...] platform - we're talking [Mac|Windows...]
ahhh sorry....and what about conditional loading? and using spec:for or something like that?
once I suggested Dale to add OS dependency to Metacello...I don't rememeber what happened.
Mariano Martinez Peck wrote: > > Thus, you can define this in the ConfigurationOFfExternalWebBrowser, and > not > depend on a class side initialize. > Yes, it all started when I decided to move the load out of the class>>initialization and into the Config, and I just wanted to poll to see if my thinking was correct.
Norbert Hartl wrote: > > I think I don't fully understand what you mean with "lazily load" and > "required for other platforms". But if it is just a choice when to load > something then I would do while having a internet connection ;) > Yes, that is the choice, and that answers the question. Thanks.
Sean -- View this message in context: http://forum.world.st/Loading-platform-specific-code-tp2318610p2319751.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr <mailto:Pharo-project@lists.gforge.inria.fr> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
On Mon, Aug 23, 2010 at 6:45 PM, Dale Henrichs <dhenrich@vmware.com> wrote:
Let's talk about OS dependency at ESUG...
we should write our to-talk list hahahah
Dale
Mariano Martinez Peck wrote:
On Tue, Aug 10, 2010 at 3:03 PM, Sean P. DeNigris <sean@clipperadams.com<mailto: sean@clipperadams.com>> wrote:
Mariano Martinez Peck wrote: > > ...did you know that Metacello let you > handle platform specific code? > I'm assuming you mean [Squeak|Pharo...] platform - we're talking [Mac|Windows...]
ahhh sorry....and what about conditional loading? and using spec:for or something like that?
once I suggested Dale to add OS dependency to Metacello...I don't rememeber what happened.
Mariano Martinez Peck wrote: > > Thus, you can define this in the ConfigurationOFfExternalWebBrowser, and > not > depend on a class side initialize. > Yes, it all started when I decided to move the load out of the class>>initialization and into the Config, and I just wanted to poll to see if my thinking was correct.
Norbert Hartl wrote: > > I think I don't fully understand what you mean with "lazily load" and > "required for other platforms". But if it is just a choice when to load > something then I would do while having a internet connection ;) > Yes, that is the choice, and that answers the question. Thanks.
Sean -- View this message in context:
http://forum.world.st/Loading-platform-specific-code-tp2318610p2319751.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr <mailto:Pharo-project@lists.gforge.inria.fr>
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Yes it's getting to be about that time:) Dale Mariano Martinez Peck wrote:
On Mon, Aug 23, 2010 at 6:45 PM, Dale Henrichs <dhenrich@vmware.com <mailto:dhenrich@vmware.com>> wrote:
Let's talk about OS dependency at ESUG...
we should write our to-talk list hahahah
Dale
Mariano Martinez Peck wrote:
On Tue, Aug 10, 2010 at 3:03 PM, Sean P. DeNigris <sean@clipperadams.com <mailto:sean@clipperadams.com> <mailto:sean@clipperadams.com <mailto:sean@clipperadams.com>>> wrote:
Mariano Martinez Peck wrote: > > ...did you know that Metacello let you > handle platform specific code? > I'm assuming you mean [Squeak|Pharo...] platform - we're talking [Mac|Windows...]
ahhh sorry....and what about conditional loading? and using spec:for or something like that?
once I suggested Dale to add OS dependency to Metacello...I don't rememeber what happened.
Mariano Martinez Peck wrote: > > Thus, you can define this in the ConfigurationOFfExternalWebBrowser, and > not > depend on a class side initialize. > Yes, it all started when I decided to move the load out of the class>>initialization and into the Config, and I just wanted to poll to see if my thinking was correct.
Norbert Hartl wrote: > > I think I don't fully understand what you mean with "lazily load" and > "required for other platforms". But if it is just a choice when to load > something then I would do while having a internet connection ;) > Yes, that is the choice, and that answers the question. Thanks.
Sean -- View this message in context:
http://forum.world.st/Loading-platform-specific-code-tp2318610p2319751.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr <mailto:Pharo-project@lists.gforge.inria.fr> <mailto:Pharo-project@lists.gforge.inria.fr <mailto:Pharo-project@lists.gforge.inria.fr>>
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
In working on ExternalWebBrowser, I got thinking about loading platform-specific (i.e. Mac/Windows) code.
ExternalWebBrowser does a check in a class>>initialization, and only installs a library that is required for operation on Macs, if the image is running on a Mac.
probably because there was nobody to propose a windows version.
Something about this feels wrong. I want to be able to put my image and a VM on a USB key and bring it to a client, who may be running on Windows (gasp!), and run the image. It's easy enough to bring or download a VM, but ExternalWebBrowser is now locked in "Mac-mode." In a service with equivalent Windows/Unix-specific requirements, it might be difficult (or impossible) to get it to work.
I think that it should work on all the platform but may be there are some constraints.
It seems to me better to either: * install all such requirements right off the bat (for one thing - you probably have an internet connection to download them) * or, put a lazy initialization for it, so the first time the functionality is used, the packages are installed. I guess this would depend on there being a single access point to all the platform code.
What do you all think?
is the logic not specific to mac? ie using apple script (arghhh).
Thanks. Sean -- View this message in context: http://forum.world.st/Loading-platform-specific-code-tp2318610p2318610.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (5)
-
Dale Henrichs -
Mariano Martinez Peck -
Norbert Hartl -
Sean P. DeNigris -
Stéphane Ducasse