Re: How to list aggregate members in order of declaration at compile time?

2018-06-27 Thread Guillaume Lathoud via Digitalmars-d-learn
On Friday, 11 November 2016 at 23:55:58 UTC, Jonathan M Davis wrote: ... So, just provide a solid use case (if not multiple) as to why it needs to have a specific order, and you probably stand a good chance of it being added to the spec - especially since it's what the implementation does

Re: Is there a way to get the address of the function that would be used in Implicit Function Template Instantiation?

2018-06-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 27, 2018 22:59:03 Nathan S. via Digitalmars-d-learn wrote: > On Wednesday, 27 June 2018 at 22:39:26 UTC, Jonathan M Davis > > wrote: > > You could explicitly instantiate the function template and then > > take its address. > > Explicitly instantiating the template can result in

Re: Is there a way to get the address of the function that would be used in Implicit Function Template Instantiation?

2018-06-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/27/18 6:34 PM, Nathan S. wrote: Let's say there's a function template `doImpl` and `doImpl(x)` compiles thanks to IFTI. Is there any way to get the address of the function that would be called in `doImpl(x)`? It's a good question! You may be able to use TemplateOf, TemplateArgsOf, and

Re: Is there a way to get the address of the function that would be used in Implicit Function Template Instantiation?

2018-06-27 Thread Nathan S. via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 22:39:26 UTC, Jonathan M Davis wrote: You could explicitly instantiate the function template and then take its address. Explicitly instantiating the template can result in a function that may be behaviorally identical but have a different address.

Re: Is there a way to get the address of the function that would be used in Implicit Function Template Instantiation?

2018-06-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 27, 2018 22:34:46 Nathan S. via Digitalmars-d-learn wrote: > Let's say there's a function template `doImpl` and `doImpl(x)` > compiles thanks to IFTI. Is there any way to get the address of > the function that would be called in `doImpl(x)`? You could explicitly instantiate

Is there a way to get the address of the function that would be used in Implicit Function Template Instantiation?

2018-06-27 Thread Nathan S. via Digitalmars-d-learn
Let's say there's a function template `doImpl` and `doImpl(x)` compiles thanks to IFTI. Is there any way to get the address of the function that would be called in `doImpl(x)`?

Re: anyway to pass the context of an inner type to a template so it can be constructed?

2018-06-27 Thread aliak via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 19:28:37 UTC, Timoses wrote: Can't seem to avoid using mixin in main.. hehe yeah I see, didn't think of trying mixins, worth a shot! It seems like you had fun at least ;)

Re: anyway to pass the context of an inner type to a template so it can be constructed?

2018-06-27 Thread aliak via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 14:01:03 UTC, Alex wrote: On Wednesday, 27 June 2018 at 12:02:10 UTC, aliak wrote: === The use case is for a non-nullable type, where I want to guarantee that the value inside will never be null. I can't do it for inner classes though. And I can't allow the user

Re: anyway to pass the context of an inner type to a template so it can be constructed?

2018-06-27 Thread Timoses via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 12:02:10 UTC, aliak wrote: This currently fails unless you mark the class as static: auto construct(T)() { return new T; } void main() { class C {} auto s = construct!C; } So wondering if there's anything that can be done to get the above working?

Re: Visual D 0.47.0 released

2018-06-27 Thread Rainer Schuetze via Digitalmars-d-learn
On 27/06/2018 12:37, Robert M. Münch wrote: On 2018-06-27 06:22:19 +, Rainer Schuetze said: - Windows-10, 64bit, running in a Parallels VM on OSX 10.13.5 - VS-2017 latest patch applied If you try to debug 64-bit-builds, mago starts another monitoring process. Maybe there are issues

Re: Preferred Alias Declaration Style

2018-06-27 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 15:27:09 UTC, Steven Schveighoffer wrote: On 6/27/18 6:22 AM, Vijay Nayar wrote: Does this mean that the `alias other aliasName;` syntax is preferred, or does it simply mean that this is a low priority issue that hasn't been addressed yet? IIRC, there was an

Re: Struct template cannot deduce function from argument types

2018-06-27 Thread Luka Aleksic via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 17:07:52 UTC, Jonathan M Davis wrote: On Wednesday, June 27, 2018 16:19:56 Luka Aleksic via Digitalmars-d-learn wrote: [...] [...] Well, for one, what's on the left side of the = doesn't normally affect the type of what's on the right. It does in some cases

Re: Struct template cannot deduce function from argument types

2018-06-27 Thread lithium iodate via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 16:19:56 UTC, Luka Aleksic wrote: […] I am getting the following error: scratch.d(14): Error: struct scratch.pair cannot deduce function from argument types !()(char, int), candidates are: scratch.d(2):scratch.pair(T, U) Failed: ["/usr/bin/dmd", "-v",

Re: Struct template cannot deduce function from argument types

2018-06-27 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jun 27, 2018 at 04:19:56PM +, Luka Aleksic via Digitalmars-d-learn wrote: [...] > struct pair(T, U) { > T first; > U second; > > this(T arg_first, U arg_second) { > first = arg_first; > second = arg_second; > } > }; > > void main()

Re: Struct template cannot deduce function from argument types

2018-06-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 27, 2018 16:19:56 Luka Aleksic via Digitalmars-d-learn wrote: > Hello, > > In the following code: > > T first; > U second; > > this(T arg_first, U arg_second) { > first = arg_first; > second = arg_second; > } > }; > > void main() { > > pair!(char, uint)

Struct template cannot deduce function from argument types

2018-06-27 Thread Luka Aleksic via Digitalmars-d-learn
Hello, In the following code: struct pair(T, U) { T first; U second; this(T arg_first, U arg_second) { first = arg_first; second = arg_second; } }; void main() { pair!(char, uint) p1 = pair('a', 1); } I am getting the

Re: Getting the underlying range from std.range.indexed, with elements in swapped order, when Indexed.source.length == Indexed.indices.length

2018-06-27 Thread Uknown via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 15:18:05 UTC, Alex wrote: On Wednesday, 27 June 2018 at 15:07:57 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 14:50:25 UTC, Alex wrote: On Wednesday, 27 June 2018 at 14:29:33 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 14:21:39 UTC, Alex wrote: On

Re: Preferred Alias Declaration Style

2018-06-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/27/18 6:22 AM, Vijay Nayar wrote: Does this mean that the `alias other aliasName;` syntax is preferred, or does it simply mean that this is a low priority issue that hasn't been addressed yet? IIRC, there was an ambiguity for using the new syntax for alias this. I don't remember the

Re: Getting the underlying range from std.range.indexed, with elements in swapped order, when Indexed.source.length == Indexed.indices.length

2018-06-27 Thread Alex via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 15:07:57 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 14:50:25 UTC, Alex wrote: On Wednesday, 27 June 2018 at 14:29:33 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 14:21:39 UTC, Alex wrote: On Wednesday, 27 June 2018 at 13:27:46 UTC, Uknown wrote: [...]

Re: Getting the underlying range from std.range.indexed, with elements in swapped order, when Indexed.source.length == Indexed.indices.length

2018-06-27 Thread Uknown via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 14:50:25 UTC, Alex wrote: On Wednesday, 27 June 2018 at 14:29:33 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 14:21:39 UTC, Alex wrote: On Wednesday, 27 June 2018 at 13:27:46 UTC, Uknown wrote: [...] I see. Ok, one possibility is source = indexed(source,

Re: Getting the underlying range from std.range.indexed, with elements in swapped order, when Indexed.source.length == Indexed.indices.length

2018-06-27 Thread Alex via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 14:29:33 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 14:21:39 UTC, Alex wrote: On Wednesday, 27 June 2018 at 13:27:46 UTC, Uknown wrote: Title says it all. Is there a trivial way to do this? There are

Re: Preferred Alias Declaration Style

2018-06-27 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 14:29:18 UTC, Basile B. wrote: On Wednesday, 27 June 2018 at 14:23:25 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 14:01:06 UTC, Basile B. wrote: [...] You can use this syntax for functions : `alias proto_identifier = void function();` Nah it's not the

Re: Preferred Alias Declaration Style

2018-06-27 Thread Uknown via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 14:29:18 UTC, Basile B. wrote: On Wednesday, 27 June 2018 at 14:23:25 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 14:01:06 UTC, Basile B. wrote: On Wednesday, 27 June 2018 at 12:25:26 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 10:22:38 UTC, Vijay Nayar

Re: Getting the underlying range from std.range.indexed, with elements in swapped order, when Indexed.source.length == Indexed.indices.length

2018-06-27 Thread Uknown via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 14:21:39 UTC, Alex wrote: On Wednesday, 27 June 2018 at 13:27:46 UTC, Uknown wrote: Title says it all. Is there a trivial way to do this? There are https://dlang.org/library/std/algorithm/mutation/reverse.html and https://dlang.org/library/std/range/retro.html

Re: Preferred Alias Declaration Style

2018-06-27 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 14:23:25 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 14:01:06 UTC, Basile B. wrote: On Wednesday, 27 June 2018 at 12:25:26 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 10:22:38 UTC, Vijay Nayar wrote: [...] aliasing a function type only works with the

Re: Preferred Alias Declaration Style

2018-06-27 Thread Uknown via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 14:01:06 UTC, Basile B. wrote: On Wednesday, 27 June 2018 at 12:25:26 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 10:22:38 UTC, Vijay Nayar wrote: [...] aliasing a function type only works with the old syntax too: alias void proto_identifier(); Very

Re: Getting the underlying range from std.range.indexed, with elements in swapped order, when Indexed.source.length == Indexed.indices.length

2018-06-27 Thread Alex via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 13:27:46 UTC, Uknown wrote: Title says it all. Is there a trivial way to do this? There are https://dlang.org/library/std/algorithm/mutation/reverse.html and https://dlang.org/library/std/range/retro.html both require a bidirectional range, which Indexed, luckily

Re: anyway to pass the context of an inner type to a template so it can be constructed?

2018-06-27 Thread Alex via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 12:02:10 UTC, aliak wrote: === The use case is for a non-nullable type, where I want to guarantee that the value inside will never be null. I can't do it for inner classes though. And I can't allow the user to do something like: void main() { class C {}

Re: Preferred Alias Declaration Style

2018-06-27 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 12:25:26 UTC, Uknown wrote: On Wednesday, 27 June 2018 at 10:22:38 UTC, Vijay Nayar wrote: Most of the documentation at https://dlang.org/spec/declaration.html#alias uses examples of the form: `alias aliasName = other;`, where `aliasName` becomes the new name to

Getting the underlying range from std.range.indexed, with elements in swapped order, when Indexed.source.length == Indexed.indices.length

2018-06-27 Thread Uknown via Digitalmars-d-learn
Title says it all. Is there a trivial way to do this?

Re: Preferred Alias Declaration Style

2018-06-27 Thread Uknown via Digitalmars-d-learn
On Wednesday, 27 June 2018 at 10:22:38 UTC, Vijay Nayar wrote: Most of the documentation at https://dlang.org/spec/declaration.html#alias uses examples of the form: `alias aliasName = other;`, where `aliasName` becomes the new name to reference `other`. Alternatively, one may write `alias

anyway to pass the context of an inner type to a template so it can be constructed?

2018-06-27 Thread aliak via Digitalmars-d-learn
This currently fails unless you mark the class as static: auto construct(T)() { return new T; } void main() { class C {} auto s = construct!C; } So wondering if there's anything that can be done to get the above working? Or if there isn't then how could the compiler be enhanced

Re: Visual D 0.47.0 released

2018-06-27 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-06-27 06:22:19 +, Rainer Schuetze said: Works for me, can you give more details? VS version, platform, etc. - Windows-10, 64bit, running in a Parallels VM on OSX 10.13.5 - VS-2017 latest patch applied Please note that there is no need to select the Mago debug engine in VS2013 or

Preferred Alias Declaration Style

2018-06-27 Thread Vijay Nayar via Digitalmars-d-learn
Most of the documentation at https://dlang.org/spec/declaration.html#alias uses examples of the form: `alias aliasName = other;`, where `aliasName` becomes the new name to reference `other`. Alternatively, one may write `alias other aliasName;`. My understanding is that the syntax with `=`

Re: Visual D 0.47.0 released

2018-06-27 Thread Rainer Schuetze via Digitalmars-d-learn
On 26/06/2018 16:25, Robert M. Münch wrote: On 2018-06-24 13:08:53 +, Rainer Schuetze said: a new release of Visual D has just been uploaded. Major changes are * improved Visual C++ project integration: better dependencies,    automatic libraries, name demangling * new project wizard *