Functional method in object expression throws an error

Defining a functional method in an object expression gives a "Missing
value: f in environment:" message.

component Main
export Executable

run(args) = do
    o = object
        f(self) = ()
    end
end

end

Re: Functional method in object expression throws an error

This is Ticket #126 now.

On Fri, Jun 6, 2008 at 4:01 AM, Sorin Miklós Zsejki <zsejki@...> wrote:
> Defining a functional method in an object expression gives a "Missing
> value: f in environment:" message.
>
> component Main
> export Executable
>
> run(args) = do
>    o = object
>        f(self) = ()
>    end
> end
>
> end
>

David Chase | 6 Jun 05:15

Re: Functional method in object expression throws an error

I have a fix for the declaration already, but I foolishly tried
to actually invoke the functional method, and it did not work so
well.

David

On 2008-06-05, at 10:27 PM, Sorin Miklós Zsejki wrote:

> This is Ticket #126 now.
>
> On Fri, Jun 6, 2008 at 4:01 AM, Sorin Miklós Zsejki  
> <zsejki@...> wrote:
>> Defining a functional method in an object expression gives a "Missing
>> value: f in environment:" message.
>>
>> component Main
>> export Executable
>>
>> run(args) = do
>>   o = object
>>       f(self) = ()
>>   end
>> end
>>
>> end
>>
>

Sukyoung Ryu | 7 Jun 00:12

Re: Functional method in object expression throws an error

To be clear, as the Fortress 1.0 language specification says, "An  
object expression is not allowed to declare “new” functional methods;  
it can provide a functional method only with a name that is already  
declared by one of its supertraits."

However, you indeed found a bug in the interpreter that David fixed in  
revision 1816.  David's new test file conforms to the specification:

component ObjectExprWithFunctionalMethod
export Executable

trait t
   f(self):()
end

run(args) = do
    o = object extends t
        f(self):() = println "PASS"
    end
    f(o)
end
end

Thanks,
--
Sukyoung

On Jun 5, 2008, at 11:15 PM, David Chase wrote:

> I have a fix for the declaration already, but I foolishly tried
(Continue reading)

Re: Functional method in object expression throws an error

Thank you. I wasn't aware of that, but anyway in my real case f was
indeed inherited from a trait.

Now I am not trying to be annoying, but I've found another similar
problem (the message is "Missing value: ObjectExpr at
sample/Main.fss:7.10 in environment:"):

component Main
export Executable

trait X end

trait T
    f() = object extends X end
end

object O() extends T end

run(args) = O().f()

end

On Sat, Jun 7, 2008 at 1:12 AM, Sukyoung Ryu <Sukyoung.Ryu@...> wrote:
> To be clear, as the Fortress 1.0 language specification says, "An object
> expression is not allowed to declare "new" functional methods; it can
> provide a functional method only with a name that is already declared by one
> of its supertraits."
>
> However, you indeed found a bug in the interpreter that David fixed in
> revision 1816.  David's new test file conforms to the specification:
(Continue reading)

Re: Functional method in object expression throws an error

I've just realized that the return type of run() is not (), but that's
not the issue. It does the same for

run(args) = do
    O().f()
    println ""
end

On Sat, Jun 7, 2008 at 2:21 AM, Sorin Miklós Zsejki <zsejki@...> wrote:
> Thank you. I wasn't aware of that, but anyway in my real case f was
> indeed inherited from a trait.
>
> Now I am not trying to be annoying, but I've found another similar
> problem (the message is "Missing value: ObjectExpr at
> sample/Main.fss:7.10 in environment:"):
>
> component Main
> export Executable
>
> trait X end
>
> trait T
>    f() = object extends X end
> end
>
> object O() extends T end
>
> run(args) = O().f()
>
> end
(Continue reading)


Gmane