Re: Is it possible to translate this API's C headers?

2018-09-16 Thread Mike Parker via Digitalmars-d-learn
On Monday, 17 September 2018 at 03:16:33 UTC, spikespaz wrote: There is a project that I wish to use from D (https://ultralig.ht). It's Electron, but with forked WebKit and the samples are very, very fast. This is a great compromise between wanting to have a very custom interface and not wa

Re: dub doesn't work with dmd 1:2.082.0-1.0?

2018-09-16 Thread rmc via Digitalmars-d-learn
On Friday, 14 September 2018 at 15:42:05 UTC, Jesse Phillips wrote: On Friday, 14 September 2018 at 05:41:41 UTC, rmc wrote: I do wonder if `dmd` by itself on the command line works. Could it be some sort of 32 bit bug in the latest release of dmd? Relating to argc/argv. "source/dub/compile

Is it possible to translate this API's C headers?

2018-09-16 Thread spikespaz via Digitalmars-d-learn
There is a project that I wish to use from D (https://ultralig.ht). It's Electron, but with forked WebKit and the samples are very, very fast. This is a great compromise between wanting to have a very custom interface and not wanting to use the slow Electron/Sciter/Awesomium/WebView. I am

Re: DMD32 compiling gtkd out of memory on 32bit Windows 7 machine

2018-09-16 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 14 September 2018 at 17:34:59 UTC, Mike Wey wrote: You will also have to pass `--build=plain` to dub because of a optlink bug. https://issues.dlang.org/show_bug.cgi?id=15418 thanks Mike, I tried using `--build-plain`, optlink didn't report out of memory, but it hangs ! ``` Co

Re: Fast linear search for non-null key in slice of Nullable(T, T.max)

2018-09-16 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 16 September 2018 at 16:50:32 UTC, Neia Neutuladh wrote: On Sunday, 16 September 2018 at 16:28:20 UTC, Per Nordlöw wrote: If I have alias N = Nullable!(T, T nullValue) fed as template parameter to another template how can I at compile-time get the `nullValue` ? import std.trai

Re: Fast linear search for non-null key in slice of Nullable(T, T.max)

2018-09-16 Thread Neia Neutuladh via Digitalmars-d-learn
On Sunday, 16 September 2018 at 16:28:20 UTC, Per Nordlöw wrote: If I have alias N = Nullable!(T, T nullValue) fed as template parameter to another template how can I at compile-time get the `nullValue` ? import std.traits; enum nullValue = TemplateArgsOf!(N)[1];

Re: Cannot use UFCS in lambda?

2018-09-16 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 16 September 2018 at 10:55:43 UTC, berni wrote: The problem is more general: you can only use top-level symbols in UFCS. You can use an identity alias template to bypass this: https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/ (search for UFCS in the p

Fast linear search for non-null key in slice of Nullable(T, T.max)

2018-09-16 Thread Per Nordlöw via Digitalmars-d-learn
If I have alias N = Nullable!(T, T nullValue) fed as template parameter to another template how can I at compile-time get the `nullValue` ? I need this to implement fast linear search over a slice of type Nullable!(ulong, ulong.max)[] searching for a non-null key without needing to

Re: Manual delegates

2018-09-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 16 September 2018 at 14:12:27 UTC, Guillaume Piolat wrote: Anyone has any information about the ABI of delegates? In particular how to call them with a particular "this"/frame pointer? To solve a hairy problem I need a delegate with a synthesized frame pointer. https://dpaste.dzf

Re: Manual delegates

2018-09-16 Thread Guillaume Piolat via Digitalmars-d-learn
On Sunday, 16 September 2018 at 14:12:27 UTC, Guillaume Piolat wrote: In particular how to call them with a particular "this"/frame pointer? Related thread: https://forum.dlang.org/post/wjbhpztovxratexao...@forum.dlang.org

Manual delegates

2018-09-16 Thread Guillaume Piolat via Digitalmars-d-learn
Anyone has any information about the ABI of delegates? In particular how to call them with a particular "this"/frame pointer? To solve a hairy problem I need a delegate with a synthesized frame pointer. https://dpaste.dzfl.pl/cf44417c98f9 The problem is that delegate forwarding seems to req

Re: try find the fastest way to convert a group string into index?

2018-09-16 Thread learnfirst1 via Digitalmars-d-learn
On Sunday, 16 September 2018 at 11:51:24 UTC, learnfirst1 wrote: On Sunday, 16 September 2018 at 11:30:11 UTC, learnfirst1 wrote: On Sunday, 16 September 2018 at 10:14:24 UTC, Vladimir Panteleev wrote: I will test pcre solution vs mpfc for benchmark. the pcre is easy to deal with low/up cas

Re: try find the fastest way to convert a group string into index?

2018-09-16 Thread learnfirst1 via Digitalmars-d-learn
On Sunday, 16 September 2018 at 11:30:11 UTC, learnfirst1 wrote: On Sunday, 16 September 2018 at 10:14:24 UTC, Vladimir Panteleev wrote: It has to be case Case Insensitive, so before I run mpfh for each new request headers, I need to convert the keys into low or up case. this value can be

Re: try find the fastest way to convert a group string into index?

2018-09-16 Thread learnfirst1 via Digitalmars-d-learn
On Sunday, 16 September 2018 at 10:14:24 UTC, Vladimir Panteleev wrote: On Sunday, 16 September 2018 at 10:04:09 UTC, learnfirst1 wrote: how to make this more fast like with one loop and get the results. thanks for reply, minimal perfect hashing seems good for this task, I will do more test

Re: Cannot use UFCS in lambda?

2018-09-16 Thread berni via Digitalmars-d-learn
The problem is more general: you can only use top-level symbols in UFCS. You can use an identity alias template to bypass this: https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/ (search for UFCS in the page). Good to know. :-)

Re: try find the fastest way to convert a group string into index?

2018-09-16 Thread Diederik de Groot via Digitalmars-d-learn
Homework ? I think it would also be better to only walk/match the Header.data and header_keys only once (using the generated switch statement that Vladimir suggested). So your Headers struct should have a parse() function, which will match all of the headers to the keys and store them locally

Re: try find the fastest way to convert a group string into index?

2018-09-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 16 September 2018 at 10:04:09 UTC, learnfirst1 wrote: how to make this more fast like with one loop and get the results. This is a more general problem than any specific programming language; you may want to look into perfect hashing: https://en.wikipedia.org/wiki/Perfect_hash_fun

try find the fastest way to convert a group string into index?

2018-09-16 Thread learnfirst1 via Digitalmars-d-learn
The use case is translate http header key into enum. this is the current code : https://run.dlang.io/is/lpw29w In this fake code I only list a few headers, it should be more. but less then 128 and only include the a few codes. how to make this more fast like with one loop and get the result

Re: Cannot use UFCS in lambda?

2018-09-16 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 16 September 2018 at 09:46:15 UTC, berni wrote: Where is my mistake? Lambdas are not the issue here. The problem is more general: you can only use top-level symbols in UFCS. You can use an identity alias template to bypass this: https://blog.thecybershadow.net/2015/04/28/the-amazi

Cannot use UFCS in lambda?

2018-09-16 Thread berni via Digitalmars-d-learn
The following program does not compile: import std.stdio; import std.algorithm; struct A { struct S { int x; } const bool foo(in S s, in int k) { return s.xa.foo(3)).writeln; } } void main() { A().bar(); } I get (using rdmd): test.d(18): Error: no proper