[Issue 13825] relativePath not handling "." and ".." correctly

2018-10-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13825

--- Comment #3 from Dechcaudron  ---
Okay, so I've been mulling on it for the last day. Before I move in to make any
changes, here are some questions I'd like to get some discussion going around:

1) Does it make sense that the first argument to the `relativePath` and
`asRelativePath` functions can be already relative? Personally I find that to
be a bad idea, but you may have a valid counterpoint (please, provide use
case).

2) Currently, the "second argument must be an absolute path" claim is exposed
in the functions' documentation, and only in `relativePath` is it enforced via
throwing an exception (`asRelativePath` merely assumes so). Regardless of the
outcome of question 1), would if make sense to remove the exception from
`relativePath` and add a check for `isAbsolute(path)` as an input contract? I
understand this is a breaking change, so please see 4).

3) The root cause of this issue does not seem to be other than the arguments
not being normalized. As the reporter stated, calling `buildNormalizedPath` on
both arguments fixes the issue (bar for the first argument starting with "../",
see 1)). A quick and dirty fix would be to naively call such function on the
arguments within both `relativePath` and `asRelativePath`, but that would be
wasteful if the paths are already normalized. It makes sense to me that we add
a contract on both input arguments to require they are normalized. As of today,
we do not have any `isNormalized` function, but it could be added. Would that
make sense? Again, breaking changes, please see 4).

4) Since 2) and 3) both imply breaking changes in the behavior of the function
(or rather, as I am suggesting, the ability to terminate the program via
`assert` when the arguments violate the stated requirements) I understand the
way to go would be to begin a deprecation process. Since the signature of the
function does not need to change, the process is not as straightforward as I'd
like. I would propose the following:
  1. Create the `relativePath(bool useContracts, CaseSensitive cs =
CaseSensitive.osDefault)` template, which `static if`s `useContracts` to
determine whether to define the `relativePath` function with the new behavior
if true, or to define the deprecated function with the legacy behavior if
false. The legacy function would call the template function with `false`, to
trigger the deprecation warning. Proceed the same way with `asRelativePath`.
  2. Once the deprecation period expires, move the definition of the new
behavior with contracts to the legacy function declaration, deprecate the
`useContracts = true` declaration (which by then would forward to the legacy
signature function) and remove the `useContracts = false` declaration.
  3. Once the deprecation period for the template expires, remove it and keep
the legacy signature function with contracts.
  4. My grand-grandkids will close the issue.

Thoughts?

--


[Issue 11320] std.math.fmod, round, trunc are not yet pure

2018-10-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11320

Simon Naarmann  changed:

   What|Removed |Added

 CC||eiderd...@gmail.com

--- Comment #2 from Simon Naarmann  ---
This issue is still in 2.082.0.

Are there technical problems (floating representation etc.) that require
impurity? Otherwise, I'll make a PR that adds the pure keyword.

--


[Issue 11320] std.math.fmod, round, trunc are not yet pure

2018-10-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11320

Simon Naarmann  changed:

   What|Removed |Added

   Assignee|nob...@puremagic.com|eiderd...@gmail.com

--


[Issue 19306] New: Explicit struct constructors aren't smart when the structs contain anonymous unions

2018-10-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19306

  Issue ID: 19306
   Summary: Explicit struct constructors aren't smart when the
structs contain anonymous unions
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: b2.t...@gmx.com

struct Foo
{
union
{
void delegate() a;
void function() b;
}
ulong c;
}

void b(){}
struct A {void a(){}}

void main()
{
A a;
Foo f0 = Foo(&a.a);  // ok
Foo f1 = Foo(&a.a, 0UL); // not allowed but should
Foo f2 = Foo(&b, 0UL);   // not allowed but should
Foo f3 = Foo(&b);// not allowed but should
}

--


[Issue 10692] Deprecation isn't checked using alias this

2018-10-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10692

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #2 from Walter Bright  ---
Note that a plain 'alias' declaration specifically does not add modifiers,
storage classes, attributes, etc. It's not a wrapper. It just forwards the
lookup to the symbol. It should ignore any attributes, like plain alias does.

Added a clarification to the spec:

https://github.com/dlang/dlang.org/pull/2487

--