[Swift-devel] print misbehavin'

Ben Clifford benc at hawaga.org.uk
Thu Apr 12 23:00:23 CDT 2007


On Thu, 12 Apr 2007, Mihael Hategan wrote:

> It translates fine though.
> The issue is Swift data and their toString().

So, turns out that:

print(3) will not work, but

print(1+2) will work.

What happens is that '1' is a constant, which goes through a different 
code path in Karajan.java to '1+2' which is an expression, generating 
these two kml fragments:


                   <print>
                     <parallel>
                       <vdl:new value="3"/>
                     </parallel>
                   </print>


vs

                   <print>
                     <parallel>
                       <sum>
                         <number>1</number>
                         <number>2</number>
                       </sum>
                     </parallel>
                   </print>


So it seems that at least in the simple case, the vdl:new construct is 
unnecessary for basic expressions. I tried removing the special handling 
for constants in Karajan.java so that '3' goes through the same code path 
as '1+2' and so print(3) turns into this code fragment instead:

                   <print>
                     <parallel>
                       <number>3</number>
                     </parallel>
                   </print>


which successfully prints out 3. Hurrah!

I haven't really thought about if this is going to break other more 
complicated stuff yet, so I'm not going to commit this patch yet. But I am 
less frustrated than yesterday ;-)

-- 



More information about the Swift-devel mailing list