8.28: adda/syntax/subroutines:
. should there be syntax to make it clear
that a subroutine is a local symbol?
. should the syntax be the same as for record members ?
. from the object view,
program instantiations are activation records,
and subprogram instantians are extensions
(components) of that act'rec .
[8.29:
. it had prev'ly been decided that algorithm internals
could be accessed with record field notation .
. the question now is how internals can refer to themselves:
it would be useful during collisions among imported names .
. the explicit names could borrow from unix:
just as [./] is the current file directory,
[.`] would be the current activation record,
and [..`] would be the enclosing activation record
(ie, the subroutine's parent scope) .
] .
9.2: adda/syntax/algorithms recur:
. "(self) as a reference to recursion may not be the best choice .
. what about when a type wants a pronoun for its own type?
self might be a good term for that .
. and to use self to refer to algorithms might strike some as not object-oriented,
[9.2: or not even very accurate:
when you do a task, is your task self? no:
the self is either a type`mgt, or a processor .
. instead of "(self) for recursion, use recur .
9.6: adda/syntax/if:
. if b: s;
if ( b: s -- then
, b: s -- elsif/then
, s -- else .
);
. this for those who don't want to use
b ? s;
no? b? s;
no? s .
. nor want to use:
b? (yes: s
, no: b? (yes: s
, no: s
)) .
9.6: adda/type"to/goto`tag`decl':
. there needs to be a way to distinguish between
various uses of colon: (goto tags, case stmt's)
. the goto tag is declaring a new symbol
that names the address of the place it is declared at .
. other uses of colon's are expecting pre-existing symbols .
. one brief way to type-tag a goto tag is "(to)
since that reminds one of an address .
9.6: adda/exceptions/routine-oriented:
. part of a sub's signature needs to be the exceptions it won't catch .
. but this could chg with impl,
since the exceptions it could generate depend on
who it decides to get its services from;
so then need a sub`exception detector:
.(sub; -- run the sub,
exception?
( sub`ex1: s
, sub`ex2: s
, sub`other: [type-specific ex's]
-- for exceptions from sub's servers unspecified .
)
) .
9.6: adda/exceptions/agent-oriented:
. the dialog model of exceptions would be like this:
resume if caller handled exception and requested a resume
no:
that would be a dialog not an exception .
. there are 2 styles of interactions:
. the exception is like the mac`alert .
. the other call-backs are dialogs .
. remember that the user is going through an agent;
eg, the agent typically builds a function call by
presenting an additional param dialog,
and then combining that param with any selected objects
for use as arg's to make a call .
. the agent can also help by turning exceptions into dialogs;
eg, if the app' can't find a file,
the agent can remember the request,
and restart it after asking the user to find it on another volume .
9.9: adda/interface/spec's include stack usage:
. another part of proc signature would be stack useage
as a function of input size .
. this would be a useful option when reusable with other components,
so that you could see if the sum of your components and job size
might put a strain on your memory .
9.11: adda/syntax/loops:
for .. while .. : body
. body can contain for, while without the colon,
and it has the same effect as conditional exit .
. if it has a label with type"loop, then it indicates start of loop,
and the stmt may contain conditional exits that apply to that label .
mis:
. having {while, until} in the loop will be confusing
by looking like a nested loop with a null body .
. better to just have the {exit, enter} stmt's with conditionals
for any controls not in the head of the loop .
9.11: adda/syntax/loop/{for-step-except}:
. the head of a for-loop can have these modifiers:
{step, except}:
. step works like in basic .
. for i.nat except i is odd : ... .
. real step real except eg,asymptotes .
. (step -1) goes in reverse .
9.11: adda/syntax/loop/for-loop with multiple var's:
. for-loops can have multiple var's,
and they sequence all vars in parallel until the one var ends .
eg, for (i= 1, j= 1..2) -- does 1 loop usign param'(i=1, j=1) .
9.22: adda/syntax/loop/mixing for and while:
. to solve that problem where using for and while in the same loop head
was confused with be 2 nested loops,
treat the for() like a bool,
and use it in conjunction with other bools;
eg,
for(control var) .. and (bool) : body
while () and () : body
10.5: adda/syntax/goto:
should be declared as loop.type,
eg, (jmp.loop: ... enter jmp) .
10.7: adda/syntax/goto labeling:
. if a label is not expected to be entred from below,
then it's type is entry else loop.type .
10.16: adda/for.loop and code.literals:
. the for() part implicitely creates a subscope,
and the loop`body -- while usually a code literal --
can also be a symbol of
type expecting an external with the same name as
that created in the for()-part .
. the explicit meaning of this:
(
for(i) and b ?? body
)
would then mean this:
body.!`= '(.<<i>>.<<b>>: body`method(i,b) );
.(
i.t`= i`first,
b ??
( body;
i=i`last ? exit;
i`++
)-loop
)-block .
) .
10.25: adda/syntax/minimalist loops:. if wanting to minimalize reserved symbols,
could rquire all loops to be formed by heading a stmt in a loop.type label,
eg, '(x.loop: body)
and then some sub.stmt in the body
has to be using the enter.stmt .
11.5: adda/syntax/block stmt:
. the block.stmt allows externals undecl'd;
then no way to tell local's decl'd .
.(decl list: code),
(.(params): code),
'(code) .
. use of colon conflicts with use a label,
also, we don't need a decl'section if using
the rule of
we mention type only when intending a declare .
(eg, doing an .( ... i.int ...) declares a new i.int )) .
11.10: adda/sytax/loop/reloop like recur:
. an enter.stmt from within a for-loop
is the same as a goto targeting the bottom of the for-loop;
additionally,
reloop from withing a for-loop re-initializes the for-loop
-- the same as a goto targeting
the line above the for-loop .
. at any given point in a loop
you can either exit loop,
enter loop for next iteration
or continue with current iteration .
. reloop is to loops
what recur is to anonymous functions .
[11.14:
. if it's like that,
then it should be used for nested loops, right?
could also have both: reloop and loop`recur .
]
while-loop with optional control scope:
. the model of a while-loop is
while(truth x) f x,
-- this is one place where externals
are use freq'ly in a block
f has access to an external
that controls its number of loops .
. the while-loop is another place like for-loop
where one should be able to declare
a var in a while`param that is visible to body .
. it might be simpler to keep that in for-part,
but some like to see a for-loop's control var
as not being modifiable by the loop`body .
.( x.truth`= true; for () and x ) ??
body(x);
-- this gives an option to use as control vars
either existing externals or loop-locals .
. in etree (the lisp view of the code)
( .(...)?? b )
--. that is known as a decl-loop.stmt:
decl-loop (head, body),
vs loop(head, body ) .
. it would be simpler to wrap block around loop
instead of integrating it into head;
but, that would be noisy with nested loops
-- this way gives it that c`for-loop compactness .
. what is the syntax of a for-loop that is
using current value of external
and stepping it?
for(x in {x .. limit, step}, ... ) ??
body
for (x.t) declares local x
and steps through all values of its type .
. for (x, y), steps x and y concurrrently .
11.15: adda/syntax/multi-case:
. as in loop,
enter and exit can be used in a case.stmt:
(enter) drops to the next case;
(enter ) goes to a given case;
exit has the same effect as null stmt .
adda/syntax/case:
. case as a reserved word could be a dummy symbol for the case result;
so:
x? (case <= c:...)
the use of case allows relating to arbitrary expr
so if wanting to use vars instead of literals,
use case = var .
. the way to impl adda case could get complicated:
. if the case allows variable goto targets goto x
that actually means having an array of ptr to fun,
exec'ing f#(x),
and generating a function for each case .
. mixing (enter) with (case ranges) could be confusing work .
. in vari-case,
what if multiple cases apply ?
do both in the given order ? .
11.22: adda/syntax/labels:
. to have goto labels be alarming the way ada does,
have a goto.type;
ie, the type's name is an empty dbl-angle.bracket .
. when a 1st-class function
points at a quoted goto symbol,
then the effect of eval
is to jump to the symbol's current value .
. a function that can be assigned a goto.type
must be declared goto.type .
. the way to impl' this in c
requires rolling your own variable goto:
. take all the jump.labels in the block,
and give them an enum value .
. then in the c code,
a variable goto is really a case stmt:
if( var = enum#1 ) goto label#1
else if ....
--
one way to avoid is this:
. divide the code into blocks that are between goto labels;
then jumping to a label has the same effect as
calling all the blocks below that label;
but, it also implies exiting the current routine .
12.9: adda/syntax/exceptions:
. mac-style exceptions are using this model:
. a type'mgt declares exceptions as callback functions;
meaning, they are either undefined or have a default literal,
and can be redefined by the current scope .
. ie, instead of having an ada-style exception section,
you'll see
t`exception#i`= myhandler;
12.14: adda/syntax/case:
. in a case stmt, "(is) can refer to the case:
eg, (is >= x : ...) .
8.24: adda/syntax/sequence generator's optional step:
ReplyDelete. the syntax for stepping:
(start.num) .. (finish.num) step (interval.fixedpoint)
ie, step is a biop that expects its first arg to be a
slice expression whose type is a certain function .