On 02/16/2012 07:10 AM, Caligo wrote:
On Wed, Feb 15, 2012 at 2:26 AM, Jonathan M Davis<jmdavisp...@gmx.com> wrote:
On Tuesday, February 14, 2012 23:38:33 Bill Baxter wrote:
On Tuesday, February 14, 2012 20:47:27 Walter Bright wrote:
* Allow 1.userproperty syntax
Where is this odd-sounding beast documented?
And what is UFCS?
Universal Function Call Syntax. The idea is that any function can be called as
if it were a member function. The member function call syntax that arrays have
is a version of this but isn't general/universal, whereas _universal_ function
call syntax would apply to all types. So, stuff like 1.abs() and 5.max(3)
become legal. It also means that you can declare functions which take a class
or struct as their first parameter and call them as if they were member
functions of that class/struct.
But it can introduce ambiguities - especially when dealing with structs or
classes which can have member functions of their own. So, there's been some
debate as to how it should be implemented - or even _if_ it should be
implemented, though the basic idea is fairly popular.
From the sound of it, at least property functions with integers can now be
used with UFCS, since at least that level of UFCS is required to declare
properties for built-in types.
@property auto prop(int value) { ... }
auto value = 7.prop;
But that's just a guess, asthe changelog obviously isn't very descriptive. So,
I have no idea what exactly has been implemented for that one line in the
changelog - hence my question.
- Jonathan M Davis
float x = 1.f; // GIVES ERROR
float y = 0.f; // OK
what's up with that? Is that a bug?
Yes.