March 03, 2017
On 3/3/17 10:16 AM, Kagamin wrote:
> Nitpick: object.d is for symbols visible to user code, but it's not
> necessary to provide these helper functions to used code, so they should
> be in a different module known to the compiler.

Fundamentally the code resulting from lowering must be in the standard language, i.e. no "magic" artifacts, no hidden symbols, no special rules. The lowering should be as if the user replaced the code with the lowered version by hand. -- Andrei
March 06, 2017
v1==v2;

can be lowered as

{
  import rthelpers:cmp;
  cmp(v1,v2);
}

or something like that
March 06, 2017
On 3/6/17 8:42 AM, Kagamin wrote:
> v1==v2;
>
> can be lowered as
>
> {
>   import rthelpers:cmp;
>   cmp(v1,v2);
> }
>
> or something like that

Interesting idea, will keep it in mind. Thanks! -- Andrei
March 15, 2017
On 03/02/2017 02:32 PM, Andrei Alexandrescu wrote:
> Worth a look: https://github.com/dlang/druntime/pull/1781. This moves
> comparison code away from tedious runtime-introspected routines to nice
> templates. -- Andrei

Another notable PR in the same vein: https://github.com/dlang/druntime/pull/1792. -- Andrei
March 16, 2017
On Monday, 6 March 2017 at 18:06:27 UTC, Andrei Alexandrescu wrote:
> On 3/6/17 8:42 AM, Kagamin wrote:
>> v1==v2;
>>
>> can be lowered as
>>
>> {
>>   import rthelpers:cmp;
>>   cmp(v1,v2);
>> }
>>
>> or something like that
>
> Interesting idea, will keep it in mind. Thanks! -- Andrei

Even better:

in object.d:
---
public import _d_helpers=core.helpers;
---

lowering:
---
v1==v2
to
_d_helpers.cmp(v1,v2)
---

This has the best scalability and zero possibility of code breakage and probably can be done right now. Also since the renamed import must be referenced explicitly, it doesn't need to be processed until used.
March 16, 2017
On 3/16/17 10:52 AM, Kagamin wrote:
> On Monday, 6 March 2017 at 18:06:27 UTC, Andrei Alexandrescu wrote:
>> On 3/6/17 8:42 AM, Kagamin wrote:
>>> v1==v2;
>>>
>>> can be lowered as
>>>
>>> {
>>>   import rthelpers:cmp;
>>>   cmp(v1,v2);
>>> }
>>>
>>> or something like that
>>
>> Interesting idea, will keep it in mind. Thanks! -- Andrei
>
> Even better:
>
> in object.d:
> ---
> public import _d_helpers=core.helpers;
> ---
>
> lowering:
> ---
> v1==v2
> to
> _d_helpers.cmp(v1,v2)
> ---
>
> This has the best scalability and zero possibility of code breakage and
> probably can be done right now. Also since the renamed import must be
> referenced explicitly, it doesn't need to be processed until used.

A public import inside object.d is not useful because essentially it opens more files to load the same amount of code. Generally, there are a few interesting tradeoffs that govern handling of modularity in object.d. -- Andrei

1 2
Next ›   Last »