Loading platform-specific code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Loading platform-specific code

Sean P. DeNigris
Administrator
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
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Loading platform-specific code

NorbertHartl

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
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Loading platform-specific code

Stéphane Ducasse
In reply to this post by Sean P. DeNigris
> 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
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Loading platform-specific code

Sean P. DeNigris
Administrator
In reply to this post by NorbertHartl
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
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Loading platform-specific code

NorbertHartl

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
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Loading platform-specific code

Mariano Martinez Peck
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 <[hidden email]> 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
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Loading platform-specific code

Sean P. DeNigris
Administrator
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
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Loading platform-specific code

Mariano Martinez Peck


On Tue, Aug 10, 2010 at 3:03 PM, Sean P. DeNigris <[hidden email]> 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
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Loading platform-specific code

Sean P. DeNigris
Administrator
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
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: [Metacello] Re: Loading platform-specific code

Dale Henrichs
In reply to this post by Mariano Martinez Peck
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 <[hidden email]
> <mailto:[hidden email]>> 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
>     [hidden email]
>     <mailto:[hidden email]>
>     http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [Metacello] Re: Loading platform-specific code

Mariano Martinez Peck


On Mon, Aug 23, 2010 at 6:45 PM, Dale Henrichs <[hidden email]> 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 <[hidden email] <mailto:[hidden email]>> 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
   [hidden email]
   <mailto:[hidden email]>



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [Metacello] Re: Loading platform-specific code

Dale Henrichs
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 <[hidden email]
> <mailto:[hidden email]>> 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
>         <[hidden email] <mailto:[hidden email]>
>         <mailto:[hidden email] <mailto:[hidden email]>>>
>         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
>            [hidden email]
>         <mailto:[hidden email]>
>            <mailto:[hidden email]
>         <mailto:[hidden email]>>
>
>          
>          http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
>
>


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project