Re: UFCS syntax I never saw before.

2018-05-24 Thread aliak via Digitalmars-d-learn
On Thursday, 24 May 2018 at 22:03:38 UTC, aliak wrote: It feels like the only difference between a no-arg function that is @property and one that is not is that the former could be invoked with optional parentheses and the latter should be illegal with parentheses. Edit: err... other way arou

Re: UFCS syntax I never saw before.

2018-05-24 Thread aliak via Digitalmars-d-learn
On Tuesday, 22 May 2018 at 14:33:20 UTC, Jonathan M Davis wrote: A free function with a single argument works just fine as a setter property. e.g. you could do something like void env(Tuple!(string, string)[] str) { // set environment variables } env = [tuple("foo", "bar")]; is perfectly

Re: UFCS syntax I never saw before.

2018-05-24 Thread aliak via Digitalmars-d-learn
On Tuesday, 22 May 2018 at 13:59:16 UTC, Steven Schveighoffer wrote: The derailed plan was to leave alone the ability to call no-arg functions without parentheses, but to REQUIRE @property to call an argument-taking function with the assignment style. See the DIP here: https://wiki.dlang.org/D

Re: UFCS syntax I never saw before.

2018-05-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, May 22, 2018 13:48:16 aliak via Digitalmars-d-learn wrote: > On Monday, 21 May 2018 at 18:53:19 UTC, Jonathan M Davis wrote: > > writeln = "foo"; > > > > is legal, and it's dumb, but it hasn't mattered much in > > practice. So, causing a bunch of code breakage in order to > > disallow i

Re: UFCS syntax I never saw before.

2018-05-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/22/18 9:48 AM, aliak wrote: On Monday, 21 May 2018 at 18:53:19 UTC, Jonathan M Davis wrote: writeln = "foo"; is legal, and it's dumb, but it hasn't mattered much in practice. So, causing a bunch of code breakage in order to disallow it is unlikely to go over well. It would also then mak

Re: UFCS syntax I never saw before.

2018-05-22 Thread aliak via Digitalmars-d-learn
On Monday, 21 May 2018 at 18:53:19 UTC, Jonathan M Davis wrote: writeln = "foo"; is legal, and it's dumb, but it hasn't mattered much in practice. So, causing a bunch of code breakage in order to disallow it is unlikely to go over well. It would also then make getters and setters inconsisten

Re: UFCS syntax I never saw before.

2018-05-22 Thread aliak via Digitalmars-d-learn
On Monday, 21 May 2018 at 14:19:35 UTC, Steven Schveighoffer wrote: On 5/21/18 8:15 AM, SrMordred wrote: Right, so this should´n be working I think. struct SomeStruct {     void foo(int); } SomeStruct s; s.foo = 10; I thought that only with @property this will work. That was the plan, bu

Re: UFCS syntax I never saw before.

2018-05-22 Thread ANtlord via Digitalmars-d-learn
On Monday, 21 May 2018 at 18:53:19 UTC, Jonathan M Davis wrote: On Monday, May 21, 2018 14:00:55 ANtlord via Digitalmars-d-learn wrote: If someone wrote an good DIP on the subject, I expect that things could be accelerated, but it's not much a real paint point in practice, and the chances of

Re: UFCS syntax I never saw before.

2018-05-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, May 21, 2018 14:00:55 ANtlord via Digitalmars-d-learn wrote: > On Monday, 21 May 2018 at 11:38:12 UTC, SrMordred wrote: > > After all this time I saw this: > > > > writeln = iota = 5; > > > > what?? > > > > I never saw that before! > > > > This is interesting, there is something useful t

Re: UFCS syntax I never saw before.

2018-05-21 Thread SrMordred via Digitalmars-d-learn
"%s %s".writefln = ("foo".tuple = "bar").expand; lol

Re: UFCS syntax I never saw before.

2018-05-21 Thread Dennis via Digitalmars-d-learn
On Monday, 21 May 2018 at 11:38:12 UTC, SrMordred wrote: what?? Here's another weird example: ``` void funWithUfcsAndPropertySyntax() { import std.typecons : tuple; "%s %s".writefln = ("foo".tuple = "bar").expand; } ``` source: https://github.com/Hackerpilot/Idiotmatic-D/blob/

Re: UFCS syntax I never saw before.

2018-05-21 Thread Chris M. via Digitalmars-d-learn
On Monday, 21 May 2018 at 11:38:12 UTC, SrMordred wrote: After all this time I saw this: writeln = iota = 5; what?? I never saw that before! This is interesting, there is something useful that i can do with this kind of call? That's pretty cool, but at the same time this should be wiped of

Re: UFCS syntax I never saw before.

2018-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/21/18 8:15 AM, SrMordred wrote: Right, so this should´n be working I think. struct SomeStruct {     void foo(int); } SomeStruct s; s.foo = 10; I thought that only with @property this will work. That was the plan, but it got derailed. Whoever wrote that original line of code, they ne

Re: UFCS syntax I never saw before.

2018-05-21 Thread ANtlord via Digitalmars-d-learn
On Monday, 21 May 2018 at 11:38:12 UTC, SrMordred wrote: After all this time I saw this: writeln = iota = 5; what?? I never saw that before! This is interesting, there is something useful that i can do with this kind of call? What the hell is this? I don't figure out why are there so many

Re: UFCS syntax I never saw before.

2018-05-21 Thread SrMordred via Digitalmars-d-learn
Right, so this should´n be working I think. struct SomeStruct { void foo(int); } SomeStruct s; s.foo = 10; I thought that only with @property this will work.

Re: UFCS syntax I never saw before.

2018-05-21 Thread Rubn via Digitalmars-d-learn
On Monday, 21 May 2018 at 11:38:12 UTC, SrMordred wrote: After all this time I saw this: writeln = iota = 5; what?? I never saw that before! This is interesting, there is something useful that i can do with this kind of call? I probably wouldn't use that. That wasn't what it was intended

UFCS syntax I never saw before.

2018-05-21 Thread SrMordred via Digitalmars-d-learn
After all this time I saw this: writeln = iota = 5; what?? I never saw that before! This is interesting, there is something useful that i can do with this kind of call?