March 18, 2019
On 3/18/2019 11:19 PM, Mike Franklin wrote:
> Revisiting this just now, I realize that if I make the parameter `scope int* p` instead of `scope int p` it works fine.

`scope` applied to values that do not contain any references gets ignored because it applies to references. The compiler is behaving as designed.


> Also, some of your DIP 1000 PRs should not have been merged because they lacked enough documentation for anyone to do a proper review, but my concerns fell on deaf ears.  And just any documentation is not sufficient.  To this day, you're still fielding questions on the forum because noone knows how it's supposed to work; they're just speculating.  Perhaps if you documented it, others might know how to leverage it and help you with your immediate goal of improving Phobos.

I suggest:

  http://dconf.org/2017/talks/bright.html

for a tutorial on the basics.
March 19, 2019
On Tuesday, 19 March 2019 at 06:28:06 UTC, Walter Bright wrote:

> `scope` applied to values that do not contain any references gets ignored because it applies to references. The compiler is behaving as designed.

It's being removed, not ignored.

>> Also, some of your DIP 1000 PRs should not have been merged because they lacked enough documentation for anyone to do a proper review, but my concerns fell on deaf ears.  And just any documentation is not sufficient.  To this day, you're still fielding questions on the forum because noone knows how it's supposed to work; they're just speculating.  Perhaps if you documented it, others might know how to leverage it and help you with your immediate goal of improving Phobos.
>
> I suggest:
>
>   http://dconf.org/2017/talks/bright.html
>
> for a tutorial on the basics.

We need the details, not he basics.

Mike
March 18, 2019
On 3/18/2019 11:29 PM, Mike Franklin wrote:
> We need the details, not he basics.

Most questions reveal that the basics are not known, such as the recent thread initiated by Meta. Can't dive into calculus and skip algebra. If one doesn't understand how pointers and refs are tracked, the more complex scenarios will never, ever make any sense.

As I said earlier, I know the documentation needs to get better. But first I'm going to get Phobos to compile with -dip1000, since it is fairly useless if the standard library doesn't work with it.

March 19, 2019
On Tuesday, 19 March 2019 at 06:28:06 UTC, Walter Bright wrote:
> On 3/18/2019 11:19 PM, Mike Franklin wrote:
>> [...]
>
> `scope` applied to values that do not contain any references gets ignored because it applies to references. The compiler is behaving as designed.
>
>
>> [...]
>
> I suggest:
>
>   http://dconf.org/2017/talks/bright.html
>
> for a tutorial on the basics.

Would it help, not to ignore it, but raise a. compilation error, in this case?
That would help comprehension of the topic

- P
March 19, 2019
On 3/19/2019 12:13 AM, Paolo Invernizzi wrote:
> Would it help, not to ignore it, but raise a. compilation error, in this case?

Then generic code would have to be special cased (by the user) for it.
March 19, 2019
On Tuesday, 19 March 2019 at 07:33:28 UTC, Walter Bright wrote:
> On 3/19/2019 12:13 AM, Paolo Invernizzi wrote:
>> Would it help, not to ignore it, but raise a. compilation error, in this case?
>
> Then generic code would have to be special cased (by the user) for it.

Sorry, I don't understand...

I mean, raising a compiling error if scope is applied to values that do not contain any references, so that it would be ignored, because it applies to references:

`foo(scope int p)` => compiler error...

- P

March 19, 2019
On Tuesday, 19 March 2019 at 09:37:21 UTC, Paolo Invernizzi wrote:
> On Tuesday, 19 March 2019 at 07:33:28 UTC, Walter Bright wrote:
>> Then generic code would have to be special cased (by the user) for it.
>
> Sorry, I don't understand...
>
> I mean, raising a compiling error if scope is applied to values that do not contain any references, so that it would be ignored, because it applies to references:
>
> `foo(scope int p)` => compiler error...

`foo(scope T p)` => compiler error?

Depends what `T` is, that is very annoying to have to deal with in generic code. That is why it is currently ignored if it does nothing. Unfortunately we can't have our cake and eat it too.
March 19, 2019
On Tuesday, 19 March 2019 at 06:29:05 UTC, Mike Franklin wrote:
> On Tuesday, 19 March 2019 at 06:28:06 UTC, Walter Bright wrote:
>> I suggest:
>>
>>   http://dconf.org/2017/talks/bright.html
>>
>> for a tutorial on the basics.
>
> We need the details, not he basics.

To elaborate, we need a place to point people when they have questions about how dip1000 behaves, one master document. That is not that document: it covers the basics and is coming up 2 years, things have changed and if you asked me to list them, I'd have no idea. I have vague notions about how I think it works but have nothing concrete because the documentation that exists is sparse and probably out of date.

Ideally that document should be the spec, but we need to have one wherever it is.
March 19, 2019
On Tuesday, 19 March 2019 at 10:10:27 UTC, Nicholas Wilson wrote:
> On Tuesday, 19 March 2019 at 09:37:21 UTC, Paolo Invernizzi wrote:
>> On Tuesday, 19 March 2019 at 07:33:28 UTC, Walter Bright wrote:
>>> Then generic code would have to be special cased (by the user) for it.
>>
>> Sorry, I don't understand...
>>
>> I mean, raising a compiling error if scope is applied to values that do not contain any references, so that it would be ignored, because it applies to references:
>>
>> `foo(scope int p)` => compiler error...
>
> `foo(scope T p)` => compiler error?
>
> Depends what `T` is, that is very annoying to have to deal with in generic code. That is why it is currently ignored if it does nothing. Unfortunately we can't have our cake and eat it too.

Understood, thanks
March 19, 2019
On Tuesday, 19 March 2019 at 07:33:28 UTC, Walter Bright wrote:
> Then generic code would have to be special cased (by the user) for it.

What about raising an error when scope is applied to a non-reference function parameter in non-generic code?

Actually, how do compiler currently handle "this code has no effect, which is probably an error on your part, unless this is generic code" type of problems?
1 2
Next ›   Last »