Example A-SIGNATURES Re: A Way to express Standard multi-argument Method Signatures in Smalltalk Re: [ANSI-Smalltalk] Next STEPs

Andres Valloud andres.valloud at gmail.com
Tue Mar 11 10:27:29 GMT 2008


I'd rather see more fully fledged objects.

Andres.

On Tue, Mar 11, 2008 at 1:59 AM, Panu Logic <panulogic at gmail.com> wrote:

>  As an example of  what I call "A-SIGNATURES",  let me propose (as an
> example)
> that the following type-signatures should be part of the Smalltalk
> Standard:
>
> Message -> #=                           ->  Object    ->  Object.
> Message -> #argumentCount                             ->  Integer.
> Message -> #arguments                                 ->  Collection.
> Message -> #arguments:                  ->  Object    ->  self.
> Message -> #asSymbol                                  ->  Symbol.
> Message -> #forwardTo:                  ->  Object    ->  Object.
> Message -> #forwardTo:with:             ->  Object    ->  Object      ->
> Object.
> Message -> #forwardTo:withArguments:    ->  Object    ->  Collection  ->
> Object.
> Message -> #hash                        ->  Integer.
> Message -> #messages                    ->  Collection.
>
> Message -> #printOn:                    ->  Stream      ->  self.
> Message -> #selector                    ->  Symbol.
> Message -> #selector:                   ->  Symbol      ->  self.
> Message -> #setSelector:arguments:      ->  Object      ->  Object  ->
> Object.
> Message -> #value:                      ->  Object      ->  Object.
> Message -> #value:value:                ->  Object      ->  Object  ->
> Object.
> Message -> #valueWithArguments:         ->  Collection  ->  Object.
>
> Message class -> #selector:             ->  Symbol      ->  self.
> Message class -> #selector:argument:    ->  Symbol      ->  Object
> ->  Object.
> Message class -> #selector:arguments:   ->  Symbol      ->  Collection
> ->  Object.
>
>
> The above should be interpreted as follows:
>
> 1.  The last element in each period-separated expression is the
> result-type
>       of the method whose selector is the 3rd token within that
> expression,
>       and whose defining class is the  result of evaluating the 1st token
> of the expression.
>
>      Thus, the above defines the method-signatures of  the class
> "Message", and its meta-class.
>
> 2.  A result type written as 'self' refers to the recipient type (which
> would not be the same
>      as the defining type in the context of signatures inherited to a
> subclass) .
>
> 3. Each of the above expressions results in an in-memory data-structure
> which
>    unambiguously express the signature  of a single method.  The default
> implementation
>    results in a set of connected Associations.
>
> 4. Each class used within the expressions is part of the standard.
>
>
> NOTES:
>
>    - Because each expression above  is compiled by a standard Smalltalk
>    compiler, it becomes easy to detect any possible syntactic errors in them.
>    In other words, we have an easy way to *validate  *specs like this .
>     -
>        - Because each expression evaluates - with a standard
>    Smalltalk compiler -
>    into an in-memory data-structure, it becomes easy to build tools
>    that use, compare or analyze this information.
>       -
>        - The in-memory data-structure contains references to actual
>    classes, not  class-names. Therefore this -syntax does not care what if any
>    package-qualifier syntax might be adopted.  (It also validates that all
>    referred-to classes exist).
>     -
>        - If you have an alternative proposal for the type-signatures
>    of "Message", you can easily modify the above spec, and we can compare our
>    alternatives with a text-diff tool, or perhaps by sorting them in different
>    ways in a spreadsheet program.
>       -
>        - The expressions are quite succinct, yet readable.
>       -
>    - As an implementation detail, the method* #-> *could be redefined
>    for Behavior so that as a side-effect it also compiles and remembers a list
>    of every signature associated with that class.
>
>
>
>
>
> _______________________________________________
> ANSI-Smalltalk mailing list
> ANSI-Smalltalk at lists.openskills.org
> http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openskills.org/pipermail/ansi-smalltalk/attachments/20080311/36edccce/attachment.html


More information about the ANSI-Smalltalk mailing list