[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: unified methods
- From: "Russell Y. Webb" <rw20@...>
- Date: Wed, 28 Nov 2001 11:55:09 -0800
> Just in case I was unclear:
>
> table::function() passes no implicit self and would be the same as:
>
> methods(table).function()
>
> table->function() passes an implicit self and would be the same as:
>
> methods(table):function()
>
> That's all there is to it. The use of the :: and -> operator is just to
> mask the methods(table) lookup.
>
> I am unsure exactly of what you were asking, but the :: operator is like
> the C++ :: operator and the -> operator is like the C++ . or ->
> operators.
I see. I guess that illustrates how hard it can be to understand a lot of
interrelated syntaxes.
I was thinking that just by extending the Lua syntax
table::function() -> methods(table):function()
That way the new colon syntax is related to the old mnemonically. From the
C++ perspective your way makes sense, but I don't think asking people to
remember syntax with reference to C++ is a good thing.
Too bad .. is concatenation or you could use t..x and t::x to mean
methods(t).x and methods(t):x respectively.
Russ