Re: User defined properties signatures

2015-04-21 Thread Dicebot via Digitalmars-d-learn
This isn't about type system per se but about preferred style of syntax. Original example that caused my hatred looked like this: `let i : uint = from_str("42")`. Fortunately this has been deprecated in favor of `parse` but same principle applies - Rust authors encourage you to use declaration

Re: User defined properties signatures

2015-04-21 Thread Idan Arye via Digitalmars-d-learn
On Tuesday, 21 April 2015 at 13:53:15 UTC, Dicebot wrote: On Tuesday, 21 April 2015 at 13:27:48 UTC, Marc Schütz wrote: On Monday, 20 April 2015 at 20:22:40 UTC, Jonathan M Davis wrote: There may be languages out there which take the the return type into account when overloading, but I've neve

Re: User defined properties signatures

2015-04-21 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 21 April 2015 at 13:27:48 UTC, Marc Schütz wrote: On Monday, 20 April 2015 at 20:22:40 UTC, Jonathan M Davis wrote: There may be languages out there which take the the return type into account when overloading, but I've never seen one. Rust does, as far as I know. And this is in

Re: User defined properties signatures

2015-04-21 Thread via Digitalmars-d-learn
On Monday, 20 April 2015 at 20:22:40 UTC, Jonathan M Davis wrote: There may be languages out there which take the the return type into account when overloading, but I've never seen one. Rust does, as far as I know. I don't think that the ambiguities are an insurmountable obstacle. It's proba

Re: User defined properties signatures

2015-04-20 Thread dvic via Digitalmars-d-learn
On Monday, 20 April 2015 at 20:22:40 UTC, Jonathan M Davis wrote: On Monday, April 20, 2015 19:42:30 dvic via Digitalmars-d-learn wrote: Thanks for your answer Jonathan. But does the return type part of a method signature? I don't know what theory is claiming about that, but for me they are 2 d

Re: User defined properties signatures

2015-04-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 20, 2015 19:42:30 dvic via Digitalmars-d-learn wrote: > Thanks for your answer Jonathan. But does the return type part of > a method > signature? I don't know what theory is claiming about that, but > for me they > are 2 different methods. So contextually, the best fit should > pre

Re: User defined properties signatures

2015-04-20 Thread dvic via Digitalmars-d-learn
On Monday, 20 April 2015 at 18:50:31 UTC, Jonathan M Davis wrote: On Monday, April 20, 2015 18:35:34 dvic via Digitalmars-d-learn wrote: Hi guys, It seems it's possible to define different read properties, only differing by the return type. Not possible. Just like pretty much any C-derived

Re: User defined properties signatures

2015-04-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/20/15 2:50 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Monday, April 20, 2015 18:35:34 dvic via Digitalmars-d-learn wrote: Why is the compiler not complaining about defining 2 read properties and it does otherwise when using both of them? Now, that is weird. I would fully exp

Re: User defined properties signatures

2015-04-20 Thread Ali Çehreli via Digitalmars-d-learn
On 04/20/2015 11:35 AM, dvic wrote: > @property string value() { return m_value; } // m_value is a string > @property int value() { return to!int(m_value); } Yes, as Jonathan M Davis said, that's weird. > But when using it in writefln() or assert for example, compiler (dmd) > complains > about

Re: User defined properties signatures

2015-04-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, April 20, 2015 18:35:34 dvic via Digitalmars-d-learn wrote: > Hi guys, > > It seems it's possible to define different read properties, only > differing by the return type. Not possible. Just like pretty much any C-derived language (C++, Java, C#, etc.) the return type of a function is n

User defined properties signatures

2015-04-20 Thread dvic via Digitalmars-d-learn
Hi guys, It seems it's possible to define different read properties, only differing by the return type. Ex: @property string value() { return m_value; } // m_value is a string @property int value() { return to!int(m_value); } But when using it in writefln() or assert for example, compiler (