December 24, 2020 Re: Beta 2.095.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mathias LANG | On Thursday, 24 December 2020 at 18:05:30 UTC, Mathias LANG wrote: > On Thursday, 24 December 2020 at 11:38:11 UTC, Paolo Invernizzi wrote: >> >> The point is that the deprecation is coming from an external library, it would be great to have the precise instantiation point in that source code, so I was wondering if that dmd improvement [1] should print a more detailed trace. >> >> [1] https://dlang.org/changelog/2.095.0.html#deprecation-context > > It does print a detailed stack trace (up to the first symbol that is not a template) if you don't use `-de`. If you use `-de`, since the checks in Phobos are `is(typeof(n.toString()))` or `__traits(compiles, n.toString())`, then it just changes whether or not the code compiles, and as a result changes the output of the program. A trivial example: > > ``` > import std.stdio, std.typecons; > struct Foo { > deprecated string toString() const { return "Oops"; } > } > void main () { writefln("%s", Foo.init); } > ``` > > Will print, with v2.094.2 or before (dmd -run): > ``` > /usr/local/opt/dmd/include/dlang/dmd/std/format.d(3921): Deprecation: function foo.Foo.toString is deprecated > /usr/local/opt/dmd/include/dlang/dmd/std/format.d(4053): Deprecation: function foo.Foo.toString is deprecated > Oops > ``` > > Not great. If you use `dmd -de -run`, you'll get: > ``` > Foo() > ``` > > Notice the deprecations are gone, but so is the usage of the `toString` method. Using DMD v2.095.0-beta.1 with `-de` should give you the same output, but without `-de`: > > ``` > % ~/dlang/dmd-2.095.0-beta.1/osx/bin/dmd -run foo.d > /Users/geod24/dlang/dmd-2.095.0-beta.1/osx/bin/../../src/phobos/std/format.d(3921): Deprecation: function foo.Foo.toString is deprecated > /Users/geod24/dlang/dmd-2.095.0-beta.1/osx/bin/../../src/phobos/std/format.d(4420): instantiated from here: hasToString!(Foo, char) > /Users/geod24/dlang/dmd-2.095.0-beta.1/osx/bin/../../src/phobos/std/format.d(4053): Deprecation: function foo.Foo.toString is deprecated > /Users/geod24/dlang/dmd-2.095.0-beta.1/osx/bin/../../src/phobos/std/format.d(4430): instantiated from here: formatObject!(LockingTextWriter, Foo, char) > /Users/geod24/dlang/dmd-2.095.0-beta.1/osx/bin/../../src/phobos/std/format.d(1875): instantiated from here: formatValueImpl!(LockingTextWriter, Foo, char) > /Users/geod24/dlang/dmd-2.095.0-beta.1/osx/bin/../../src/phobos/std/format.d(576): instantiated from here: formatValue!(LockingTextWriter, Foo, char) > /Users/geod24/dlang/dmd-2.095.0-beta.1/osx/bin/../../src/phobos/std/stdio.d(1661): ... (1 instantiations, -v to show) ... > /Users/geod24/dlang/dmd-2.095.0-beta.1/osx/bin/../../src/phobos/std/stdio.d(4271): instantiated from here: writefln!(char, Foo) > foo.d(5): instantiated from here: writefln!(char, Foo) > Oops > ``` > > So the feature works as intended, however `-de` is a dangerous trap, as it changes what is instantiated. Thanks Matias, My point is that the result without -de is --- /Users/pinver/dlang/dmd-2.095.0-beta.1/osx/bin/dmd -i -g -debug src/foo.d /Users/pinver/dlang/dmd-2.095.0-beta.1/osx/bin/../../src/phobos/std/traits.d(3727): Deprecation: function std.typecons.Nullable!long.Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly. /Users/pinver/dlang/dmd-2.095.0-beta.1/osx/bin/../../src/phobos/std/traits.d(3727): Deprecation: function std.typecons.Nullable!short.Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly. --- Which unfortunately is pretty useless in my case ... |
December 24, 2020 Re: Beta 2.095.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paolo Invernizzi | On Thursday, 24 December 2020 at 21:59:31 UTC, Paolo Invernizzi wrote:
>
> My point is that the result without -de is
>
> [...]
>
> Which unfortunately is pretty useless in my case ...
Could you point me towards the code that triggers this ?
|
December 24, 2020 Re: Beta 2.095.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On 12/20/2020 5:21 AM, Martin Nowak wrote:
> Glad to announce the first beta for the 2.095.0 release, ♥ to the 61 contributors.
>
> http://dlang.org/download.html#dmd_beta
> http://dlang.org/changelog/2.095.0.html
>
> As usual please report any bugs at
> https://issues.dlang.org
>
> -Martin
>
Thank you, Martin and the Sixty-One!
|
December 26, 2020 Re: Beta 2.095.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On Sunday, 20 December 2020 at 13:21:46 UTC, Martin Nowak wrote:
> Glad to announce the first beta for the 2.095.0 release, ♥ to the 61 contributors.
>
> http://dlang.org/download.html#dmd_beta
> http://dlang.org/changelog/2.095.0.html
>
> As usual please report any bugs at
> https://issues.dlang.org
>
> -Martin
Pleasantly surprised by ObjC protocol support! Deriving from an Obj-C protocol was a nightmare before, there is good change the new release makes it palatable!
|
December 28, 2020 Re: Beta 2.095.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On Sunday, 20 December 2020 at 13:21:46 UTC, Martin Nowak wrote: > http://dlang.org/download.html#dmd_beta > http://dlang.org/changelog/2.095.0.html Feature https://dlang.org/changelog/2.095.0.html#better-vtemplates was already added at https://dlang.org/changelog/2.094.0.html#better-vtemplates Shall I fix? |
December 29, 2020 Re: Beta 2.095.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Monday, 28 December 2020 at 20:22:50 UTC, Per Nordlöw wrote:
> On Sunday, 20 December 2020 at 13:21:46 UTC, Martin Nowak wrote:
>> http://dlang.org/download.html#dmd_beta
>> http://dlang.org/changelog/2.095.0.html
>
> Feature
>
> https://dlang.org/changelog/2.095.0.html#better-vtemplates
>
> was already added at
>
> https://dlang.org/changelog/2.094.0.html#better-vtemplates
>
> Shall I fix?
Yes please! And thanks for paying attention to the changelog, it matters a lot!
|
December 29, 2020 Re: Beta 2.095.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mathias LANG | On Tuesday, 29 December 2020 at 00:17:59 UTC, Mathias LANG wrote: > Yes please! And thanks for paying attention to the changelog, it matters a lot! Done: https://github.com/dlang/dlang.org/pull/2926 |
December 29, 2020 Re: Beta 2.095.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mathias LANG | On Thursday, 24 December 2020 at 23:14:16 UTC, Mathias LANG wrote: > On Thursday, 24 December 2020 at 21:59:31 UTC, Paolo Invernizzi wrote: >> >> My point is that the result without -de is >> >> [...] >> >> Which unfortunately is pretty useless in my case ... > > Could you point me towards the code that triggers this ? Mathias, reduced test case below (dustmined), thank you! --- /Users/pinver/dlang/dmd-2.095.0-beta.1/osx/bin/dmd -c -o- -J/Users/pinver/Lembas -vcolumns -color=on -Isrc -debug -unittest /Users/pinver/Tmp/dustmite/testing.reduced/src/fieldmanager.d || true < /Users/pinver/dlang/dmd-2.095.0-beta.1/osx/bin/../../src/phobos/std/traits.d(3727,61): Deprecation: function std.typecons.Nullable!long.Nullable.get_ is deprecated - Implicit conversion with alias Nullable.get this will be removed after 2.096. Please use .get explicitly. --- import std.typecons : Nullable; import std.array : array; struct DBRow(Specs...) { alias Specs[] T; T base; } class PGConnection { PGResultSet!Specs executeQuery(Specs)(string ) { scope cmd = new PGCommand(this); return cmd.executeQuery!Specs; } auto pgCommand(string ) { return new PGCommand(this); } } class PGCommand { PGConnection conn; string preparedName; this(PGConnection ){ } PGResultSet!Specs executeQuery(Specs)() { return conn.executeQuery!Specs(preparedName); } } class PGResultSet(Specs) { alias DBRow!Specs Row; bool empty = true; void popFront() { } Row front() { return Row.init; } } void importPanoptesFixations(short legId, DbModel dbModel) { queryAsArray(dbModel.conn, legId); } struct DbModel { PGConnection conn; } struct Foo { Nullable!long sessionStartedAtMs; } auto queryAsArray(Conn)(Conn conn, short ) { auto comm = conn.pgCommand(`select * from foo`); auto rset = comm.executeQuery!Foo; rset.array; } --- |
December 29, 2020 Re: Beta 2.095.0 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paolo Invernizzi | On Tuesday, 29 December 2020 at 10:48:55 UTC, Paolo Invernizzi wrote:
> On Thursday, 24 December 2020 at 23:14:16 UTC, Mathias LANG wrote:
>> [...]
>
> Mathias, reduced test case below (dustmined), thank you!
>
> [...]
Manually reduced to:
---
import std.typecons : Nullable;
import std.array : array;
class PGResultSet
{
bool empty = true;
void popFront() {}
Foo front;
}
struct Foo {
Nullable!long sessionStartedAtMs;
}
void foo() {
auto rset = new PGResultSet;
rset.array;
}
---
|
December 30, 2020 Release Candidate [was: Re: Beta 2.095.0] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On Sunday, 20 December 2020 at 13:21:46 UTC, Martin Nowak wrote: > Glad to announce the first beta for the 2.095.0 release, ♥ to the 61 contributors. The release candidate for 2.095.0 is live now. > http://dlang.org/download.html#dmd_beta > http://dlang.org/changelog/2.095.0.html > > As usual please report any bugs at > https://issues.dlang.org > > -Martin |
Copyright © 1999-2021 by the D Language Foundation