A few cups of coffee this morning led to some enhancements to my DoItFirst utility, so I decided to put in on SqueakSource.
http://www.squeaksource.com/DoItFirst
It works more or less like this:
$ squeak squeak.image -- -help DoItFirst image arguments: -doit argumentlist "evaluate each argument as a doIt expression" -evaluate arg "evaluate arg, print result then exit" -filein filelist "file in each file named in fileList" -cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options" -help "print this message"
Dave
Hi Dave.
Thank you! Looks good.
Here are some thoughts:
- The small footprint of this is awesome! - Since you assume that "FileDirectory startUp" can work in the case of emergency, we should move it further up in the StartUpList. - You are likely to need full support of SmallInteger, Delay, Time, and DateAndTime -- so I suggest moving it after those classes in the StartUpList. I am writing this without looking at the current implementation of their #startUp: methods because it should not matter ... conceptionally. - So, what about putting this into Trunk and having the following elements first in the startup list:
1. SmallInteger 2. Delay 3. Time 4. DateAndTime 5. FileDirectory 6. DoItFirst ...
Best, Marcel Am 14.06.2020 19:15:28 schrieb David T. Lewis lewis@mail.msen.com: A few cups of coffee this morning led to some enhancements to my DoItFirst utility, so I decided to put in on SqueakSource.
http://www.squeaksource.com/DoItFirst
It works more or less like this:
$ squeak squeak.image -- -help DoItFirst image arguments: -doit argumentlist "evaluate each argument as a doIt expression" -evaluate arg "evaluate arg, print result then exit" -filein filelist "file in each file named in fileList" -cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options" -help "print this message"
Dave
Hi Marcel,
I added you and Tim and Eliot as developers in the SS repository, and anyone else is welcome too, though I did not want to make it global writable since this class is dangerous if you make an error in the wrong place ... ask me how I know ;-)
The class is lightweight, but I think we should play with it for a while before considering it for trunk. For now, it's easy enough to load it from SqueakSource. Here's the shortcut:
Installer ss project: 'DoItFirst'; install: 'DoItFirst-System-Support'.
It seems quite possible that a more general argument processing approach may be needed. For example, if I am trying to rescue a broken image, then I want to be able to process a -doit at the earliest possible opportunity, preferably before anything else happens in the startUp list. On the other hand, if I am handling the -filein option, then I might want this to be done much later in the startUp processing.
So let's just play around with this for a while and see what works :-)
Dave
On Sun, Jun 14, 2020 at 07:30:05PM +0200, Marcel Taeumel wrote:
Hi Dave.
Thank you! Looks good.
Here are some thoughts:
- The small footprint of this is awesome!
- Since you assume that "FileDirectory startUp" can work in the case of emergency, we should move it further up in the StartUpList.
- You are likely to need full support of SmallInteger, Delay, Time, and DateAndTime -- so I suggest moving it after those classes in the StartUpList. I am writing this without looking at the current implementation of their #startUp: methods because it should not matter ... conceptionally.
- So, what about putting this into Trunk and having the following elements first in the startup list:
- SmallInteger
- Delay
- Time
- DateAndTime
- FileDirectory
- DoItFirst
...
Best, Marcel Am 14.06.2020 19:15:28 schrieb David T. Lewis lewis@mail.msen.com: A few cups of coffee this morning led to some enhancements to my DoItFirst utility, so I decided to put in on SqueakSource.
http://www.squeaksource.com/DoItFirst
It works more or less like this:
$ squeak squeak.image -- -help DoItFirst image arguments: -doit argumentlist "evaluate each argument as a doIt expression" -evaluate arg "evaluate arg, print result then exit" -filein filelist "file in each file named in fileList" -cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options" -help "print this message"
Dave
preferably before anything else happens in the startUp list.
Well, you may have to set up some state in the VM (or the OS) first, which might have to be communicated from within the image. Like the display depth. Since we cannot know in general, we have to rely on the modules we have in Squeak, which are classes in the start up list. "as early as possible" should therefore translate to "are early as meaningful" :-) We can surely not recover from *all* kinds of errors with a DoItFirst mechanism. But maybe from quite a lot.
Best, Marcel Am 14.06.2020 23:19:57 schrieb David T. Lewis lewis@mail.msen.com: Hi Marcel,
I added you and Tim and Eliot as developers in the SS repository, and anyone else is welcome too, though I did not want to make it global writable since this class is dangerous if you make an error in the wrong place ... ask me how I know ;-)
The class is lightweight, but I think we should play with it for a while before considering it for trunk. For now, it's easy enough to load it from SqueakSource. Here's the shortcut:
Installer ss project: 'DoItFirst'; install: 'DoItFirst-System-Support'.
It seems quite possible that a more general argument processing approach may be needed. For example, if I am trying to rescue a broken image, then I want to be able to process a -doit at the earliest possible opportunity, preferably before anything else happens in the startUp list. On the other hand, if I am handling the -filein option, then I might want this to be done much later in the startUp processing.
So let's just play around with this for a while and see what works :-)
Dave
On Sun, Jun 14, 2020 at 07:30:05PM +0200, Marcel Taeumel wrote:
Hi Dave.
Thank you! Looks good.
Here are some thoughts:
- The small footprint of this is awesome!
- Since you assume that "FileDirectory startUp" can work in the case of emergency, we should move it further up in the StartUpList.
- You are likely to need full support of SmallInteger, Delay, Time, and DateAndTime -- so I suggest moving it after those classes in the StartUpList. I am writing this without looking at the current implementation of their #startUp: methods because it should not matter ... conceptionally.
- So, what about putting this into Trunk and having the following elements first in the startup list:
- SmallInteger
- Delay
- Time
- DateAndTime
- FileDirectory
- DoItFirst
...
Best, Marcel Am 14.06.2020 19:15:28 schrieb David T. Lewis : A few cups of coffee this morning led to some enhancements to my DoItFirst utility, so I decided to put in on SqueakSource.
http://www.squeaksource.com/DoItFirst
It works more or less like this:
$ squeak squeak.image -- -help DoItFirst image arguments: -doit argumentlist "evaluate each argument as a doIt expression" -evaluate arg "evaluate arg, print result then exit" -filein filelist "file in each file named in fileList" -cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options" -help "print this message"
Dave
On Sun, Jun 14, 2020 at 01:15:01PM -0400, David T. Lewis wrote:
A few cups of coffee this morning led to some enhancements to my DoItFirst utility, so I decided to put in on SqueakSource.
I have been updating this since the original post, and I think it is in pretty good shape at this point. Latest version on SqueakSource is DoItFirst-System-Support-dtl.14.mcz.
In order to make this work properly I also add a couple of references to DoItFirst from other class startUp methods. That is messy to add to a MCZ, so I'm attaching a change set containing the latest package plus the two additional startUp calls.
I think this is clean enough to consider adding to trunk now, so if folks think it is a good idea, let me know and I'll add it.
To summarize (from the -help command line option):
DoItFirst image arguments: -doit argumentlist "evaluate each argument as a doIt expression" -evaluate arg "evaluate arg, print result then exit" -filein filelist "file in each file named in fileList" -cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options" -debug "enter a debugger as soon as possible in the startUp processing" -help "print this message"
Dave
This is great! +1 for adding this to trunk, leaving the when to Dave.
Two thoughts:
- Since you've started to "mess" with some #startUp: methods, why not mess with the startUp routine as well? Let's say, you add a flag that lists all items in the startUpList and quits the image. You can then add another flag that lets you choose the position of the DoItFirst class within the list, and insert the class right before processing it (e.g. #processStartUpList:). And by default, the position could be set to some reasonable value (right after SmallInteger, FileStream, et al.). If I don't care about the position, I can just use the default. If I want a special position, I can print the current list and then rerun with an index.
- I don't know how yet, but it'd be cool to be able to cut off the rest of the startUp list with this utility, or exclude certain classes from the startUp list. In TruffleSqueak, for example, we jump through some hoops to set up an image for headless execution [1] and it'd be nice if we could simplify that with your utility.
Cheers, Fabio
[1] https://github.com/hpi-swa/trufflesqueak/blob/4aa371a608bd73e9be1a6c65e727eb...
On Thu, Nov 26, 2020 at 9:01 PM David T. Lewis lewis@mail.msen.com wrote:
On Sun, Jun 14, 2020 at 01:15:01PM -0400, David T. Lewis wrote:
A few cups of coffee this morning led to some enhancements to my
DoItFirst
utility, so I decided to put in on SqueakSource.
I have been updating this since the original post, and I think it is in pretty good shape at this point. Latest version on SqueakSource is DoItFirst-System-Support-dtl.14.mcz.
In order to make this work properly I also add a couple of references to DoItFirst from other class startUp methods. That is messy to add to a MCZ, so I'm attaching a change set containing the latest package plus the two additional startUp calls.
I think this is clean enough to consider adding to trunk now, so if folks think it is a good idea, let me know and I'll add it.
To summarize (from the -help command line option):
DoItFirst image arguments: -doit argumentlist "evaluate each argument as a doIt expression" -evaluate arg "evaluate arg, print result then exit" -filein filelist "file in each file named in fileList" -cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options" -debug "enter a debugger as soon as possible in the startUp processing" -help "print this message"
Dave
On Sat, Dec 05, 2020 at 09:33:26AM +0100, Fabio Niephaus wrote:
This is great! +1 for adding this to trunk, leaving the when to Dave.
Two thoughts:
- Since you've started to "mess" with some #startUp: methods, why not mess
with the startUp routine as well? Let's say, you add a flag that lists all items in the startUpList and quits the image. You can then add another flag that lets you choose the position of the DoItFirst class within the list, and insert the class right before processing it (e.g. #processStartUpList:). And by default, the position could be set to some reasonable value (right after SmallInteger, FileStream, et al.). If I don't care about the position, I can just use the default. If I want a special position, I can print the current list and then rerun with an index.
The way I handled this is by making DoItFirst be the first entry in the startup list, and having it invoke the startUp in other classes if and only if needed to process the command line options. The rationale for this is that the --debug option will enter a debugger at the earliest possible time before encountering any errors that might occur later in the startUp processing. This is a feature that you don't need very often, but when you need it, you really need it.
- I don't know how yet, but it'd be cool to be able to cut off the rest of
the startUp list with this utility, or exclude certain classes from the startUp list. In TruffleSqueak, for example, we jump through some hoops to set up an image for headless execution [1] and it'd be nice if we could simplify that with your utility.
That might be a tricky problem, but I'm sure it can be done. In principle we could manipulate the startup from one of the existing argument hooks, but at that point we are already iterating over the startup list so it is presumably not good to manipulate the list at that time. One possible solution that comes to mind is to move DoItFirst out of the startup list, and just explictly call it right before processing the list.
I note also that we do not have accessors for the StartUpList and ShutDownList, so we would probably want to add these too.
Dave
Cheers, Fabio
[1] https://github.com/hpi-swa/trufflesqueak/blob/4aa371a608bd73e9be1a6c65e727eb...
On Thu, Nov 26, 2020 at 9:01 PM David T. Lewis lewis@mail.msen.com wrote:
On Sun, Jun 14, 2020 at 01:15:01PM -0400, David T. Lewis wrote:
A few cups of coffee this morning led to some enhancements to my
DoItFirst
utility, so I decided to put in on SqueakSource.
I have been updating this since the original post, and I think it is in pretty good shape at this point. Latest version on SqueakSource is DoItFirst-System-Support-dtl.14.mcz.
In order to make this work properly I also add a couple of references to DoItFirst from other class startUp methods. That is messy to add to a MCZ, so I'm attaching a change set containing the latest package plus the two additional startUp calls.
I think this is clean enough to consider adding to trunk now, so if folks think it is a good idea, let me know and I'll add it.
To summarize (from the -help command line option):
DoItFirst image arguments: -doit argumentlist "evaluate each argument as a doIt expression" -evaluate arg "evaluate arg, print result then exit" -filein filelist "file in each file named in fileList" -cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options" -debug "enter a debugger as soon as possible in the startUp processing" -help "print this message"
Dave
On Sun, Dec 06, 2020 at 12:52:39PM -0500, David T. Lewis wrote:
On Sat, Dec 05, 2020 at 09:33:26AM +0100, Fabio Niephaus wrote:
- I don't know how yet, but it'd be cool to be able to cut off the rest of
the startUp list with this utility, or exclude certain classes from the startUp list. In TruffleSqueak, for example, we jump through some hoops to set up an image for headless execution [1] and it'd be nice if we could simplify that with your utility.
That might be a tricky problem, but I'm sure it can be done. In principle we could manipulate the startup from one of the existing argument hooks, but at that point we are already iterating over the startup list so it is presumably not good to manipulate the list at that time. One possible solution that comes to mind is to move DoItFirst out of the startup list, and just explictly call it right before processing the list.
Actually I may have spoken too soon, because the existing --doit option seems to be able to manipulate the startup list directly with no problem at all. For example, I ran this command line:
$ run squeak.image -- --doit 'Smalltalk removeFromStartUpList: PowerManagement' 'Smalltalk removeFromStartUpList: ExtendedClipboardInterface' &
This removed PowerManagement and ExtendedClipboardInterface from the startup list, and the remaining elements of the list were processed without problems.
So as far as I can tell, you will be able to customize the startup list in any way necessary just by adding some --doit snippets on the command line.
Dave
On Sat, Dec 05, 2020 at 09:33:26AM +0100, Fabio Niephaus wrote:
This is great! +1 for adding this to trunk, leaving the when to Dave.
Done.
To see available command line options on a unix-like system:
$ squeak squeak.image -- -h DoItFirst image arguments: --doit argumentlist "evaluate each argument as a doIt expression" --evaluate arg "evaluate arg, print result then exit" --file filename "evaluate contents of filename, print result then exit" --filein filelist "file in each file named in fileList" --cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options" --debug "enter a debugger as soon as possible in the startUp processing" --help "print this message" some arguments have single character synonyms, -f is a synonym for --file, -d for --doit single '-' may be used instead of '--', -help is interpreted as --help
Dave
Hi Dave.
Thanks! Would you mind adding a page on wiki.squeak.org? :-)
Best, Marcel Am 08.12.2020 22:20:25 schrieb David T. Lewis lewis@mail.msen.com: On Sat, Dec 05, 2020 at 09:33:26AM +0100, Fabio Niephaus wrote:
This is great! +1 for adding this to trunk, leaving the when to Dave.
Done.
To see available command line options on a unix-like system:
$ squeak squeak.image -- -h DoItFirst image arguments: --doit argumentlist "evaluate each argument as a doIt expression" --evaluate arg "evaluate arg, print result then exit" --file filename "evaluate contents of filename, print result then exit" --filein filelist "file in each file named in fileList" --cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options" --debug "enter a debugger as soon as possible in the startUp processing" --help "print this message" some arguments have single character synonyms, -f is a synonym for --file, -d for --doit single '-' may be used instead of '--', -help is interpreted as --help
Dave
On Wed, Dec 09, 2020 at 11:23:37AM +0100, Marcel Taeumel wrote:
Hi Dave.
Thanks! Would you mind adding a page on wiki.squeak.org? :-)
Good idea, I will do this some time soon.
Dave
Best, Marcel Am 08.12.2020 22:20:25 schrieb David T. Lewis lewis@mail.msen.com: On Sat, Dec 05, 2020 at 09:33:26AM +0100, Fabio Niephaus wrote:
This is great! +1 for adding this to trunk, leaving the when to Dave.
Done.
To see available command line options on a unix-like system:
$ squeak squeak.image -- -h DoItFirst image arguments: --doit argumentlist "evaluate each argument as a doIt expression" --evaluate arg "evaluate arg, print result then exit" --file filename "evaluate contents of filename, print result then exit" --filein filelist "file in each file named in fileList" --cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options" --debug "enter a debugger as soon as possible in the startUp processing" --help "print this message" some arguments have single character synonyms, -f is a synonym for --file, -d for --doit single '-' may be used instead of '--', -help is interpreted as --help
Dave
On Wed, Dec 09, 2020 at 11:23:37AM +0100, Marcel Taeumel wrote:
Hi Dave.
Thanks! Would you mind adding a page on wiki.squeak.org? :-)
I made a new swiki page for "DoItFirst command option processing":
http://wiki.squeak.org/squeak/6655
I have tried to describe the full process starting with VM command line processing, then later explaining how DoItFirst participates in the process, as well as and how and when it parses and evaluates the command line options that it recognizes.
This has always been a somewhat confusing topic and I am sure that I will have made some errors and omissions, but hopefully this helps to tie the pieces together.
Note that I am writing from the perspective of a VM invoked from unix command line, so some details will be different for other platforms. But the explanations of option processing in the image are applicable for any platform or VM.
Dave
On 2020-12-12, at 10:22 AM, David T. Lewis lewis@mail.msen.com wrote:
On Wed, Dec 09, 2020 at 11:23:37AM +0100, Marcel Taeumel wrote:
Hi Dave.
Thanks! Would you mind adding a page on wiki.squeak.org? :-)
I made a new swiki page for "DoItFirst command option processing":
I made a couple of readability edits that seem to help in Safari - take a look to see if it causes any issues with other browsers. Mostly I changed the really annoyingly ugly --- stuff that gets merged into a single line with non-breaking hyphen, which keeps the little gap and makes it easy to tell a singe - from a --
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim All the simple programs have been written, and all the good names taken.
On Sat, Dec 12, 2020 at 10:52:58AM -0800, tim Rowledge wrote:
On 2020-12-12, at 10:22 AM, David T. Lewis lewis@mail.msen.com wrote:
On Wed, Dec 09, 2020 at 11:23:37AM +0100, Marcel Taeumel wrote:
Hi Dave.
Thanks! Would you mind adding a page on wiki.squeak.org? :-)
I made a new swiki page for "DoItFirst command option processing":
I made a couple of readability edits that seem to help in Safari - take a look to see if it causes any issues with other browsers. Mostly I changed the really annoyingly ugly --- stuff that gets merged into a single line with non-breaking hyphen, which keeps the little gap and makes it easy to tell a singe - from a --
tim
Thanks a lot Tim, it looks good on Firefox.
I don't really want to admit how much time I wasted this morning trying to get those little dash thingies to render on the swiki, thanks for doing it the right way.
Dave
On 2020-12-12, at 11:25 AM, David T. Lewis lewis@mail.msen.com wrote:
I don't really want to admit how much time I wasted this morning trying to get those little dash thingies to render on the swiki,
The page history will reveal how many times it took me...
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful random insult:- If what you don't know can't hurt you, she's practically invulnerable.
squeak-dev@lists.squeakfoundation.org