Jump to page: 1 2
Thread overview
Phobos begat madness
Jun 22, 2018
Walter Bright
Jun 22, 2018
Adam D. Ruppe
Jun 22, 2018
Adam D. Ruppe
Jun 22, 2018
Walter Bright
Jun 22, 2018
Adam D. Ruppe
Jun 23, 2018
Ali
Jun 23, 2018
Bauss
Jun 24, 2018
David Bennett
Jun 23, 2018
Vladimir Panteleev
Jun 24, 2018
David Bennett
Jun 25, 2018
David Bennett
Jun 26, 2018
David Bennett
June 22, 2018
In trying to get Phobos to compile with dip1000, I was faced with the following innocuous looking line:

  assert(equal(achr, arr), text(a.byCodepoint));

  https://github.com/dlang/phobos/blob/master/std/uni.d#L3763

and the compiler complained that `text(a.byCodepoint)` was a system call. I decided to accept the Mission Impossible of figuring out why it was inferred as @system.

I found myself getting lost in a maze of twisty template expansions, all looking slightly different:

  text
  begat textImpl
  begat to
  begat toImpl
  begat toStr
  begat formatValue
  begat formatValueImpl
  begat put
  begat doPut
  begat Appender.put
  begat Appender.put

These templates are all just wrappers around wrappers. They're laden with overloads, constraints and static ifs, so finding just what code is being compiled with what parameters is absurdly difficult. I can't begin to defend this.

Converting a range of empty/front/popFront to a string should be a simple, direct piece of code.

For example, simple conversion to a string should not need to detour through a complex formatting function.

(For those wondering about the genesis of https://github.com/dlang/dmd/pull/8384, trying to figure this out motivated it. Saved me lots of time, especially in finding which overload was being called.)

If someone wants to figure out how to build an uncomplicated, straightforward, efficient implementation of text() that we can be proud of, that would be a nice contribution.
June 22, 2018
On Friday, 22 June 2018 at 21:37:07 UTC, Walter Bright wrote:
> I decided to accept the Mission Impossible of figuring out why it was inferred as @system.


This would be trivial if the compiler had decent error messages.

https://issues.dlang.org/show_bug.cgi?id=17374

It could just tell us the bottom-most call that was not @safe (or @nogc or nothrow or whatever) that is not inferred, and boom, problem solved in seconds.
June 22, 2018
On 6/22/18 6:03 PM, Adam D. Ruppe wrote:
> On Friday, 22 June 2018 at 21:37:07 UTC, Walter Bright wrote:
>> I decided to accept the Mission Impossible of figuring out why it was inferred as @system.
> 
> 
> This would be trivial if the compiler had decent error messages.
> 
> https://issues.dlang.org/show_bug.cgi?id=17374
> 
> It could just tell us the bottom-most call that was not @safe (or @nogc or nothrow or whatever) that is not inferred, and boom, problem solved in seconds.

That would be awesome. I've gone through the "annotate this and continue" exercise, and it is not fun. Especially when the template is used in many places, you have to make a copy of the template to play with.

-Steve
June 22, 2018
On 6/22/2018 3:03 PM, Adam D. Ruppe wrote:
> On Friday, 22 June 2018 at 21:37:07 UTC, Walter Bright wrote:
>> I decided to accept the Mission Impossible of figuring out why it was inferred as @system.
> 
> 
> This would be trivial if the compiler had decent error messages.
> 
> https://issues.dlang.org/show_bug.cgi?id=17374
> 
> It could just tell us the bottom-most call that was not @safe (or @nogc or nothrow or whatever) that is not inferred, and boom, problem solved in seconds.

That would help, do you want to implement it?

(The begats are still a problem regardless.)
June 22, 2018
On Friday, 22 June 2018 at 22:25:35 UTC, Steven Schveighoffer wrote:
> I've gone through the "annotate this and continue" exercise, and it is not fun. Especially when the template is used in many places, you have to make a copy of the template to play with.

Aye. I think that's the most straightforward implementation though: make the compiler on the inside just set the inferred flag, then rerun the semantic and collect the errors until it gets to the bottom.

(then perhaps cut out some of the errors from the middle for brevity of the message, just showing the top and bottom parts of the call chain, since that is most likely what the user actually would want to know to fix it)
June 22, 2018
On Friday, 22 June 2018 at 22:28:17 UTC, Walter Bright wrote:
> That would help, do you want to implement it?

I can't for at last two weeks, I'm about to fly tomorrow... and I'm getting married in August too so my life is kinda hectic.

But I might look at it around July 4 if I get a chance and it isn't done by then.

> (The begats are still a problem regardless.)

Yeah, I don't like the way to is implemented either.
June 22, 2018
On 6/22/18 6:36 PM, Adam D. Ruppe wrote:
> On Friday, 22 June 2018 at 22:28:17 UTC, Walter Bright wrote:
>> That would help, do you want to implement it?
> 
> I can't for at last two weeks, I'm about to fly tomorrow... and I'm getting married in August too so my life is kinda hectic.

Congrats!

-Steve
June 23, 2018
On Friday, 22 June 2018 at 22:39:40 UTC, Steven Schveighoffer wrote:
> On 6/22/18 6:36 PM, Adam D. Ruppe wrote:
>> On Friday, 22 June 2018 at 22:28:17 UTC, Walter Bright wrote:
>>> That would help, do you want to implement it?
>> 
>> I can't for at last two weeks, I'm about to fly tomorrow... and I'm getting married in August too so my life is kinda hectic.
>
> Congrats!
>
> -Steve

Congrats :)
June 23, 2018
On Friday, 22 June 2018 at 22:36:23 UTC, Adam D. Ruppe wrote:
> On Friday, 22 June 2018 at 22:28:17 UTC, Walter Bright wrote:
>> That would help, do you want to implement it?
>
> I can't for at last two weeks, I'm about to fly tomorrow... and I'm getting married in August too so my life is kinda hectic.
>
> But I might look at it around July 4 if I get a chance and it isn't done by then.
>
>> (The begats are still a problem regardless.)
>
> Yeah, I don't like the way to is implemented either.

Hijacking the thread with your wedding.

I'm just kidding.

Congratulations and the best of wishes for your future with your soon-to-be wife.
June 23, 2018
On 6/23/18 1:36 AM, Adam D. Ruppe wrote:
> On Friday, 22 June 2018 at 22:28:17 UTC, Walter Bright wrote:
>> That would help, do you want to implement it?
> 
> I can't for at last two weeks, I'm about to fly tomorrow... and I'm getting married in August too so my life is kinda hectic.

Congratulations, Adam!

Andrei

« First   ‹ Prev
1 2