octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #59405] Feature request: new arguments block s


From: Andrew Janke
Subject: [Octave-bug-tracker] [bug #59405] Feature request: new arguments block syntax for argument validation
Date: Sat, 7 Nov 2020 07:20:23 -0500 (EST)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:81.0) Gecko/20100101 Firefox/81.0

Follow-up Comment #4, bug #59405 (project octave):

> Interestingly, I just checked 
>  iskeyword ('arguments')
> and it returns false on Matlab.

Surprisingly, this is expected. "Contextual" keywords - keywords that only act
as keywords within certain other blocks - are not considered to be keywords by
"iskeyword()". So "properties", "events", "methods", "enumeration", and
"arguments" all return false from iskeyword() in Matlab.

I don't think I would recommend partially implementing this by just ignoring
argument blocks. (At least not by default? Maybe have an opt-in preference for
that behavior?) The arguments block not only checks, but can coerce or convert
the type and size of the input arguments, affecting the function's behavior
and semantics and not just doing the equivalent of assert() checks. So porting
over Matlab code and having it run but ignore arguments blocks could result in
surprising errors, including silently producing incorrect/unexpected results
and not just raising exceptions. (Though that's not _super_ likely IMHO.)

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59405>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]