Open ProfessorTom opened 6 years ago
Far easier solution, I think, is to return all undeleted variables in reverse (compared to declaration) order.
Better still, have only a "please take <variable> from <function>
" used in the caller's context, with no indication in the called function about what is to be returned. That way, the called function becomes an open book. Any caller can specify which variable it would like to have. Just imagine the code-reuse possibilities.
Better still, have only a "
please take <variable> from <function>
" used in the caller's context, with no indication in the called function about what is to be returned. That way, the called function becomes an open book. Any caller can specify which variable it would like to have. Just imagine the code-reuse possibilities.
but it messes with the Delete
keyword you can't take a delete variable but you must delete all variables or you have one hell of a memory leak.
Better still, have only a "
please take <variable> from <function>
" used in the caller's context, with no indication in the called function about what is to be returned. That way, the called function becomes an open book. Any caller can specify which variable it would like to have. Just imagine the code-reuse possibilities.but it messes with the
Delete
keyword you can't take a delete variable but you must delete all variables or you have one hell of a memory leak.
Using please take <variable> from <function> and clean up
should easily handle deletion of the function's variables when expecting a returned value; all is fine but please clean up
should handle deletion of the function's when no returned value is desired.
After watching the Skills Matter video a non-trivial number of times, I realized that returning values from functions was not addressed.
return
is too easy.I propose that a system similar to INTERCAL's politeness be used for returning values from functions vs. Scala's implied returns (although, implied returns means the return semantics are invisible–a highly desirable feature for BS.). To wit: the key phrase
please give back
in lieu ofreturn
but this must be balanced with the key phrasetake that
ordo the needful
in lieu of return if the compiler detects too much politeness which will be determined by a PRNG-generated percent of correct politeness each time the compiler is invoked, thus causing additional source edits per compile.