All in all, it's about consistence and following the same rules.

Funtions that return shared structure != destructive operations,
but their arguments are dangerous to use after.

Consider:   construct l == l    and     construct l == reverse! l   ,
they are not that different.

There are two possible sets of rules:

Rule set No.1 :

Don't use variable that gives up its ownership.

For example,  l := parts(q)  , the ownership is given to l, so you can't
enqueue! on q anymore.  Unless you use   l := copy parts(q).

Rule set No.2 :

Functions than don't end with a '!' should not modifty or share its (first)
argument.

Then almost all functions should copy its argument internally.  But you
can safely use its return value.


I was proposing we use rule set No.2 and adding some destructive
conterpart (to avoid copying), for example:

   construct l == reverse l
   construct! l == reverse! l
   parts l == copy l
   parts! l == l

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to