_st.js in directory 'support'?

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

_st.js in directory 'support'?

Hannes Hirzel
Hello

the file

contains

define("amber_vm/_st", ["./boot"], function (boot) {
    return boot._st;
});



It defines a module 'amber_vm/_st' and gives back the result of the
module boot.js

What does _st stand for?

A comment would be appreciated.

thank you in advance


Kind regards

Hannes

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: _st.js in directory 'support'?

Manfred Kröhnert
As far as I know this exports a function which exposes the Smalltalk call semantics as a loadable module.
This function is needed by and Amber JS module and is therefore exported separately.

For further details or corrections you would need to ask Herby.

Best,
Manfred





On Fri, Sep 6, 2013 at 4:59 AM, H. Hirzel <[hidden email]> wrote:
Hello

the file

contains

define("amber_vm/_st", ["./boot"], function (boot) {
    return boot._st;
});



It defines a module 'amber_vm/_st' and gives back the result of the
module boot.js

What does _st stand for?

A comment would be appreciated.

thank you in advance


Kind regards

Hannes

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: _st.js in directory 'support'?

Herby Vojčík
In reply to this post by Hannes Hirzel


H. Hirzel wrote:

> Hello
>
> the file
>
> contains
>
> define("amber_vm/_st", ["./boot"], function (boot) {
>      return boot._st;
> });
>
>
>
> It defines a module 'amber_vm/_st' and gives back the result of the
> module boot.js

Gives back its field '_st', to be precise.

> What does _st stand for?

Ask Nico why he chose that title. This is function used all over the
compiled amber code that takes a value and returns proper receiver (null
-> nil, plain JS object -> wrapped JS object, otherwise unchanged). In
one of the recent issues I proposed to change it from _st to simple $,
since it is used very often.

The name of the module just mimicked the name of the variable. It can be
changed, of course.

> Kind regards
>
> Hannes

Herby

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: _st.js in directory 'support'?

Hannes Hirzel
Thank you for the answers so far.

_st appears frequently in compiled code

For example we have in canvas.js


define("amber_core/Canvas",
        ["amber_vm/smalltalk",   // list of modules on which are
necessary for Canvas
        "amber_vm/nil",
        "amber_vm/_st",
        "amber_core/Kernel-Objects",
        "amber_core/Kernel-Infrastructure",
        "amber_core/Kernel-Methods",
        "amber_core/Kernel-Collections"],
        function(smalltalk,nil,_st){                         // the
canvas construction function
                      smalltalk.addPackage('Canvas');
        ......
        }


Is _st the "virtual machine"?

And the definition of the module 'nil' is similar

define("amber_vm/nil", ["./boot"], function (boot) {
    return boot.nil;
});


What is the function of having this nil module?

--Hannes

On 9/6/13, Herby Vojčík <[hidden email]> wrote:

>
>
> H. Hirzel wrote:
>> Hello
>>
>> the file
>>
>> contains
>>
>> define("amber_vm/_st", ["./boot"], function (boot) {
>>      return boot._st;
>> });
>>
>>
>>
>> It defines a module 'amber_vm/_st' and gives back the result of the
>> module boot.js
>
> Gives back its field '_st', to be precise.
>
>> What does _st stand for?
>
> Ask Nico why he chose that title. This is function used all over the
> compiled amber code that takes a value and returns proper receiver (null
> -> nil, plain JS object -> wrapped JS object, otherwise unchanged). In
> one of the recent issues I proposed to change it from _st to simple $,
> since it is used very often.
>
> The name of the module just mimicked the name of the variable. It can be
> changed, of course.
>
>> Kind regards
>>
>> Hannes
>
> Herby
>
> --
> You received this message because you are subscribed to the Google Groups
> "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/groups/opt_out.
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: _st.js in directory 'support'?

Herby Vojčík


H. Hirzel wrote:

> define("amber_core/Canvas",
>          ["amber_vm/smalltalk",   // list of modules on which are
> necessary for Canvas
>          "amber_vm/nil",
>          "amber_vm/_st",
>          "amber_core/Kernel-Objects",
>          "amber_core/Kernel-Infrastructure",
>          "amber_core/Kernel-Methods",
>          "amber_core/Kernel-Collections"],
>          function(smalltalk,nil,_st){                         // the
> canvas construction function
>                        smalltalk.addPackage('Canvas');
>          ......
>          }
>
>
> Is _st the "virtual machine"?

???
What did I do wrong in my previous explanation (really, I want to know)?
I though I explained clearly that it is a function that transforms any value into proper amber receiver... :-/

> And the definition of the module 'nil' is similar
>
> define("amber_vm/nil", ["./boot"], function (boot) {
>      return boot.nil;
> });

Yes, it's the 'nil'.

> What is the function of having this nil modu
le?

The important thing is the
>          function(smalltalk,nil,_st){                         // the
> canvas construction function
which you cited before. Arguments to this function are filled from the modules listed before it. So "amber_vm/smalltalk" module export (that is return value) becomes 'smalltalk', "amber_vm/nil" export becomes 'nil' etc.

Of course, similarly in
> define("amber_vm/nil", ["./boot"], function (boot) {
>      return boot.nil;
> });
the export of "./boot" goes to boot argument.

> --Hannes

Herby

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: _st.js in directory 'support'?

Hannes Hirzel
On 9/6/13, Herby Vojčík <[hidden email]> wrote:

>
>
> H. Hirzel wrote:
>> define("amber_core/Canvas",
>>          ["amber_vm/smalltalk",   // list of modules on which are
>> necessary for Canvas
>>          "amber_vm/nil",
>>          "amber_vm/_st",
>>          "amber_core/Kernel-Objects",
>>          "amber_core/Kernel-Infrastructure",
>>          "amber_core/Kernel-Methods",
>>          "amber_core/Kernel-Collections"],
>>          function(smalltalk,nil,_st){                         // the
>> canvas construction function
>>                        smalltalk.addPackage('Canvas');
>>          ......
>>          }
>>
>>
>> Is _st the "virtual machine"?
>
> ???
> What did I do wrong in my previous explanation (really, I want to know)?
> I though I explained clearly that it is a function that transforms any value
> into proper amber receiver... :-/

Extending what you wrote slightly,
I now understand.


"_st points to a function used all over the compiled amber code that
takes any value (JavaScript or Smalltalk) and returns proper Amber
Smalltalk receivers.

null -> nil,
plain JS object -> wrapped JS object,
otherwise unchanged)."

Correct?

If yes, may I ask you to include this as a comment to _st.js ?

This will enhance the code reading experience when I come back to this
issue in three months because by then I probably will have forgotten.

I can do a pull request, if you like.

>> And the definition of the module 'nil' is similar
>>
>> define("amber_vm/nil", ["./boot"], function (boot) {
>>      return boot.nil;
>> });
>
> Yes, it's the 'nil'.
>
>> What is the function of having this nil modu
> le?
>
> The important thing is the
>>          function(smalltalk,nil,_st){                         // the
>> canvas construction function
> which you cited before. Arguments to this function are filled from the
> modules listed before it. So "amber_vm/smalltalk" module export (that is
> return value) becomes 'smalltalk', "amber_vm/nil" export becomes 'nil' etc.
>
> Of course, similarly in
>> define("amber_vm/nil", ["./boot"], function (boot) {
>>      return boot.nil;
>> });
> the export of "./boot" goes to boot argument.

Thank you for this confirmation. In the meantime (since last Saturday)
I learned enough of require.js to understand constructs like this

define(moduleName, dependencyArray, moduleConstructionFunction)

as well as it's simplifications as

define(moduleName, moduleConstructionFunction)  // no dependencies

and

define(dependencyArray, moduleConstructionFunction)  // no name

or even

define(moduleConstructionFunction)  // no name, no dependencies

see requirejs code
    define = function (name, deps, callback)
and then how the arguments are evaluated.

What I am now aiming at is understanding the amber module hierarchy so
that I can adapt it to my own needs.

Thank you again, Herby,  for your prompt answer.

--Hannes

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: _st.js in directory 'support'?

Herby Vojčík


H. Hirzel wrote:

> On 9/6/13, Herby Vojčík<[hidden email]>  wrote:
>>
>> H. Hirzel wrote:
>>> define("amber_core/Canvas",
>>>           ["amber_vm/smalltalk",   // list of modules on which are
>>> necessary for Canvas
>>>           "amber_vm/nil",
>>>           "amber_vm/_st",
>>>           "amber_core/Kernel-Objects",
>>>           "amber_core/Kernel-Infrastructure",
>>>           "amber_core/Kernel-Methods",
>>>           "amber_core/Kernel-Collections"],
>>>           function(smalltalk,nil,_st){                         // the
>>> canvas construction function
>>>                         smalltalk.addPackage('Canvas');
>>>           ......
>>>           }
>>>
>>>
>>> Is _st the "virtual machine"?
>> ???
>> What did I do wrong in my previous explanation (really, I want to know)?
>> I though I explained clearly that it is a function that transforms any value
>> into proper amber receiver... :-/
>
> Extending what you wrote slightly,
> I now understand.
>
>
> "_st points to a function used all over the compiled amber code that
> takes any value (JavaScript or Smalltalk) and returns proper Amber
> Smalltalk receivers.
>
> null ->  nil,
> plain JS object ->  wrapped JS object,
> otherwise unchanged)."
>
> Correct?
>
> If yes, may I ask you to include this as a comment to _st.js ?
>
> This will enhance the code reading experience when I come back to this
> issue in three months because by then I probably will have forgotten.
>
> I can do a pull request, if you like.

Oh, sure. I am probably giving very dense explanations (I have problems
with this on stackoverflow as well).

But then, to be precise, write "null or undefined -> nil".

> What I am now aiming at is understanding the amber module hierarchy so
> that I can adapt it to my own needs.

Well, I don't think there is any _hierarchy_ there (unless you mean
amber_vm, amber_lib etc. - those are just helper names not to mix
low-level parts of amber with the actual amber packages that have
namespace amber_core; namespace amber (without postfix) is aimed at
user, as seen in the way index.html / helios.html loads). Only
well-defined once are amber_core and amber, very probably also amber_vm
will stay as is; other are subject to change any time, they really just
help to have things in order and having them separated from the point of
directory layout (see
https://github.com/amber-smalltalk/amber/issues/583 which when realized,
amber_lib may be split into bowerable ones and directly included ones).

And of course, if you do your own code, it should be out of amber layout
and have different namespace (not one beginning with 'amber').

> Thank you again, Herby,  for your prompt answer.

np

> --Hannes

Herby

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: _st.js in directory 'support'?

Nicolas Petton
In reply to this post by Hannes Hirzel

"H. Hirzel" <[hidden email]> writes:

> On 9/6/13, Herby Vojčík <[hidden email]> wrote:
>>
>>
>> H. Hirzel wrote:
>>> define("amber_core/Canvas",
>>>          ["amber_vm/smalltalk",   // list of modules on which are
>>> necessary for Canvas
>>>          "amber_vm/nil",
>>>          "amber_vm/_st",
>>>          "amber_core/Kernel-Objects",
>>>          "amber_core/Kernel-Infrastructure",
>>>          "amber_core/Kernel-Methods",
>>>          "amber_core/Kernel-Collections"],
>>>          function(smalltalk,nil,_st){                         // the
>>> canvas construction function
>>>                        smalltalk.addPackage('Canvas');
>>>          ......
>>>          }
>>>
>>>
>>> Is _st the "virtual machine"?
>>
>> ???
>> What did I do wrong in my previous explanation (really, I want to know)?
>> I though I explained clearly that it is a function that transforms any value
>> into proper amber receiver... :-/
>
> Extending what you wrote slightly,
> I now understand.
>
>
> "_st points to a function used all over the compiled amber code that
> takes any value (JavaScript or Smalltalk) and returns proper Amber
> Smalltalk receivers.
>
> null -> nil,
> plain JS object -> wrapped JS object,
> otherwise unchanged)."
>
> Correct?
>
> If yes, may I ask you to include this as a comment to _st.js ?
>
> This will enhance the code reading experience when I come back to this
> issue in three months because by then I probably will have forgotten.
>
> I can do a pull request, if you like.


Ohh, yes, a pull req is *the* way to go ;)

Cheers,
nico

>
>>> And the definition of the module 'nil' is similar
>>>
>>> define("amber_vm/nil", ["./boot"], function (boot) {
>>>      return boot.nil;
>>> });
>>
>> Yes, it's the 'nil'.
>>
>>> What is the function of having this nil modu
>> le?
>>
>> The important thing is the
>>>          function(smalltalk,nil,_st){                         // the
>>> canvas construction function
>> which you cited before. Arguments to this function are filled from the
>> modules listed before it. So "amber_vm/smalltalk" module export (that is
>> return value) becomes 'smalltalk', "amber_vm/nil" export becomes 'nil' etc.
>>
>> Of course, similarly in
>>> define("amber_vm/nil", ["./boot"], function (boot) {
>>>      return boot.nil;
>>> });
>> the export of "./boot" goes to boot argument.
>
> Thank you for this confirmation. In the meantime (since last Saturday)
> I learned enough of require.js to understand constructs like this
>
> define(moduleName, dependencyArray, moduleConstructionFunction)
>
> as well as it's simplifications as
>
> define(moduleName, moduleConstructionFunction)  // no dependencies
>
> and
>
> define(dependencyArray, moduleConstructionFunction)  // no name
>
> or even
>
> define(moduleConstructionFunction)  // no name, no dependencies
>
> see requirejs code
>     define = function (name, deps, callback)
> and then how the arguments are evaluated.
>
> What I am now aiming at is understanding the amber module hierarchy so
> that I can adapt it to my own needs.
>
> Thank you again, Herby,  for your prompt answer.
>
> --Hannes
>
> --
> You received this message because you are subscribed to the Google Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> For more options, visit https://groups.google.com/groups/opt_out.

--
Nicolas Petton
http://nicolas-petton.fr

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: _st.js in directory 'support'?

Hannes Hirzel
On 9/6/13, Nicolas Petton <[hidden email]> wrote:

> Ohh, yes, a pull req is *the* way to go ;)
>


After pull requests
https://github.com/amber-smalltalk/amber/pull/656
Added description of _st function.

https://github.com/amber-smalltalk/amber/pull/657
_st defined directly in its module not in boot.js

(both closed)


the _st module is now 'demystified'. Straightforward to understand. Thank you.

--Hannes

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.