Assert Dfn
24 posts
• Page 3 of 3 • 1, 2, 3
Re: Assert Dfn
Phil Last wrote:Can I infer that a dfn lacking an unassigned expression would terminate with that last assigned, if any, as a shy result? I can imagine this causing a few headaches in debugging.
Yes, that's the behaviour I'd prefer. You may be right about headaches but I haven't noticed any myself.
- Jay|Dyalog
Re: Assert Dfn
Jay|Dyalog wrote:I haven't noticed any myself
Perhaps you don't combine it with "techniques whose sole purpose is to avoid both assignment and termination". I should probably explain why I am so opposed to the trailing colon's use to avoid assignment. The programming reference guide contains:
- Multi-Line Dfns
The single expression which provides the result of the dfn may be preceded by any
number of assignment statements. Each such statement introduces a name which is
local to the function.
- the expression must return zero which is not obvious unless coded as one of
- 0⊣...
{0}...
calledFunction argument: ⍝ commentthat look very much as though they must supply the dfn's result. And I fail to see how the alternative
z←calledFunction argument ⍝ comment
can be "undesired for aesthetic reasons" when it's merely a standard expression as described in the documentation.
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: Assert Dfn
Phil Last wrote:Perhaps you don't combine it with "techniques whose sole purpose is to avoid both assignment and termination".
I should confess that I am also in favour of dfns continuing execution until the last statement, not stopping at the first non-assignment. That would be my preferred way of avoiding unwanted termination. (The last statement would supply the result of the dfn, which would be shy iff the statement was an assignment.)
But, I think it's fair to say, Scholes was never in favour of making this change.
- Jay|Dyalog
Re: Assert Dfn
Jay|Dyalog wrote:Phil Last wrote:Perhaps you don't combine it with "techniques whose sole purpose is to avoid both assignment and termination".
I should confess that I am also in favour of dfns continuing execution until the last statement, not stopping at the first non-assignment. That would be my preferred way of avoiding unwanted termination. (The last statement would supply the result of the dfn, which would be shy iff the statement was an assignment.)
But, I think it's fair to say, Scholes was never in favour of making this change.
Not to mention simplifying .NET calls without an explicit result. No more code like
_←netOB{6::0 ⋄ r←⍺.SomeFooWithoutResult ⍵}''
-
norbertjurkiewicz84 - Posts: 62
- Joined: Mon Nov 01, 2010 7:26 pm
24 posts
• Page 3 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group