| Sun Microsystems Laboratories Experimental Stuff | [Fortress-interest] Some observations about the 1.0a spec |
Hi,
I've been reading the 1.0a spec, and have some questions, observations
and think I've spotted a few small errors. First some things that seem
to be missing, no doubt some of these are deliberate and others you have
not got round to adding yet.
Missing? Closures
I think closures can be replaced by syntax expansion, is this so?
e.g.
using(in:Reader = makeReader())
using(out:Writer = makeWriter())
out.write(in.read());
end
end
where closures are used to add a new control structure to the language
that closes its parameter when it goes out of scope and using is defined
something like:
syntax using e end = parseUsingClosure(e)
but this makes defining new closures difficult. It would be nice to use
something like:
using[\ R, T extends Closable, E extends Exception\] ( x:T->R
throws E, T t) throws E = do
try
x(t)
finally
t.close()
end
end
but I don't think this works, and label and exit would not work as
expected for a new control structure.
Missing? Any form of dynamic linkage
This is very useful in Java. It seems that without it many classes of
programs become difficult to impossible to write (e.g. long running
servers with components being added, deleted and modified).
Missing? parametarised throwing of exceptions.
Have I just missed it or not understood the syntax well enough.
Missing? Javadoc equivalent
Very useful.
Missing? deprecated
I think this is needed for long term maintenance of APIs
Missing? Annotations
There seems to be no method of modifying the syntax tree after it is
generated, syntax expanders are identified and expanded before parsing
occurs.
Missing? RTTI
Not needed unless there is dynamic linkage?
Missing? Interface to external code
There seems to be nothing like JNI
various places e.g. section 2.8
for i ??? 1 : 10 do
print(i ??? ???)
end
It seems that juxtaposition of an object with a string converts the
object to a string using the Object toString(): String methd. I couldn't
find this stated explicitly anywhere. My experience is that though this
is OK for quick and dirty output, most of the time formatted IO is much
more useful, that is why C style formatted IO was added to Java, it is
just too useful.
Section 5.10 String Literals
My experience with Java string literals when used as regular expressions
is that they are very difficult to read, as '\' is used as the escape in
the string and also as the escape within the regular expression.
My experience with Java string literals is that they are also less than
ideal for XML (including XML schema) where " is used frequently as in
the value of every attribute.
I think it is worth working out a scheme now to avoid these problems;
XML"<atag>....</atag>"XML might work for XML strings.
Section 11.5 Operator and Identifier Parameters
property ???(a: T, b: T) a.isLeftZero() ???: ((a ??? b) = a)
should this not be:
property ???(a: T, b: T) a.isLeftZero() ???: ((a ??? b) = b)
?
Section 12.1
I don't understand the statement "io : Functions that perform externally
visible input/output actions are said to be io functions. An io function
must not be invoked from a non- io function.", How are they to ever be
called then?
With a function defined as f(a:ZZ, b:ZZ..., c:ZZ=0, d:ZZ=0)
am I right in thinking that
calling f(1,2,3,4,5,6) binds a=1, b=(2,3,4), c=5, d=6
calling f(1,2,3,4) binds a=1, b=(2), c=3, d=4
calling f(1,2,3) binds a=1, b=(2), c=3, d=0
calling f(1,2) binds a=1, b=(2), c=0, d=0
calling f(1) binds b=(), c=0, d=0
?
Section 13.6 Ranges
I assume that 5:2:-1 will give the same range as 2:5 (except when used
in a sequential() generator when it creates the decending sequence 5,4,3,2).
The range 2:5:-1 does not seem to be ruled out by the definitions in
section 13.6, but does not make sense.
Is it possible to use ranges to create infinite sequences? Does
sequential(2:) start at 2 and increment indefinitely?
Section 13.12 & 13.14
I expect that
while Expr do
...
also do
...
also do
...
end
the while loop is to the end, not to the first also do.
Section 22
Am I right in thinking that APIs can never be upgraded?
I would have hoped that a version 2.0 of an API that extends version 1.0
could still be imported wherever used. Something like:
component Com.Sun.IronCrypto
import Fortress.IO.1.0
import Fortress.Security
export Fortress.Crypto
. . .
end
api Fortress.IO.2.0 extends Fortress.IO.1.0
...
end
otherwise the Java situation of having to add extra interfaces to avoid
extending existing ones will occur.
I may have missed it but is there any way of distributing components in
other than source form? If user A creates a compound component is there
any way for him to distribute it to user B other than in source form and
a sequence of compile, link, upgrade commands? Are these compile, link,
upgrade, etc. commands guaranteed to give the same composite component
for user B?
E2
should
opening comment delimiter ???*(??? changes
not be
opening comment delimiter ???(*??? changes
Mike Atkinson
|
This page is: http://www.experimentalstuff.com/pipermail/fortress-interest/2007-January/000064.html Last Modified: Wed, 03 Jan 2007 22:54:02 GMT copyright (c) 2000-2009, Sun Microsystems |