April 15, 2015 Re: Detect the bug in the following code | ||||
|---|---|---|---|---|
| ||||
Posted in reply to w0rp | On Wednesday, 15 April 2015 at 18:25:33 UTC, w0rp wrote: > On Wednesday, 15 April 2015 at 15:17:32 UTC, Steven Schveighoffer wrote: >> On 4/15/15 10:44 AM, Idan Arye wrote: >>> import std.stdio; >>> >>> struct Foo { >>> bool registered = false; >>> >>> void register(int x) { >>> writeln("Registering ", x); >>> register = true; >>> } >>> } >>> >>> void main() { >>> Foo foo; >>> foo.register(10); >>> } >> >> Easy, the bug is in DMD improperly accepting property assignment without @property annotation :P >> >> -Steve > > Yep. Push patches for DIP23. Get it in the compiler already. Make only x.foo legal without @property. See http://forum.dlang.org/post/kesbfurmakedjqcqljzg@forum.dlang.org | |||
April 16, 2015 Re: Detect the bug in the following code | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Wednesday, 15 April 2015 at 15:17:32 UTC, Steven Schveighoffer wrote:
> On 4/15/15 10:44 AM, Idan Arye wrote:
>> import std.stdio;
>>
>> struct Foo {
>> bool registered = false;
>>
>> void register(int x) {
>> writeln("Registering ", x);
>> register = true;
>> }
>> }
>>
>> void main() {
>> Foo foo;
>> foo.register(10);
>> }
>
> Easy, the bug is in DMD improperly accepting property assignment without @property annotation :P
>
> -Steve
writeln = "Now this is abused of the syntax."
| |||
April 16, 2015 Re: Detect the bug in the following code | ||||
|---|---|---|---|---|
| ||||
Posted in reply to ixid | On Thursday, 16 April 2015 at 13:52:32 UTC, ixid wrote:
> writeln = "Now this is abused of the syntax."
The important question is, can you assign a tuple and get the auto unpacking to kick in ?
| |||
April 16, 2015 Re: Detect the bug in the following code | ||||
|---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On Thursday, 16 April 2015 at 21:37:39 UTC, deadalnix wrote:
> On Thursday, 16 April 2015 at 13:52:32 UTC, ixid wrote:
>> writeln = "Now this is abused of the syntax."
>
> The important question is, can you assign a tuple and get the auto unpacking to kick in ?
"%s %s".writefln = ("foo".tuple = "bar").expand;
| |||
April 16, 2015 Re: Detect the bug in the following code | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Idan Arye | On Thursday, 16 April 2015 at 22:48:53 UTC, Idan Arye wrote: > "%s %s".writefln = ("foo".tuple = "bar").expand; Please make a pull request: https://github.com/Hackerpilot/Idiotmatic-D | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply