Re: what's the point of function template declarations if they can't be defined?

2018-02-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, February 07, 2018 13:39:55 Timothee Cour via Digitalmars-d- learn wrote: > ``` > void fun_bad3(T)(T a); // declaration [1] > void fun_bad3(T)(T a){}; // definition [2] > void test(){ > fun_bad3(1); > } > ``` > Error: test_all.fun_bad3 called with argument types (int) matches

Re: free func "front" is not picked up as a candidate when doing range.front(...)

2018-02-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, February 07, 2018 20:17:54 aliak via Digitalmars-d-learn wrote: > On Wednesday, 7 February 2018 at 20:08:10 UTC, Paul Backus wrote: > > You can only call a function with UFCS syntax if the object > > you're calling it with does not have a member with the same > > name as the

deprecation warning after upgrade

2018-02-07 Thread Norm via Digitalmars-d-learn
Hi All, In my generic code I now get this error, which requires manually finding all -a[] array ops, but that is another matter. $/src/druntime/import/core/internal/arrayop.d-mixin-57(57,20): Deprecation: integral promotion not done for -_param_1[pos], use '-transition=intpromote' switch or

Re: Performance of default and enum parameters

2018-02-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 23:18:53 UTC, H. S. Teoh wrote: [snip] Appreciate the detailed reply. I had tried to look at the assembly with that tool recently discussed in the announce thread, but there was so much extra stuff reported that I threw up my hands.

Re: Performance of default and enum parameters

2018-02-07 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Feb 07, 2018 at 11:04:29PM +, jmh530 via Digitalmars-d-learn wrote: [...] > If check is not passed, I think it depends on how default function > arguments work. I could imagine that it works in two ways: 1) if you > call bar(x), then the compiler effectively re-writes it to bar(x, >

Performance of default and enum parameters

2018-02-07 Thread jmh530 via Digitalmars-d-learn
I'm a little curious on the impact of default and enum parameters on performance. In the simple example below, I have foo and bar that return different results depending on a bool. Foo is a template with check as a template parameter and bar is a normal function. foo creates two different

Deep

2018-02-07 Thread Ancient Broken Wind via Digitalmars-d-learn
Hi. I have been using D for more than 15 years now. But since I haven't done anything Note Worthy, I'll just post here in the newbie pen, even though I think my message is important. I just watched an episode of Computerphile about Type Theory. I wish, that Andrei would take a look at it.

Re: Shouldn't D be added to this list?

2018-02-07 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 6 February 2018 at 22:36:09 UTC, WhatMeWorry wrote: https://www.khronos.org/opengl/wiki/Language_bindings I was thinking that with derelictGL, D should be on this list? If so, I'm not sure how one would go about this? It is a wiki, anybody can add it, me thinks.

what's the point of function template declarations if they can't be defined?

2018-02-07 Thread Timothee Cour via Digitalmars-d-learn
``` void fun_bad3(T)(T a); // declaration [1] void fun_bad3(T)(T a){}; // definition [2] void test(){ fun_bad3(1); } ``` Error: test_all.fun_bad3 called with argument types (int) matches both: main.d(11): test_all.fun_bad3!int.fun_bad3(int a) and: main.d(12):

Re: Vibe.d rest & web service?

2018-02-07 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 19:50:31 UTC, Jacob Carlborg wrote: Have you tried this? No. But apart from the fact that I forgot to make the class inherit from an interface to that the rest interface would actually compile, the web interface is routed before the rest interface and so the

Re: Run-time initialised static variables

2018-02-07 Thread dekevin via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 20:10:10 UTC, dekevin wrote: On Wednesday, 7 February 2018 at 16:26:16 UTC, Dominikus Dittes Scherkl wrote: On Wednesday, 7 February 2018 at 12:10:38 UTC, dekevin wrote: struct ℚ{ ℤ num, den; //cannot call constructors on these, since they require

Re: free func "front" is not picked up as a candidate when doing range.front(...)

2018-02-07 Thread aliak via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 20:08:10 UTC, Paul Backus wrote: You can only call a function with UFCS syntax if the object you're calling it with does not have a member with the same name as the function. Both iota's `Result` type and `FilterResult` have properties named "front", so you

Re: Run-time initialised static variables

2018-02-07 Thread dekevin via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 16:26:16 UTC, Dominikus Dittes Scherkl wrote: On Wednesday, 7 February 2018 at 12:10:38 UTC, dekevin wrote: struct ℚ{ ℤ num, den; //cannot call constructors on these, since they require gmp_init, which requires runtime code //Default initialiser

Re: free func "front" is not picked up as a candidate when doing range.front(...)

2018-02-07 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 19:25:01 UTC, aliak wrote: import std.range: iota; 0.iota.front(100).writeln; // Error: inout method std.range.iota!(int, int).iota.Result.front is not callable using a mutable object import std.algorithm: filter; auto arr = [0, 1];

Re: macOS preview D files

2018-02-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-02-07 20:28, Joel wrote: On Wednesday, 7 February 2018 at 12:45:43 UTC, Jacob Carlborg wrote: On 2018-02-07 02:24, Joel wrote: Using finder, I want to see D files shown in the preview column, I some times have with TextMate. Also on my iPhone (in iCloud app, open as a text file) would

Re: Vibe.d rest & web service?

2018-02-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-02-07 18:04, Nicholas Wilson wrote: Is it possible to have some urls routed to serve content and some to receive JSON in the same class? Basically I want: shared static this() { auto router = new URLRouter; auto a = new MyInterface; router.registerWebInterface(new

Re: macOS preview D files

2018-02-07 Thread Joel via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 12:45:43 UTC, Jacob Carlborg wrote: On 2018-02-07 02:24, Joel wrote: Using finder, I want to see D files shown in the preview column, I some times have with TextMate. Also on my iPhone (in iCloud app, open as a text file) would be a bonus too. D is not

free func "front" is not picked up as a candidate when doing range.front(...)

2018-02-07 Thread aliak via Digitalmars-d-learn
Hi, I'm trying to make a range.front free function that can be given a defaultValue. Doesn't seem to be working as is written below, seems like the compiler doesn't see the free function as a viable candidate. Isn't it supposed to do its UFCS wizardry and pick up the free func? import

Re: Vibe.d rest & web service?

2018-02-07 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 18:38:15 UTC, Seb wrote: How about using the normal Vibe.d Web Service? Stupid question: whats the difference? An example from my WIP project vibe-by-example project: https://github.com/wilzbach/vibe-d-by-example/blob/master/web/service.d I also have a

Re: Vibe.d rest & web service?

2018-02-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/7/18 12:04 PM, Nicholas Wilson wrote: Is it possible to have some urls routed to serve content and some to receive JSON in the same class? Basically I want: shared static this() {     auto router = new URLRouter;     auto a = new MyInterface;     router.registerWebInterface(new

Re: Vibe.d rest & web service?

2018-02-07 Thread Seb via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 17:04:13 UTC, Nicholas Wilson wrote: Is it possible to have some urls routed to serve content and some to receive JSON in the same class? Basically I want: shared static this() { auto router = new URLRouter; auto a = new MyInterface;

Re: Vibe.d rest & web service?

2018-02-07 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 17:57:09 UTC, Jesse Phillips wrote: On Wednesday, 7 February 2018 at 17:04:13 UTC, Nicholas Wilson wrote: Is it possible to have some urls routed to serve content and some to receive JSON in the same class? This seems unlikely to me, the function signature

Re: Vibe.d rest & web service?

2018-02-07 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 17:04:13 UTC, Nicholas Wilson wrote: Is it possible to have some urls routed to serve content and some to receive JSON in the same class? This seems unlikely to me, the function signature doesn't provide a way to distinguish between REST and not. I'm also

Vibe.d rest & web service?

2018-02-07 Thread Nicholas Wilson via Digitalmars-d-learn
Is it possible to have some urls routed to serve content and some to receive JSON in the same class? Basically I want: shared static this() { auto router = new URLRouter; auto a = new MyInterface; router.registerWebInterface(new MyInterface); //?? selective combination

Re: Run-time initialised static variables

2018-02-07 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 12:10:38 UTC, dekevin wrote: struct ℚ{ ℤ num, den; //cannot call constructors on these, since they require gmp_init, which requires runtime code //Default initialiser disabled, since else num=0,den=0 You can use a different default initializer:

Re: extern(C++) in win32.mak

2018-02-07 Thread Seb via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 14:38:37 UTC, Jacob Carlborg wrote: On 2018-02-07 14:47, Paul D Anderson wrote: I get Error: 'of..\generated\windows\release\32\lexer.lib' not found I don't think this file is built anymore. It's a leftover of the lexer experiment and AFAICT still built:

Re: more OO way to do hex string to bytes conversion

2018-02-07 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 14:47:04 UTC, Ralph Doncaster wrote: p.s. the cast should probably be to immutable ubyte[]. I'm guessing without it, there is an automatic copy of the data being made. No copy - you just get undefined behavior if you actually try to modify it!

Re: more OO way to do hex string to bytes conversion

2018-02-07 Thread Ralph Doncaster via Digitalmars-d-learn
On Tuesday, 6 February 2018 at 18:33:02 UTC, Ralph Doncaster wrote: I've been reading std.conv and std.range, trying to figure out a high-level way of converting a hex string to bytes. The only way I've been able to do it is through pointer access: import std.stdio; import std.string; import

Re: extern(C++) in win32.mak

2018-02-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-02-07 14:47, Paul D Anderson wrote: I get Error: 'of..\generated\windows\release\32\lexer.lib' not found I don't think this file is built anymore. -- /Jacob Carlborg

Re: extern(C++) in win32.mak

2018-02-07 Thread Paul D Anderson via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 08:28:23 UTC, Seb wrote: On Wednesday, 7 February 2018 at 06:05:54 UTC, Paul D Anderson wrote: Is there anyone who knows the ins and outs of the makefile that can shed some light? Thanks, Paul I recommend cloning DMD directly from git if you want to compile

Re: extern(C++) in win32.mak

2018-02-07 Thread Paul D Anderson via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 06:18:04 UTC, rikki cattermole wrote: On 07/02/2018 6:05 AM, Paul D Anderson wrote: I don't understand the following line in dmd/src/win32.mak: extern (C++) __gshared const(char)* ddoc_default = import ("default_ddoc_theme.ddoc"); That is a string import

Re: macOS preview D files

2018-02-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-02-07 02:24, Joel wrote: Using finder, I want to see D files shown in the preview column, I some times have with TextMate. Also on my iPhone (in iCloud app, open as a text file) would be a bonus too. D is not recognized correctly by TextMate, I'm working on fixing that. -- /Jacob

Re: Run-time initialised static variables

2018-02-07 Thread dekevin via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 00:31:01 UTC, Jonathan M Davis wrote: On Tuesday, February 06, 2018 23:50:52 dekevin via Digitalmars-d-learn wrote: Thanks a lot! I will change all my initialisations to static constructors now. I should point out that the downside to static constructors is

Re: GUI program on Mac OS in D?

2018-02-07 Thread mrphobby via Digitalmars-d-learn
On Monday, 5 February 2018 at 19:44:37 UTC, Jacob Carlborg wrote: Note that this applies to all classes, not just NSString. Ah yes, I will make sure it works for all the NSObject types. class NSStringRef { public:     this(string s) {     str_ =

Re: extern(C++) in win32.mak

2018-02-07 Thread Seb via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 06:05:54 UTC, Paul D Anderson wrote: I don't understand the following line in dmd/src/win32.mak: extern (C++) __gshared const(char)* ddoc_default = import ("default_ddoc_theme.ddoc"); What does the word "import" mean in this context? I can't find any