::SHE+ILA:: Named Parameters

63
1
  • Squishy Plushie's avatar Artist
    Squishy Pl...
  • DDG Model
    Flux Klein
  • Access
    Public
  • Created
    8h ago
  • Try

Prompt

A beautiful purple-haired woman wearing a long purple velvet ankle-length dress with flouncy sleeves and purple suede high heels. She is holding a small red plushie and a small blue plushie.

More about ::SHE+ILA:: Named Parameters

When calling a procedure in ::SHE+ILA:: , we pass a struct which contains the parameters as an array in parameter order. For example :
Foo (1, 2, squee, "hello", 3.14159);
We may also call the procedure using named parameters :
Foo (yay=1, woo=2, giggle=squee, bar="hello", pie=3.14159);
This uses the fact that a ::SHE+ILA:: struct is a Buf, and also a class instance is also a Buf, and underneath the hood all procedures are really monadic (i.e. they take only a single parameter "%", which itself maybe an array of parameters, i.e. a Buf). So when we pass a Buf whose fields are named, we are actually passing the symbol table (yay, woo, giggle, bar, pie) as well as the value vector (1, 2, squee, "hello", 3.14159). So the procedure can treat it as a record or class, and access its named parameters thus :
%.woo has the value 2
%.yay has the value 1
%.bar has the value "hello"
and so on.
We even get "varargs" for free, because the procedure can determine
how many parameters were passed by using the length operator (#) :
Foo <:: {
HowMany <:: #%; i <:: 1; {* i < HowMany : ttyout ("parameter ", i, " is ", %[i], CRLF); i++; *};
};

::SHE+ILA:: is a homebrew retro operating system and programming language, consisting of a datastore SHE (Segmented Hierarchial Environment) and a datapath ILA (Interactive Language Architecture). Technical documentation is in the descriptions of the artworks tagged #sheila or #sheiladocs.

Comments


Loading Dream Comments...

Discover more dreams from this artist