Why was new(size_t s) { } deprecated in favor of an external allocator?

2020-10-14 Thread Jack via Digitalmars-d-learn
What was the reasoning behind this decision?

Re: malloc(s)[0..s] vs cast(T)malloc(s)

2020-10-14 Thread Ali Çehreli via Digitalmars-d-learn
On 10/14/20 1:15 PM, Jack wrote: >> auto x = malloc(s)[0..s]; > https://wiki.dlang.org/Memory_Management#Explicit_Class_Instance_Allocation Note that 'x' is passed to emplace() at that link and emplace() requires a slice. That's why the a slice is made from the pointer returned by

Re: malloc(s)[0..s] vs cast(T)malloc(s)

2020-10-14 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 20:15:39 UTC, Jack wrote: What's the difference between: import core.stdc.stdlib : malloc; auto x = malloc(s)[0..s]; and auto x = cast(T)malloc(s); ? I have been using the last but I saw in some code examples, like this[1] the first being used. What's the

Compile-time function call with transformed parameters

2020-10-14 Thread realhet via Digitalmars-d-learn
Hi, Is there a way to make this in a nicer way without the string mixin? private auto generateVector(CT, alias fun, T...)(in T args){ static if(anyVector!T){ Vector!(CT, CommonVectorLength!T) res; static foreach(i; 0..res.length) res[i] = mixin("fun(", T.length.iota.map!(j =>

Re: Why was new(size_t s) { } deprecated in favor of an external allocator?

2020-10-14 Thread Max Haughton via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 20:27:10 UTC, Jack wrote: What was the reasoning behind this decision? Andrei's std::allocator talk from a few years ago at cppcon covers this (amongst other things)

malloc(s)[0..s] vs cast(T)malloc(s)

2020-10-14 Thread Jack via Digitalmars-d-learn
What's the difference between: import core.stdc.stdlib : malloc; auto x = malloc(s)[0..s]; and auto x = cast(T)malloc(s); ? I have been using the last but I saw in some code examples, like this[1] the first being used. What's the difference? in the first one bounds checking is performed,

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-14 Thread Bruno Rodrigues via Digitalmars-d-learn
So, it did work... The problem was on me, I guess. I was using this example: https://tour.dlang.org/tour/en/dub/vibe-d It wasn't working at all... So I've changed to this one, and it did work. https://code.dlang.org/packages/vibe-d/0.9.2 I've used the first example, there are some

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-14 Thread Bruno Rodrigues via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 01:32:34 UTC, Steven Schveighoffer wrote: On 10/13/20 8:40 PM, Bruno Rodrigues wrote: So, I tried building a simple hello world with Vibe-d and got this error /usr/bin/ld: cannot find -lssl /usr/bin/ld: cannot find -lcrypto collect2: error: ld returned 1 exit

Re: vibe.d / experience / feedback

2020-10-14 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 12:29:24 UTC, Alaindevos wrote: One concept at a time. This is one of the simplest examples in vibe.d. I look for the code for the same functionality but without authentication/login. https://github.com/vibe-d/vibe.d/blob/master/examples/web/source/app.d Where

Re: vibe.d / experience / feedback

2020-10-14 Thread Alaindevos via Digitalmars-d-learn
One concept at a time. This is one of the simplest examples in vibe.d. I look for the code for the same functionality but without authentication/login. https://github.com/vibe-d/vibe.d/blob/master/examples/web/source/app.d Where are the @ lines explained ?

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-14 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 13:20:53 UTC, Bruno Rodrigues wrote: On Wednesday, 14 October 2020 at 01:32:34 UTC, Steven Schveighoffer wrote: [...] Thank you, Steve! It did work but none of the examples on the Vibe.d page are working with current D version... Some errors I got When

Re: vibe.d / experience / feedback

2020-10-14 Thread Alaindevos via Digitalmars-d-learn
forms.

Re: vibe.d / experience / feedback

2020-10-14 Thread Alaindevos via Digitalmars-d-learn
Is there an example just more functional then skeleton http server ? Sending data to the server and back .

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-14 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Oct 14, 2020 at 05:30:37PM +, Andre Pany via Digitalmars-d-learn wrote: > On Wednesday, 14 October 2020 at 16:39:39 UTC, Imperatorn wrote: > > On Wednesday, 14 October 2020 at 15:27:46 UTC, Andre Pany wrote: [...] > > > Please add this to your dub.json file: > > > "versions": [

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-14 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 18:08:40 UTC, H. S. Teoh wrote: On Wed, Oct 14, 2020 at 05:30:37PM +, Andre Pany via Digitalmars-d-learn wrote: On Wednesday, 14 October 2020 at 16:39:39 UTC, Imperatorn wrote: > On Wednesday, 14 October 2020 at 15:27:46 UTC, Andre Pany > wrote: [...] > >

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-14 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 15:27:46 UTC, Andre Pany wrote: On Wednesday, 14 October 2020 at 13:20:53 UTC, Bruno Rodrigues wrote: On Wednesday, 14 October 2020 at 01:32:34 UTC, Steven Schveighoffer wrote: [...] Thank you, Steve! It did work but none of the examples on the Vibe.d page

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-14 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 16:39:39 UTC, Imperatorn wrote: On Wednesday, 14 October 2020 at 15:27:46 UTC, Andre Pany wrote: On Wednesday, 14 October 2020 at 13:20:53 UTC, Bruno Rodrigues wrote: On Wednesday, 14 October 2020 at 01:32:34 UTC, Steven Schveighoffer wrote: [...] Thank you,

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-14 Thread Bruno Rodrigues via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 15:27:46 UTC, Andre Pany wrote: On Wednesday, 14 October 2020 at 13:20:53 UTC, Bruno Rodrigues wrote: On Wednesday, 14 October 2020 at 01:32:34 UTC, Steven Schveighoffer wrote: [...] Thank you, Steve! It did work but none of the examples on the Vibe.d page

Re: How do I make this function from module public?

2020-10-14 Thread Jack via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 01:55:13 UTC, Adam D. Ruppe wrote: On Wednesday, 14 October 2020 at 01:46:11 UTC, Jack wrote: extern(C): int mul(int a, int b) { return a * b;} mark it `export` as well and then be sure you are compiling in this module as well, it must be included on the