<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<font face="Arial">Hello,<br>
<br>
Scilab 6.0 is being to introduce a very specific extraction syntax
for cells. <br>
Is it really worthwhile to do so, when everywhere else Scilab 6.0
tries to remove features that are too specific, and works to
improve consistency?<br>
<br>
When we use a list -- that is the simplest heterogeneous container
-- and address a component of it, <br>
we do it with (). We do not need specific extractors like [] or
{}. <br>
Moreover, this does not return a list with a single component, but
the component itself, unwrapped from its container:<br>
</font><tt>L = list(%pi, %i, %t, "abcd")</tt><tt><br>
</tt><tt>L(2) // => </tt><tt>returns %i, not list(%i)</tt><tt><br>
</tt><tt>-->L(2)</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt> i </tt><tt></tt><tt><br>
</tt><tt>-->typeof(L(2))</tt><tt><br>
</tt><tt> ans =</tt><tt> </tt><tt><br>
</tt><tt> constant </tt><font face="Arial"><br>
<br>
But the syntax that is being introduced for cells with 6.0.0 is
not consistent with that:<br>
</font><tt>C = {%pi %i ; %t "abcd"}</tt><tt><br>
</tt><tt>C(3) // returns a cell instead of directly the component %t</tt><tt><br>
</tt><tt>typeof(C(3))</tt><tt><br>
<br>
// A specific addressing is introduced <i>just to strip off the
cell container </i><i>OR convert it to a list</i>():<br>
</tt><tt><tt><tt><tt>C</tt>{3} // returns %i (...not list(%i))<br>
</tt>C{1,:} // returns list(</tt></tt><tt><tt><tt><tt>%pi, %i)<br>
</tt></tt></tt><br>
</tt><tt>--> C = {%pi %i ; %t "abcd"}</tt><tt><br>
</tt><tt> C = </tt><tt><br>
</tt><tt> [1x1 constant] [1x1 constant]</tt><tt><br>
</tt><tt> [1x1 boolean ] [1x1 string ]</tt><tt><br>
</tt><tt><br>
</tt><tt>--> C(3)</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt> [1x1 constant]</tt><tt><br>
</tt><tt><br>
</tt><tt>--> typeof(C(3))</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt> ce</tt><tt><br>
</tt><tt><br>
</tt><tt>--> C{3}</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt> i</tt><tt><br>
</tt><font face="Arial"><small><br>
<b>After C(3), who will need a cell with a single component,
instead of the component itself?</b></small> <br>
</font><small><font face="Arial">As, again, who after </font></small><font
face="Arial"><tt>L = list(%pi, %i, %t, "abcd"), L(2)</tt></font>
would expect list(%i) instead of %i ? This has never been reported
as a wish.<br>
<br>
When several components are extracted, {} returns a list and
therefore looses the sizes of the extraction. This is a poor result.
<br>
Do we really need to introduce just {} to get it? <br>
To get the same when needed, why not "simply" implementing a similar
behavior of the ":" linearized selector as for lists with <b>C(:)</b>?<br>
Or more simply, a cell2list() function could be applied to
C(i:j,m:n)<br>
<font face="Arial"><tt>
</tt><br>
</font><font face="Arial"><b><font face="Arial"><b>Conclusion: {}
specific extract</b><b>ors</b> </font></b><font
face="Arial">degenerate index addressing, are unhandy and
inconsistent with extraction from a list when only one component
is extracted, and have a poor result when several components are
extracted. As extractors, they should be removed from Scilab 6.0
and kept only as cells constructors</font><b><font face="Arial"><b>.<br>
<br>
</b></font></b></font><font face="Arial">Hoping to read your
own thoughts about that,<br>
<br>
Best regards<br>
Samuel Gougeon<br>
<br>
</font>
</body>
</html>