On 22/06/2009, at 1:15 AM, john skaller wrote:

> I have solved this problem as follows, the commit got stuffed up
> because I
> still haven't figured out how to get git to re-download files when i
> mess up.
> So I've lost the changes and will have to do them again. The solution
> is basically to add a new combinator
>
>       `BEXPR_address e
>
> which takes the address of an arbitrary expression, and to allow
>
>       lvalue fun subscript[t] : carray[t] * int -> t = "$1[$2]";
>
> and then
>
>       &a.[i]
>
> will work: taking the address of an expression which is an
> application of an lvalue primitive will be allowed.
> Felix functions cannot be lvalue (because Felix has no way
> to return an lvalue).
>
> This solution is "C" like rather than "C++" like, in that
> it is purely syntactic and does not involve the type system.
>
> This means
>
>       a.[i] += 1;
>
> should now work. (Wait for the commit after I do all
> the changes again .. it's not really that much).

Committed, so that this now works:

var a = array_alloc[int] 20;
var i: int; forall i in 0 upto 19 do a.[i] = 0; done
forall i in 0 upto 19 do a.[i]+=i; done
forall i in 0 upto 19 do println a.[i]; done

--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to