[Nickle] Nickle bug (I think): function reference return sugaring

nickle at po8.org nickle at po8.org
Fri Jan 14 01:46:44 PST 2005


Consider

    > &int f() { return &3; }	

OK, Nickle is happy with this.  But if I try to use it the
way I expected, I get troubles:

    > f()
    &3
    > f() + 1
    Unhandled exception invalid_array_bounds ("Element out of
    range in reference addition", &3, 1)
    <stdin>:3:     f () + 1;
    > *(f()) + 1
    4
    >

In short, for functions, Nickle seems to treat reference
returns just like pointer returns.  I want it to be sugared
like with other kinds of locations:

    > &int x = &3;
    > x
    3
    > x + 1
    4

Am I confused?

	Bart



More information about the Nickle mailing list