[Swift-devel] more data-ordered execution
Ben Clifford
benc at hawaga.org.uk
Thu Oct 30 19:34:21 CDT 2008
I've been working on moving all assignments and mapper parameter
evaluation into a data-ordered mode, rather than the present situation
where some expressions are evaluated as they are first seen and therefore
must be fully evaluatable at that point (without any yet-to-be-initialized
values).
This is a problem which has been around since the dawn of Swift; and seems
to trip people up with some regularity (knowledge of what causes this
problem and what doesn't is somewhat contingent on knowing 'too much'
about the innards of the Swift implementation).
I'm making steady progress, but encountering plenty of stuff on the way
that is stopping this from being a quick fix.
Array assignments: at present, a = [1,2,3] doesn't work or mean anything
outside of a variable declaration. so you can say:
int a[] = [1,2,3];
but not:
int a[];
a=[1,2,3];
I done some work to fix that, though I'm still a little hazy on what the
correct semantics should be for complex data structures involving files.
Having got assignment mostly working, I then change assignment behaviour
so that initialisations in variable declarations are compiled ot the same
code as if their initialisation assignment was separate (so int a = 7; now
evalautes to the code that would have been previously produced by int a; a
= 7; )
For mapper parameters, I make a variable for each mapper parameter, which
is then initialized (as with any variable now) in proper data-dependant
order; and modify data node handling so that mappers are not initialized
until all their parameter variables are closed. This is perhaps not the
most efficient way to do things - at the moment I'm interested in getting
correct behaviour rather than efficiency.
--
More information about the Swift-devel
mailing list