June 18, 2020 Re: refInt = ref int: how to achieve this? or is this a bug? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mw | On 6/18/20 2:01 AM, mw wrote: > On Wednesday, 17 June 2020 at 23:09:55 UTC, Stanislav Blinov wrote: >> On Wednesday, 17 June 2020 at 23:05:59 UTC, mw wrote: >>> On Wednesday, 17 June 2020 at 22:48:25 UTC, MoonlightSentinel wrote: >>>> But i would agree with you that there is a bug in your initial >>> >>> It's not the bug in my code, >>> >>>> code, the `ref` should be rejected. >>> >>> it's the compiler's bug not rejecting it, given it's current semantics; instead it *silently* treat alias `ref int` as `int`. >> >> It is both. In your code, for trying to use `ref` as a type qualifier when it is not (see [1] for type qualifiers), and in the compiler, for not issuing an error. >> >> [1] https://dlang.org/spec/const3.html > > > https://github.com/dlang/phobos/blob/master/std/range/package.d#L921 > ``` > alias ElementType = ref RvalueElementType; > ``` > > Even code in phobos try to write this way too :-) > > Three lines up: https://github.com/dlang/phobos/blob/master/std/range/package.d#L918 // This doesn't work yet I don't think it will ever work. -Steve |
June 18, 2020 Re: refInt = ref int: how to achieve this? or is this a bug? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Thursday, 18 June 2020 at 14:16:51 UTC, Steven Schveighoffer wrote:
> Three lines up:
> https://github.com/dlang/phobos/blob/master/std/range/package.d#L918
>
> // This doesn't work yet
>
> I don't think it will ever work.
>
> -Steve
Yup, it's just a bug in the parser. You can even do a
alias wow = ref override abstract final scope static __gshared int;
Still gonna be an int tho.
|
June 18, 2020 Re: refInt = ref int: how to achieve this? or is this a bug? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stanislav Blinov | On Thu, Jun 18, 2020 at 02:20:04PM +0000, Stanislav Blinov via Digitalmars-d wrote: [...] > Yup, it's just a bug in the parser. You can even do a > > alias wow = ref override abstract final scope static __gshared int; > > Still gonna be an int tho. Wow that's ridiculous. A bug should be filed for this! T -- Those who don't understand Unix are condemned to reinvent it, poorly. |
June 19, 2020 Re: refInt = ref int: how to achieve this? or is this a bug? | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On Thursday, 18 June 2020 at 14:45:01 UTC, H. S. Teoh wrote: >> alias wow = ref override abstract final scope static __gshared int; >> >> Still gonna be an int tho. > > Wow that's ridiculous. A bug should be filed for this! > > > T It has been, not to worry. Also, a sense of deja vu kept bugging me, I found why: https://forum.dlang.org/post/k2fq3b$1t33$1@digitalmars.com |
June 19, 2020 Re: refInt = ref int: how to achieve this? or is this a bug? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stanislav Blinov | On Fri, Jun 19, 2020 at 01:21:07PM +0000, Stanislav Blinov via Digitalmars-d wrote: [...] > It has been, not to worry. Also, a sense of deja vu kept bugging me, I found why: https://forum.dlang.org/post/k2fq3b$1t33$1@digitalmars.com LOL, wow. Now *that* is totally ridiculous. :-D (And yeah, I also vaguely remember seeing that back then.) T -- Life is too short to run proprietary software. -- Bdale Garbee |
Copyright © 1999-2021 by the D Language Foundation