[prev in list] [next in list] [prev in thread] [next in thread] 

List:       scilab-dev
Subject:    [Scilab-Dev] Recursive extraction on a function's identifier
From:       Samuel Gougeon <sgougeon () free ! fr>
Date:       2019-06-25 11:38:19
Message-ID: 38efbad5-9532-9aeb-7df8-2d15115f6750 () free ! fr
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello,

Let
function s = myfun()
    clear s
    s.a = %pi
    s.b = %z
endfunction

Presently, we get

--> myfun.a
Attempt to reference field of non-structure array.

--> myfun().a
  ans  =
    3.1415927

The type of the symbol myfun as a function is known when calling 
myfun.a, isn't it?

So, is there a technical or a usage reason to not understand implicitly 
myfun.a as myfun().a ?
As well, couldn't we expect an error message routing the user to 
defining %function_e()
(unless Scilab provides a default definition) ?

Thanks
Samuel


[Attachment #5 (text/html)]

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hello,<br>
    <br>
    Let<br>
    <font color="#3333ff"><tt>function s = myfun()</tt><tt><br>
      </tt><tt>   clear s</tt><tt><br>
      </tt><tt>   s.a = %pi</tt><tt><br>
      </tt><tt>   s.b = %z</tt><tt><br>
      </tt><tt>endfunction</tt><br>
    </font>
    <p>Presently, we get<br>
    </p>
    <font color="#3333ff"><tt>--&gt; myfun.a</tt><tt><br>
      </tt><tt>Attempt to reference field of non-structure array.</tt><tt><br>
        <br>
      </tt><tt>--&gt; myfun().a</tt><tt><br>
      </tt><tt> ans  =</tt><tt><br>
      </tt><tt>   3.1415927</tt><br>
    </font><br>
    The type of the symbol myfun as a function is known when calling
    myfun.a, isn't it?<br>
    <p>So, is there a technical or a usage reason to not understand
      implicitly myfun.a as myfun().a ?<br>
      As well, couldn't we expect an error message routing the user to
      defining %function_e() <br>
      (unless Scilab provides a default definition) ?<br>
    </p>
    <p>Thanks<br>
      Samuel<br>
      <br>
    </p>
  </body>
</html>


_______________________________________________
dev mailing list
dev@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic