View mode: basic / threaded / horizontal-split · Log in · Help
December 04, 2012
Re: @property needed or not needed?
On Tuesday, 4 December 2012 at 16:24:27 UTC, Minas Mina wrote:
> Isn't it possible to have parentheses optional only for UFCS?
>
> E.g.
>
> Allow:
> I 5.writeln
>
> Dissallow:
>
> void f()
> {
> 	writeln("hi");
> }
>
> f; // this currently works
>
>
> I don't know if this is possible to implement.


module main;

void f()
{
	writeln("hi");
}

main.f; // OK or not?

I think the argument for vs against is simply a coding style 
issue, some like dropping empty braces, some do not.

--rt
December 04, 2012
Re: @property needed or not needed?
On Tuesday, 4 December 2012 at 16:24:27 UTC, Minas Mina wrote:
> Isn't it possible to have parentheses optional only for UFCS?
>
> E.g.
>
> Allow:
> I 5.writeln
>
> Dissallow:
>
> void f()
> {
> 	writeln("hi");
> }
>
> f; // this currently works
>
>
> I don't know if this is possible to implement.


module main;

void f()
{
	writeln("hi");
}

main.f; // OK or not?

I think the argument for vs against is simply a coding style 
issue, some like dropping empty braces, some do not.

--rt
December 04, 2012
Re: @property needed or not needed?
On Tuesday, 4 December 2012 at 16:24:27 UTC, Minas Mina wrote:
> Isn't it possible to have parentheses optional only for UFCS?
>
> E.g.
>
> Allow:
> I 5.writeln
>
> Dissallow:
>
> void f()
> {
> 	writeln("hi");
> }
>
> f; // this currently works
>
>
> I don't know if this is possible to implement.


module main;

void f()
{
	writeln("hi");
}

main.f; // OK or not?

I think the argument for vs against is simply a coding style 
issue, some like dropping empty braces, some do not.

--rt
December 04, 2012
Re: @property needed or not needed?
>> void f()
>> {
>>     writeln("hi");
>> }
>>
>> f; // this currently works
>>
>>
>> I don't know if this is possible to implement.
>
> I expect it is, perhaps by disallowing calling a property 
> function with no arguments.

It's regular function called as property [getter] of module.
It's nice to have @property like in C#, and permit calling 
without () only to @property.

function without () - property - for simple tasks.
function/procedure/action with () - for resource-intensive tasks.
December 04, 2012
Re: @property needed or not needed?
>> void f()
>> {
>>     writeln("hi");
>> }
>>
>> f; // this currently works
>>
>>
>> I don't know if this is possible to implement.
>
> I expect it is, perhaps by disallowing calling a property 
> function with no arguments.

It's regular function called as property [getter] of module.
It's nice to have @property like in C#, and permit calling 
without () only to @property.

function without () - property - for simple tasks.
function/procedure/action with () - for resource-intensive tasks.
December 04, 2012
Re: @property needed or not needed?
On Tuesday, 4 December 2012 at 16:24:27 UTC, Minas Mina wrote:
> Isn't it possible to have parentheses optional only for UFCS?

That's exactly what Nimrod does ;-). It also allows to leave out 
the () for calls used as a statement (not as an expression).

BTW Nimrod calls it "method call syntax" as there is hardly 
anything "uniform" about putting the first argument in a special 
position.
December 04, 2012
Re: @property needed or not needed?
On Mon, 03 Dec 2012 04:02:15 -0000, Timon Gehr <timon.gehr@gmx.ch> wrote:

> On 12/02/2012 09:19 PM, Regan Heath wrote:
>> On Sun, 02 Dec 2012 18:47:26 -0000, Rob T <rob@ucora.com> wrote:
>>> If someone can honestly demonstrate a non-subjective reason why there
>>> must be a difference between function call and variable assignments,
>>> please show it. So far I've only seen arguments that boil down to "I
>>> don't like it".
>>
>> A variable assignment is in 99% of cases a simple operation.  A function
>> call is in 99% of cases a more complex operation.  Being able to
>> immediately "see" those costs is useful.  A language which allows you to
>> make variable assignments costly will be inherently harder to understand
>> in terms of cost, than a language which does not.
>>
>> R
>>
>
> Costs are understood by profiling and/or detailed analysis, not by  
> looking at trivial syntactic properties.

Exact costs, yes.  But syntactic properties can, and have historically  
also given a good indication of costs and this is useful.  Removing that,  
is less than useful and potentially surprising.

Compare that to what you gain from this change.. nothing useful that I can  
see.

Making variable assignments and function calls look the same buys you  
nothing, you're trying to make apples and oranges look like oranges and  
hide all the nice, useful, detail and distinction you get from having both  
assignments (oranges) and function calls (apples) and all that they imply.

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/
December 05, 2012
Re: @property needed or not needed?
On Tuesday, 4 December 2012 at 16:24:27 UTC, Minas Mina wrote:
> Isn't it possible to have parentheses optional only for UFCS?
>
> E.g.
>
> Allow:
> I 5.writeln
>
> Dissallow:
>
> void f()
> {
> 	writeln("hi");
> }
>
> f; // this currently works
>
>
> I don't know if this is possible to implement.

+1
5.writeln is going to be translated by the compiler as writeln(5) 
anyway, so I think this is a great compromise.
December 05, 2012
Re: @property needed or not needed?
On Tuesday, 4 December 2012 at 21:58:49 UTC, Regan Heath wrote:
> Exact costs, yes.  But syntactic properties can, and have 
> historically also given a good indication of costs and this is 
> useful.  Removing that, is less than useful and potentially 
> surprising.
>
> Compare that to what you gain from this change.. nothing useful 
> that I can see.
>
> Making variable assignments and function calls look the same 
> buys you nothing, you're trying to make apples and oranges look 
> like oranges and hide all the nice, useful, detail and 
> distinction you get from having both assignments (oranges) and 
> function calls (apples) and all that they imply.
>
> R

You can make functions and vars look different through a naming 
convention, and do even more if you choose. The enforcement of 
the empty () as essentially an enforced naming convention.

--rt
December 05, 2012
Re: @property needed or not needed?
On Wed, 05 Dec 2012 16:49:22 -0000, Rob T <rob@ucora.com> wrote:

> On Tuesday, 4 December 2012 at 21:58:49 UTC, Regan Heath wrote:
>> Exact costs, yes.  But syntactic properties can, and have historically  
>> also given a good indication of costs and this is useful.  Removing  
>> that, is less than useful and potentially surprising.
>>
>> Compare that to what you gain from this change.. nothing useful that I  
>> can see.
>>
>> Making variable assignments and function calls look the same buys you  
>> nothing, you're trying to make apples and oranges look like oranges and  
>> hide all the nice, useful, detail and distinction you get from having  
>> both assignments (oranges) and function calls (apples) and all that  
>> they imply.
>>
>> R
>
> You can make functions and vars look different through a naming  
> convention, and do even more if you choose. The enforcement of the empty  
> () as essentially an enforced naming convention.

Yes!

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/
7 8 9 10 11 12 13 14 15
Top | Discussion index | About this forum | D home