[squeak-dev] How do I "sleep 5"?
Benoit St-Jean
bstjean at yahoo.com
Fri Feb 24 16:35:07 UTC 2023
On 2023-02-24 04:02, Marcel Taeumel via Squeak-dev wrote:
> Well, common sense does. ;-) Unless we make this a serious discussion
> considering Pros and Cons, such hasty thoughts will get us nowhere.
> From what I have read so far, I assume, that you have no substantial
> experience in writing Morphic applications? I don't know. Sorry, if my
> conclusion offended you. Your kind of shallow call just triggered
> something... :-/
Perhaps I wasn't/precise clear enough : I never seriously considered
replacing Morphic altogether but we must at least recognize that Morphic
could get a bit cleaner. And the Squeak image too! The 6.0 Squeak image
I'm looking at right now has *** 512 ** Morph subclasses ! Do we need
all that stuff? I guess not. If at least we could unload packages in a
*clean* manner, it would make things easier for everyone and facilitate
building smaller runtime images.
I get the idea of "basic Squeak" versus "Squeak with EVERYTHING it has
to offer" but from a user perspective, having 512 subclasses of Morph
can be overwhelming. On the other hand, if it's not in the image, how
can a user easily find that a particular morph is available and exists
in a certain repository/package? If Squeak comes loaded with EVERYTHING
in the image, we should at least provide an *easy* way to unload what we
don't need/want/use : that's not the case right now.
Have you tried unloading EToys just for the fun of it? It should be a
one click or a one-liner thing but it needs its own page of instructions
on the wiki (https://wiki.squeak.org/squeak/2848). One could hear the
complaints against Morphic from Cuis & Pharo and honestly recognize that
there is/was a problem. Why can't we even *suggest* such a thing in
Squeak without being attacked on the mailing list?
And no, I'm not offended and your conclusion/assumption was right: my
Morphic experience is limited
> Maybe because us frequent users of Squeak/Morphic have already
> realized that both Cuis and Pollock are just different and not
> inherently better? Well, I don't know about Pollock. Cuis has
> different goals, backwards compatibility may not be among its most
> important ones.
I think we can say goodbye to portability. Backwards compatibility (from
one Squeak version to another) is a totally different thing though.
>
> It's not that difficult to come up with something different. The first
> weeks might be even fun. After that, you figure out all the corner
> cases and start arguing about compatibility and finding balance within
> the existing community. It is hard work. It is easy to ignore this
> fact in the beginning.
>
> Best,
> Marcel
>>
>> Am 24.02.2023 05:47:30 schrieb Benoit St-Jean via Squeak-dev
>> <squeak-dev at lists.squeakfoundation.org>:
>>
>> Nothing prevents us from replacing Morphic or redesigning it!
>>
>> If Juan was able to do it for Cuis and Sam Shuster was able to design
>> Pollock for VW, what's stopping us from even considering that option?
>>
>>
>> On 2023-02-23 20:14, Stephen Travis Pope wrote:
>>>
>>> Sounds like yet another reason to drop morphic, if you ask me, and
>>> go back to good-old MVC…
>>>
>>> stp
>>>
>>> --------
>>>
>>> Stephen Travis Pope Ojai,California, USA
>>> pastedGraphic.tiff
>>> http://HeavenEverywhere.com
>>> http://FASTLabInc.com
>>> https://vimeo.com/user19434036/videos
>>> http://heaveneverywhere.com/Reflections
>>>
>>>
>>>
>>>> On Feb 23, 2023, at 1:54 PM, Vanessa Freudenberg
>>>> <vanessa at codefrau.net> wrote:
>>>>
>>>> Because Morphic is not multi-thread-clean, you have to be really
>>>> careful how to write the do_something to be reliably executed from
>>>> a different process. You have to coordinate with the UI process. In
>>>> which case it actually becomes simpler to just stay in the UI
>>>> process and use the mechanisms available.
>>>>
>>>> Vanessa
>>>>
>>>> On Thu, Feb 23, 2023 at 11:38 AM Stephen Travis Pope
>>>> <stephen at heaveneverywhere.com> wrote:
>>>>
>>>>
>>>> I’ve been watching this thread and wondering why nobody
>>>> suggests the simplest answer:
>>>>
>>>> [(Delay forSeconds: 5) wait.
>>>> do_something] fork.
>>>>
>>>> stp
>>>>
>>>> --------
>>>>
>>>> Stephen Travis Pope Ojai,California, USA
>>>> <pastedGraphic.tiff>
>>>> http://HeavenEverywhere.com <http://heaveneverywhere.com/>
>>>> http://FASTLabInc.com <http://fastlabinc.com/>
>>>> https://vimeo.com/user19434036/videos
>>>> http://heaveneverywhere.com/Reflections
>>>>
>>>>
>>>>
>>>>> On Feb 22, 2023, at 11:16 AM, karl ramberg
>>>>> <karlramberg at gmail.com> wrote:
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Feb 22, 2023 at 8:47 AM Taeumel, Marcel via Squeak-dev
>>>>> <squeak-dev at lists.squeakfoundation.org> wrote:
>>>>>
>>>>> (bm2 future: 1000) doButtonAction.
>>>>>
>>>>>
>>>>> Also works for objects that are not or cannot be in the world.
>>>>>
>>>>> Uses Morphic alarms when when in UI process.
>>>>>
>>>>> Ah, that's cool. I never used #future: :-)
>>>>>
>>>>> Best,
>>>>> Karl
>>>>>
>>>>>
>>>>> Best,
>>>>> Marcel
>>>>> ------------------------------------------------------------------------
>>>>> *From:* Squeak-dev
>>>>> <squeak-dev-bounces at lists.squeakfoundation.org> on behalf
>>>>> of Eduardo Ochs <eduardoochs at gmail.com>
>>>>> *Sent:* Wednesday, February 22, 2023 7:17:01 AM
>>>>> *To:* The general-purpose Squeak developers list
>>>>> <squeak-dev at lists.squeakfoundation.org>
>>>>> *Subject:* Re: [squeak-dev] How do I "sleep 5"?
>>>>> Hi Karl!
>>>>> Fantastic, thanks! =)
>>>>> I added this to the class in which I'm putting most of my
>>>>> stuff,
>>>>>
>>>>> !See class methodsFor: 'as yet unclassified' stamp: 'Edrx
>>>>> 2/22/2023 02:54'!
>>>>> run: aBlock after: ms
>>>>> | aButton |
>>>>> aButton := SimpleButtonMorph new.
>>>>> aButton openInWorld;
>>>>> hide;
>>>>> target: aBlock;
>>>>> actionSelector: #value;
>>>>> addAlarm: #doButtonAction after: ms.
>>>>> ! !
>>>>>
>>>>> and now I can simply run this
>>>>>
>>>>> See run: [ kf := self currentHand keyboardFocus ] after:
>>>>> 5000.
>>>>>
>>>>> to save into the variable kf the morph on which the
>>>>> keyboard focus is
>>>>> after 5 seconds. Neat! =)
>>>>>
>>>>> Cheers,
>>>>> Eduardo Ochs
>>>>> http://anggtwu.net/eev-squeak.html
>>>>>
>>>>>
>>>>> On Wed, 22 Feb 2023 at 01:56, karl ramberg
>>>>> <karlramberg at gmail.com> wrote:
>>>>>
>>>>> Hi,
>>>>> A morph has to be in the world to be able to interact
>>>>> with it; eg. #openInWorld.
>>>>>
>>>>> If you don't want to see the morph you can send it
>>>>> message #hide. It makes the morph invisible but it's
>>>>> still in the world and can interact with it.
>>>>> To see the morph again send #show.
>>>>> To delete the morph send #delete. The morph will be
>>>>> garbage collected.
>>>>>
>>>>> Best,
>>>>> Karl
>>>>>
>>>>>
>>>>> On Tue, Feb 21, 2023 at 11:57 PM Eduardo Ochs
>>>>> <eduardoochs at gmail.com> wrote:
>>>>>
>>>>> Hi Vanessa!
>>>>> Thanks! =) This works in a workspace,
>>>>>
>>>>> "Create a SimpleSwitchMorph with label 'Toggle'
>>>>> and a SimpleButtonMorph with label 'Flash'.
>>>>> The button will be placed below the switch."
>>>>>
>>>>> sm := SimpleSwitchMorph new.
>>>>> sm openInWorld.
>>>>> bm := SimpleButtonMorph new.
>>>>> bm openInWorld.
>>>>> bm position: bm position + (0 at 32).
>>>>>
>>>>> "Three ways of toggling the color of the switch:"
>>>>>
>>>>> sm toggleState.
>>>>>
>>>>> bl := [ sm toggleState ].
>>>>> bl value.
>>>>>
>>>>> bm target: bl.
>>>>> bm actionSelector: #value.
>>>>> bm doButtonAction.
>>>>>
>>>>> "Two ways of toggling the switch after 1000ms:"
>>>>>
>>>>> sm addAlarm: #toggleState after: 1000.
>>>>> bm addAlarm: #doButtonAction after: 1000.
>>>>>
>>>>> but this doesn't:
>>>>>
>>>>> bm2 := SimpleButtonMorph new.
>>>>> bm2 target: bl.
>>>>> bm2 actionSelector: #value.
>>>>> bm2 addAlarm: #doButtonAction after: 1000.
>>>>>
>>>>> What is the right way to add an alarm to a morph
>>>>> that is not shown on
>>>>> the screen? Also, can I create a new invisible
>>>>> morph every time that I
>>>>> want to run an alarm? Are they going to be garbage
>>>>> collected?
>>>>>
>>>>> Thanks in advance!
>>>>> Eduardo Ochs
>>>>> http://anggtwu.net/eev-squeak.html
>>>>>
>>>>>
>>>>> On Tue, 21 Feb 2023 at 02:16, Vanessa Freudenberg
>>>>> <vanessa at codefrau.net> wrote:
>>>>>
>>>>> The best way to do this in Morphic is with
>>>>> "alarms":
>>>>>
>>>>> self addAlarm: #changeKeyboardFocus after:
>>>>> 5000.
>>>>>
>>>>> which would execute the morph's
>>>>> changeKeyboardFocus method 5 seconds later.
>>>>>
>>>>> The way of sleeping you suggest is possible
>>>>> too but more tricky, since you would have to
>>>>> move your wait code to an extra process to not
>>>>> block the UI process, but then make sure that
>>>>> the actual work is done in the UI process
>>>>> again (Morphic is not multithreaded, although
>>>>> Squeak is).
>>>>>
>>>>> Vanessa
>>>>>
>>>>> On Mon, Feb 20, 2023 at 8:49 PM Eduardo Ochs
>>>>> <eduardoochs at gmail.com> wrote:
>>>>>
>>>>> Hi list,
>>>>>
>>>>> a few days ago I asked for help on how to
>>>>> send a "synthetic" keyboard
>>>>> event to a morph, and Karl Ramberg gave me
>>>>> exactly the right hints in
>>>>> this thread:
>>>>>
>>>>> http://lists.squeakfoundation.org/pipermail/squeak-dev/2023-February/223473.html
>>>>>
>>>>> My code is ready except for documentation
>>>>> and comments - I'll work on
>>>>> that in the next few days and then post
>>>>> the result here and on the
>>>>> wiki...
>>>>>
>>>>> ...but there's a feature that I want to
>>>>> add to it that - again =( -
>>>>> needs something that I'm not being able to
>>>>> discover by myself. How do
>>>>> I write a line of code that waits for 5
>>>>> seconds, sort of like running
>>>>> "sleep 5" in a shell, and that doesn't
>>>>> block the rest of the system?
>>>>> If I have that I'll be able to run these
>>>>> two lines in a workspace,
>>>>>
>>>>> self mySleep: 5000.
>>>>> kf := self currentHand keyboardFocus.
>>>>>
>>>>> switch the keyboard focus to something
>>>>> else by clicking on it, and
>>>>> then the variable kf will be set to this
>>>>> "something else"...
>>>>>
>>>>> Thanks in advance!
>>>>> Eduardo Ochs
>>>>> http://anggtwu.net/eev-squeak.html
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230224/fe0428fc/attachment.html>
More information about the Squeak-dev
mailing list
|