[squeak-dev] How to create a 'Hello world' example for environments

H. Hirzel hannes.hirzel at gmail.com
Fri Sep 30 11:29:37 UTC 2016


Starting a new thread, culled from the thread 'What are environments for'.

There are many more good questions and thoughts in the  thread 'What
are environments for' but this thread is just about what the subject
says:

How to create a 'Hello world' example for environments

--Hannes

On 9/29/16, David T. Lewis <lewis at mail.msen.com> wrote:
> On Thu, Sep 29, 2016 at 07:51:23AM +0200, H. Hirzel wrote:
>> On 9/29/16, Jakob Reschke <jakob.reschke at student.hpi.de> wrote:
>> > Hi Nicolas,
>> >
>> > First, thank you for answering me in the other thread.
>> >
>> > 2016-09-28 23:02 GMT+02:00 Nicolas Cellier
>> > <nicolas.cellier.aka.nice at gmail.com>:
>> >> Without clear goals or vision, fixing could essentially mean "let
>> >> Environment be transparent", that is let it remain a promise, a
>> >> potential,
>> >> whithout too many side effects... Not exactly YAGNI, just a bit of
>> >> over-engineered nice piece of code that might serve later. OK this
>> >> sounds
>> >> like a mandatory first step.


>> > I don't quite get what you mean by transparent, other than fixing it
>> > and enhancing the documentation to shed some light on what it is, why
>> > it is there and how to use it.
..
...

>> Another maybe simple use case could be to have a project specific
>> environment set up when you enter a project
>> (http://wiki.squeak.org/squeak/1020).
>>
>> We now have very nicely cleaned up Project code in Squeak 5.1
>>
>> 1) Subclass MorphicProject --- MyMorphicProject
>> 2) Subclass PasteUpMorph  --- MyPasteUpMorph
>> 3) Override #initialize in MyMorphicProject and use MyPasteUpMorph
>> 4) ... some more adaptations ..... to enter a new Environment -- how?
>>
>
> I like this idea a lot.
>
> I would love to see a simple "hello world!" level example of Environments.
> If someone could make an EnvironmentsDemoProject that opens a new project
> with
> something that changes Duck>>speak ==> 'quack' to Duck>>speak ==> 'moo',
> I think it might really help me to understand how to use Environments.
>
> Dave

So let's focus on a 'hello world' example for environments and do it
_slowly_ step by step so that people can catch up with the issues.



Outline of steps of a 'Hello world' environments example
=============================================

Steps


1. subclass Object with a #Hello class.

2. compile a class method #say the method should write 'Hello' to the Transcript

3. run
    Hello say

    The result should be 'Hello' on the Transcript


4. create a new Environment called "myEnvironment".

5. import the Smalltalk environmnet into myEnvironment

6. subclass Object with a #Hello class in myEnvironment

7. compile a method #say the method should write 'Buenas dias' to the Transcript

   run
        Hello say

   Result should be

        30-Sept-2016

Starting a new thread, culled from the thread 'What are environments for'.

There are many more good questions and thoughts in the  thread 'What
are environments for' but this thread is just about what the subject
says:

How to create a 'Hello world' example for environments

--Hannes

On 9/29/16, David T. Lewis <lewis at mail.msen.com> wrote:
> On Thu, Sep 29, 2016 at 07:51:23AM +0200, H. Hirzel wrote:
>> On 9/29/16, Jakob Reschke <jakob.reschke at student.hpi.de> wrote:
>> > Hi Nicolas,
>> >
>> > First, thank you for answering me in the other thread.
>> >
>> > 2016-09-28 23:02 GMT+02:00 Nicolas Cellier
>> > <nicolas.cellier.aka.nice at gmail.com>:
>> >> Without clear goals or vision, fixing could essentially mean "let
>> >> Environment be transparent", that is let it remain a promise, a
>> >> potential,
>> >> whithout too many side effects... Not exactly YAGNI, just a bit of
>> >> over-engineered nice piece of code that might serve later. OK this
>> >> sounds
>> >> like a mandatory first step.


>> > I don't quite get what you mean by transparent, other than fixing it
>> > and enhancing the documentation to shed some light on what it is, why
>> > it is there and how to use it.
..
...

>> Another maybe simple use case could be to have a project specific
>> environment set up when you enter a project
>> (http://wiki.squeak.org/squeak/1020).
>>
>> We now have very nicely cleaned up Project code in Squeak 5.1
>>
>> 1) Subclass MorphicProject --- MyMorphicProject
>> 2) Subclass PasteUpMorph  --- MyPasteUpMorph
>> 3) Override #initialize in MyMorphicProject and use MyPasteUpMorph
>> 4) ... some more adaptations ..... to enter a new Environment -- how?
>>
>
> I like this idea a lot.
>
> I would love to see a simple "hello world!" level example of Environments.
> If someone could make an EnvironmentsDemoProject that opens a new project
> with
> something that changes Duck>>speak ==> 'quack' to Duck>>speak ==> 'moo',
> I think it might really help me to understand how to use Environments.
>
> Dave

So let's focus on a 'hello world' example for environments and do it
_slowly_ step by step so that people can catch up with the issues.



Outline of steps of a 'Hello world' environments example
=============================================

Steps


1. subclass Object with a #Hello class.

2. compile a class method #say the method should write 'Hello' to the Transcript

3. run
    Hello say

    The result should be 'Hello' on the Transcript


4. create a new Environment called "myEnvironment".

5. import the Smalltalk environmnet into myEnvironment

6. subclass Object with a #Hello class in myEnvironment

7. compile a method #say the method should write 'Buenas dias' to the Transcript

   run
        Hello say

    The result should be 'Buenas dias' on the Transcript


8. Leave environment called 'myEnvironment'


9. run
    Hello say

    The result should be this time 'Hello' on the Transcript



Any comments on these steps?


More information about the Squeak-dev mailing list