[Swift-devel] Problem using @extractint() on derived file
Michael Wilde
wilde at mcs.anl.gov
Tue Feb 24 22:55:49 CST 2009
On 2/24/09 8:23 PM, Ben Clifford wrote:
> On Tue, 24 Feb 2009, Mihael Hategan wrote:
>
>> Yes, this happens because @f can be resolved before f can be, so swift
>> will happily do the extractint before echo finishes.
>>
>> I don't have a solution yet.
>
> extractint probably should be able to take a file parameter, rather than a
> string, and order evaluation properly.
extractint(f) seems to work:
---
type file;
app (file out) echo (string s) { echo s stdout=@out; }
file f = echo("123");
int i = @extractint(f);
trace (i);
---
prints 123
substituting readData for @extractint in the above works as well.
I was confused about what each expected, so perhaps just clarifying the
users guide is whats needed.
> which I think is what readData does (though its not in the test suite, I'm
> told)
>
> so it may be that replacing extractint(@f) with readData(f) (note the
> lack of @) does what is desired
>
> in which case, extractInt can be removed from the language.
>
More information about the Swift-devel
mailing list