Object>>currentProjectWorld

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

Object>>currentProjectWorld

David T. Lewis
In Object method category *Morphic-Kernel, we currently have three methods:

Object>>currentEvent
        "Answer the current Morphic event.  This method never returns nil."

Object>>currentHand
        "Return a usable HandMorph -- the one associated with the object's current environment."

Object>>currentWorld
        "Answer a morphic world that is the current UI focus."

I want to suggest adding one more method:

Object>>currentProjectWorld
        "Answer a morphic world for the current project."
        ^Project current world

Rationale: In the course of removing direct references to the global variable
World, there are now numerous repetitions of the "Project current world" idiom.
If these are replaced by "self currentProjectWorld", the code is a bit more
readable, and the references to Project current world are easier to find. This
should also make the distinction between #currentWorld and #currentProjectWorld
easier to understand.

Is it OK if I add this method, and replace the current "Project current world"
usage with "self currentProjectWorld" throughout?

Dave


Reply | Threaded
Open this post in threaded view
|

Re: Object>>currentProjectWorld

marcel.taeumel
Hi Dave,

the term "current" in "currentProjectWorld" seems not appropriate for "Project current world" because it is not dynamically scoped like #currentWorld. Also it is not Morphic-API. Would thus be confusing in the long term.

Assuming that currentEvent, currentHand, and currentWorld are in a *Morphic extension, what about adding "Project class >> #currentWorld" instad? Let's not spoil the Object interface more than necessary. :-)

Best,
Marcel

Am 25.11.2017 03:36:13 schrieb David T. Lewis <[hidden email]>:

In Object method category *Morphic-Kernel, we currently have three methods:

Object>>currentEvent
"Answer the current Morphic event. This method never returns nil."

Object>>currentHand
"Return a usable HandMorph -- the one associated with the object's current environment."

Object>>currentWorld
"Answer a morphic world that is the current UI focus."

I want to suggest adding one more method:

Object>>currentProjectWorld
"Answer a morphic world for the current project."
^Project current world

Rationale: In the course of removing direct references to the global variable
World, there are now numerous repetitions of the "Project current world" idiom.
If these are replaced by "self currentProjectWorld", the code is a bit more
readable, and the references to Project current world are easier to find. This
should also make the distinction between #currentWorld and #currentProjectWorld
easier to understand.

Is it OK if I add this method, and replace the current "Project current world"
usage with "self currentProjectWorld" throughout?

Dave




Reply | Threaded
Open this post in threaded view
|

Re: Object>>currentProjectWorld

marcel.taeumel
Hi, all.

Just for clarification: Each kind of project has its own kind of world. It is not specific to Morphic. Look at MVC, SqueakShell, and the generic Project interface. :-)

Best,
Marcel

Am 25.11.2017 08:59:53 schrieb Marcel Taeumel <[hidden email]>:

Hi Dave,

the term "current" in "currentProjectWorld" seems not appropriate for "Project current world" because it is not dynamically scoped like #currentWorld. Also it is not Morphic-API. Would thus be confusing in the long term.

Assuming that currentEvent, currentHand, and currentWorld are in a *Morphic extension, what about adding "Project class >> #currentWorld" instad? Let's not spoil the Object interface more than necessary. :-)

Best,
Marcel

Am 25.11.2017 03:36:13 schrieb David T. Lewis <[hidden email]>:

In Object method category *Morphic-Kernel, we currently have three methods:

Object>>currentEvent
"Answer the current Morphic event. This method never returns nil."

Object>>currentHand
"Return a usable HandMorph -- the one associated with the object's current environment."

Object>>currentWorld
"Answer a morphic world that is the current UI focus."

I want to suggest adding one more method:

Object>>currentProjectWorld
"Answer a morphic world for the current project."
^Project current world

Rationale: In the course of removing direct references to the global variable
World, there are now numerous repetitions of the "Project current world" idiom.
If these are replaced by "self currentProjectWorld", the code is a bit more
readable, and the references to Project current world are easier to find. This
should also make the distinction between #currentWorld and #currentProjectWorld
easier to understand.

Is it OK if I add this method, and replace the current "Project current world"
usage with "self currentProjectWorld" throughout?

Dave




Reply | Threaded
Open this post in threaded view
|

Re: Object>>currentProjectWorld

David T. Lewis
In reply to this post by marcel.taeumel
Hi Marcel,

Yes, putting the method(s) in Project class would be better than having
than Object>>currentProjectWorld. But we already have Object>>currentWorld
that actually refers to ActiveWorld rather than World, so if we add
Project class>>currentWorld to represent World, it would probably just
add confusion.

That leaves me stuck for a good name, because Project class>>currentWorld
would conflict with the meaning of the existing Object>>currentWorld,
and Process class>>world would confict with the meaning of the existing
Morph>>world.

Probably it is best to do nothing at this point. The Project current
world idiom is messy but it least is does mean what it says.

Dave


On Sat, Nov 25, 2017 at 08:59:53AM +0100, Marcel Taeumel wrote:

> Hi Dave,
>
> the term "current" in "currentProjectWorld" seems not appropriate for "Project current world" because it is not dynamically scoped like #currentWorld. Also it is not Morphic-API. Would thus be confusing in the long term.
>
> Assuming that currentEvent, currentHand, and currentWorld are in a *Morphic extension, what about adding "Project class >> #currentWorld" instad? Let's not spoil the Object interface more than necessary. :-)
>
> Best,
> Marcel
> Am 25.11.2017 03:36:13 schrieb David T. Lewis <[hidden email]>:
> In Object method category *Morphic-Kernel, we currently have three methods:
>
> Object>>currentEvent
> "Answer the current Morphic event. This method never returns nil."
>
> Object>>currentHand
> "Return a usable HandMorph -- the one associated with the object's current environment."
>
> Object>>currentWorld
> "Answer a morphic world that is the current UI focus."
>
> I want to suggest adding one more method:
>
> Object>>currentProjectWorld
> "Answer a morphic world for the current project."
> ^Project current world
>
> Rationale: In the course of removing direct references to the global variable
> World, there are now numerous repetitions of the "Project current world" idiom.
> If these are replaced by "self currentProjectWorld", the code is a bit more
> readable, and the references to Project current world are easier to find. This
> should also make the distinction between #currentWorld and #currentProjectWorld
> easier to understand.
>
> Is it OK if I add this method, and replace the current "Project current world"
> usage with "self currentProjectWorld" throughout?
>
> Dave
>
>

>


Reply | Threaded
Open this post in threaded view
|

SqueakShell (was: Object>>currentProjectWorld)

David T. Lewis
In reply to this post by marcel.taeumel
On Sat, Nov 25, 2017 at 09:04:07AM +0100, Marcel Taeumel wrote:
> Hi, all.
>
> Just for clarification: Each kind of project has its own kind of world. It is not specific to Morphic. Look at MVC, SqueakShell, and the generic Project interface. :-)
>

For those who missed the SqueakShell reference, it is:

Installer swa
   project: 'SqueakShell';
   install: 'SqueakShell'.

The repository is http://www.hpi.uni-potsdam.de/hirschfeld/squeaksource/SqueakShell.

This adds another kind of Project that is quite different from either MVC or Morphic.

You can enter a SqueakShell project by evaluating "SqueakShell open". This
will put you into a project with a user interface different from Morphic or
MVC (except of course for the familiar logo). The <esc> key returns you to
your prior Morphic or MVC project.

Dave