Re: sockaddr_in and InternetAddress

2015-05-28 Thread Vladimir Panteleev via Digitalmars-d
On Friday, 29 May 2015 at 00:08:10 UTC, Andre Kostur wrote: I'm looking for one of two things: 1) If I have a sockaddr_in, how do I get it into an InternetAddress? First of all, you may not actually need an InternetAddress. Modern code working with addresses should be address-agnostic, so i

Re: sockaddr_in and InternetAddress

2015-05-28 Thread Adam D. Ruppe via Digitalmars-d
I would add it as a new constructor to InternetAddress. In the mean time, you could work around the lack of it by making a new subclass of InternetAddress that sets the member with your constructor. Like: class MyInternetAddress : InternetAddress { this(sockaddr_in addr) { this.sin =

sockaddr_in and InternetAddress

2015-05-28 Thread Andre Kostur via Digitalmars-d
I'm looking for one of two things: 1) If I have a sockaddr_in, how do I get it into an InternetAddress? I can do it with sufficient handwaving using bigEndianToNative and such (pulling out the 4-byte address in there), but I was expecting an easier/shorter method to get the sockaddr_in into

As discussed in DConf2015: Python-like keyword arguments

2015-05-28 Thread Atila Neves via Digitalmars-d
I might do a blog post on this, but here's some POC code: import std.stdio; import std.range; import std.typetuple; import std.traits; import std.conv; struct Foo { int i; } struct Bar { int i; } struct Baz { int i; } void func(Foo foo, Bar bar, Baz baz) { writeln("foo is ", foo); wri

Re: Why aren't you using D at work?

2015-05-28 Thread weaselcat via Digitalmars-d
On Thursday, 28 May 2015 at 21:31:08 UTC, ponce wrote: On Thursday, 28 May 2015 at 14:38:51 UTC, Manu wrote: I've been using D in all my personal projects for years now, but I lament coding C at work every day, and I pine for salvation. I seem to have reasonable influence in my workplaces, and

Re: Why aren't you using D at work?

2015-05-28 Thread ponce via Digitalmars-d
On Thursday, 28 May 2015 at 14:38:51 UTC, Manu wrote: I've been using D in all my personal projects for years now, but I lament coding C at work every day, and I pine for salvation. I seem to have reasonable influence in my workplaces, and I suspect I could have my workplace adopt D, but when c

Re: DMD Symbol Reference Analysis Pass

2015-05-28 Thread via Digitalmars-d
On Thursday, 28 May 2015 at 21:23:59 UTC, Per Nordlöw wrote: On Thursday, 28 May 2015 at 20:54:59 UTC, Andrei Alexandrescu wrote: Cool! What are the incompatibilities keeping it from replacing byLine? -- Andrei Speed-up varies between 2.0 and 2.7 according to recent experiments done using new

Re: DMD Symbol Reference Analysis Pass

2015-05-28 Thread via Digitalmars-d
On Thursday, 28 May 2015 at 20:54:59 UTC, Andrei Alexandrescu wrote: Cool! What are the incompatibilities keeping it from replacing byLine? -- Andrei Speed-up varies between 2.0 and 2.7 according to recent experiments done using new unittest at https://github.com/nordlow/justd/blob/79cc8bf07

Re: DMD Symbol Reference Analysis Pass

2015-05-28 Thread Andrei Alexandrescu via Digitalmars-d
On 5/28/15 2:05 PM, "Per =?UTF-8?B?Tm9yZGzDtnci?= " wrote: How faster is bylinefast compared to byline (after the recent improvements)? -- Andrei About 3 times in my measurements. Cool! What are the incompatibilities keeping it from replacing byLine? -- Andrei

Re: DIP78 - macros without syntax extensions

2015-05-28 Thread deadalnix via Digitalmars-d
On Tuesday, 26 May 2015 at 20:23:11 UTC, Kagamin wrote: http://wiki.dlang.org/DIP78 - Proposal for a macro system without syntactical extensions to the language. Hence it doesn't allow arbitrary syntax. This is not even remotely enough to make a DIP. You seem to be using some API to build AST

Re: Why aren't you using D at work?

2015-05-28 Thread rumbu via Digitalmars-d
On Thursday, 28 May 2015 at 14:38:51 UTC, Manu wrote: I expect I'm not alone. Please share the absolute blockers preventing you from adopting D in your offices. I wonder if there will be common themes emerge? We develop tailor made CRM/ERP solutions, mostly in C# or ASP.net. On the clie

Re: DMD Symbol Reference Analysis Pass

2015-05-28 Thread via Digitalmars-d
How faster is bylinefast compared to byline (after the recent improvements)? -- Andrei About 3 times in my measurements.

Re: DIP78 - macros without syntax extensions

2015-05-28 Thread Jacob Carlborg via Digitalmars-d
On 2015-05-28 10:24, Kagamin wrote: Well, that's the point: it's a normal function. But it's not. -- /Jacob Carlborg

Re: Uphill

2015-05-28 Thread ketmar via Digitalmars-d
On Thu, 28 May 2015 08:55:57 +, Chris wrote: > On Wednesday, 27 May 2015 at 19:35:35 UTC, ketmar wrote: >> On Wed, 27 May 2015 13:23:16 +, Paulo Pinto wrote: >> >>> Only when I can sell D to customers that put money into this kind of >>> stuff >> >> if customers are deciding which technol

Re: is there any reason to use SuperFastHash in druntime? (except speed)

2015-05-28 Thread ketmar via Digitalmars-d
On Thu, 28 May 2015 12:39:52 +, Vladimir Panteleev wrote: > On Thursday, 28 May 2015 at 03:09:07 UTC, ketmar wrote: >> SuperFastHash has known distribution problems[1]. > > BTW, something I noticed while browsing Rust docs today: > >> The hashes are all keyed by the thread-local random numbe

Re: is there any reason to use SuperFastHash in druntime? (except speed)

2015-05-28 Thread ketmar via Digitalmars-d
On Thu, 28 May 2015 12:02:44 +, Per Nordlöw wrote: > On Thursday, 28 May 2015 at 03:09:07 UTC, ketmar wrote: >> SuperFastHash has known distribution problems[1]. there is fasthash[2] > > Is there an easy to tweak the default hashing of key type, say `K`, when > using a builtin D AA, say `V[K

Re: Why aren't you using D at work?

2015-05-28 Thread ketmar via Digitalmars-d
"it's not enterprise-accepted. and there are no D programmers available on the market, think about you suddenly don't want to work anymore (which happens to me sometimes)." not that i really pushing, though, as i have personal reasons to not push hard (language warts). and we don't do many C/C+

Re: Why aren't you using D at work?

2015-05-28 Thread Joakim via Digitalmars-d
On Thursday, 28 May 2015 at 14:38:51 UTC, Manu wrote: I often wonder if others share the importance of mobile cross-compilers? I wonder that sometimes too, considering it's only two people working on them. They seem to be getting lots of love recently, which is very exciting! I'd like to en

Re: Why aren't you using D at work?

2015-05-28 Thread Andrei Alexandrescu via Digitalmars-d
On 5/28/15 8:38 AM, Manu via Digitalmars-d wrote: * Forceinline. Thanks for initiating this! The lack of a means to force inlining has been unpleasant at Facebook as well. It would be great if we got this (and of course other items on the list) rolling. -- Andrei

Re: Why aren't you using D at work?

2015-05-28 Thread Atila Neves via Digitalmars-d
I've been fortunate enough to convince management to let me write D code. Up until now it's been mostly tools, but I recently rewrote some of our functionality in D and somehow my team was convinced that we can use the D server to test our client code, with them willing to learn D and modify my

Re: Why aren't you using D at work?

2015-05-28 Thread Meta via Digitalmars-d
On Thursday, 28 May 2015 at 14:38:51 UTC, Manu wrote: I've been using D in all my personal projects for years now, but I lament coding C at work every day, and I pine for salvation. I seem to have reasonable influence in my workplaces, and I suspect I could have my workplace adopt D, but when c

Re: Why aren't you using D at work?

2015-05-28 Thread Palmstroem via Digitalmars-d
I'll soon need to port a 30KLOC server application to windows. It is roughly five years old and written in C using glib2. Parts of it are still version controlled in CVS and the build system is based on autotools. I am quite sure, that there won't be a running/maintainable windows version unt

Re: DMD Symbol Reference Analysis Pass

2015-05-28 Thread Andrei Alexandrescu via Digitalmars-d
On 5/28/15 5:38 AM, "Per =?UTF-8?B?Tm9yZGzDtnci?= " wrote: On Wednesday, 27 May 2015 at 15:21:38 UTC, weaselcat wrote: I might be wrong, but I thought dip25 was only enabled in @safe annotated code? I updated bylinefast at https://github.com/nordlow/justd/blob/master/bylinefast.d#L188 How f

Why aren't you using D at work?

2015-05-28 Thread Manu via Digitalmars-d
I've been using D in all my personal projects for years now, but I lament coding C at work every day, and I pine for salvation. I seem to have reasonable influence in my workplaces, and I suspect I could have my workplace adopt D, but when considering the notion with other staff, we always seem to

Re: is there any reason to use SuperFastHash in druntime? (except speed)

2015-05-28 Thread Kagamin via Digitalmars-d
On Thursday, 28 May 2015 at 12:40:07 UTC, Vladimir Panteleev wrote: As I understand, D is certainly vulnerable to Hash DoS. https://issues.dlang.org/show_bug.cgi?id=14414

Re: DIP78 - macros without syntax extensions

2015-05-28 Thread Steven Schveighoffer via Digitalmars-d
On 5/26/15 2:23 PM, Kagamin wrote: http://wiki.dlang.org/DIP78 - Proposal for a macro system without syntactical extensions to the language. Hence it doesn't allow arbitrary syntax. Quote from dconf W&A ask me anything: Q: "Will we get a macro system" Both Walter and Andrei: "no" Doesn't see

Re: smart pointer for interior pointers

2015-05-28 Thread Steven Schveighoffer via Digitalmars-d
On 5/27/15 9:13 PM, ketmar wrote: On Wed, 27 May 2015 17:31:32 -0600, Steven Schveighoffer wrote: But we can solve this with a postblit: seems that you forgot about "move" semantics for structs. under some conditions struct can be "moved", not "copied", so it `memcpy`ed and no postblit will b

Re: std.database

2015-05-28 Thread Erik Smith via Digitalmars-d
It seems std.database.sql not std.database. You can't build, for example, a mongodb driver over this. Maybe, but mongodb is a proprietary nosql interface rather than a standard one so I'm not sure that it should be in std. erik

Re: smart pointer for interior pointers

2015-05-28 Thread Steven Schveighoffer via Digitalmars-d
On 5/27/15 6:21 PM, Artur Skawina via Digitalmars-d wrote: But with alias this, we can define a way to solve all these problems. struct SPtr(T) { ptrdiff_t _offset; void opAssign(T *orig) { _offset = cast(void *)orig - cast(void *)&this;} inout(T) *_get() inout { return cast(inou

Re: std.database

2015-05-28 Thread Erik Smith via Digitalmars-d
Maybe make the database providers interfaces instead of data+dispatch? You're allocating the stuff anyway. Do you mean inheriting from interfaces like this? class MysqlStatement : Statement {...} I need deterministic resource management and I don't think classes provide that. Using structs w

Re: is there any reason to use SuperFastHash in druntime? (except speed)

2015-05-28 Thread Vladimir Panteleev via Digitalmars-d
On Thursday, 28 May 2015 at 03:09:07 UTC, ketmar wrote: SuperFastHash has known distribution problems[1]. BTW, something I noticed while browsing Rust docs today: The hashes are all keyed by the thread-local random number generator on creation by default. This means that the ordering of the

Re: is there any reason to use SuperFastHash in druntime? (except speed)

2015-05-28 Thread via Digitalmars-d
On Thursday, 28 May 2015 at 03:09:07 UTC, ketmar wrote: SuperFastHash has known distribution problems[1]. there is fasthash[2] Is there an easy to tweak the default hashing of key type, say `K`, when using a builtin D AA, say `V[K]`?

Re: std.database

2015-05-28 Thread Kagamin via Digitalmars-d
On Thursday, 28 May 2015 at 09:18:53 UTC, Sebastiaan Koppe wrote: That might be, but doing struct-table mappings will open a big can of worms, not to mention all the syntax opinions (optional and default values, table relationships, etc). Beter build layer by layer. In fact, Robert did layere

Re: DMD Symbol Reference Analysis Pass

2015-05-28 Thread via Digitalmars-d
On Thursday, 28 May 2015 at 11:38:25 UTC, Per Nordlöw wrote: DMD (2.067 and git master) with -dip25 still doesn't complain about ... My guess is that this passes because the internal storage is GC-allocated. I'm sensing we need a new qualifier for this or that there is more logic to come in

Re: DMD Symbol Reference Analysis Pass

2015-05-28 Thread via Digitalmars-d
On Wednesday, 27 May 2015 at 15:21:38 UTC, weaselcat wrote: I might be wrong, but I thought dip25 was only enabled in @safe annotated code? I updated bylinefast at https://github.com/nordlow/justd/blob/master/bylinefast.d#L188 to make the unittest @safe and members of @trusted. DMD (2.067 an

Re: Uphill

2015-05-28 Thread Chris via Digitalmars-d
On Thursday, 28 May 2015 at 09:23:07 UTC, Rikki Cattermole wrote: On 28/05/2015 8:55 p.m., Chris wrote: On Wednesday, 27 May 2015 at 19:35:35 UTC, ketmar wrote: On Wed, 27 May 2015 13:23:16 +, Paulo Pinto wrote: Only when I can sell D to customers that put money into this kind of stuff

Exhaustive unit tests

2015-05-28 Thread Chris via Digitalmars-d
I'm referring to this bug/enhancement request: https://issues.dlang.org/show_bug.cgi?id=14615 I checked the unit test(s) for it (see below), and found that they only check for the positive case, i.e. that a substitution takes place, not for the case that no substitution takes place. The bug r

Re: std.database

2015-05-28 Thread Sebastiaan Koppe via Digitalmars-d
On Thursday, 28 May 2015 at 04:57:55 UTC, Robert burner Schadek wrote: On Thursday, 28 May 2015 at 04:45:52 UTC, Erik Smith wrote: Shouldn't the statement be reusable? Yes it should. I added this use case: auto stmt = con.statement("insert into table values(?,?)"); stmt.execute("a",1); stmt.

Re: Uphill

2015-05-28 Thread Rikki Cattermole via Digitalmars-d
On 28/05/2015 8:55 p.m., Chris wrote: On Wednesday, 27 May 2015 at 19:35:35 UTC, ketmar wrote: On Wed, 27 May 2015 13:23:16 +, Paulo Pinto wrote: Only when I can sell D to customers that put money into this kind of stuff if customers are deciding which technologies to use... ok then, th

Re: Uphill

2015-05-28 Thread Chris via Digitalmars-d
On Wednesday, 27 May 2015 at 19:35:35 UTC, ketmar wrote: On Wed, 27 May 2015 13:23:16 +, Paulo Pinto wrote: Only when I can sell D to customers that put money into this kind of stuff if customers are deciding which technologies to use... ok then, they can do their work without my help

Re: DIP78 - macros without syntax extensions

2015-05-28 Thread Kagamin via Digitalmars-d
On Thursday, 28 May 2015 at 06:39:11 UTC, Jacob Carlborg wrote: Auto myAssert(Auto condition, Auto message) { return message; } Not so easy to tell that "myAssert" is a macro declaration just by looking in the module "bar". Well, that's the point: it's a normal function.

Re: std.database

2015-05-28 Thread Andrea Fontana via Digitalmars-d
It seems std.database.sql not std.database. You can't build, for example, a mongodb driver over this. On Thursday, 28 May 2015 at 02:04:31 UTC, Erik Smith wrote: I'm working on a standards grade interface & implementation for database clients in D. It defines a common interface (the implici

Re: DIP78 - macros without syntax extensions

2015-05-28 Thread Kagamin via Digitalmars-d
On Wednesday, 27 May 2015 at 17:03:30 UTC, Artur Skawina wrote: That already works. Eg: alias deduceType(Args...) = typeof({ // some complex imperative code to deduce the type from the args import std.range; return mixin(iota(Args.length).map!q{`Args[`~text(a)~']'}().join

Re: std.database

2015-05-28 Thread Kagamin via Digitalmars-d
On Thursday, 28 May 2015 at 02:04:31 UTC, Erik Smith wrote: https://github.com/cruisercoder/ddb Maybe make the database providers interfaces instead of data+dispatch? You're allocating the stuff anyway.

Re: std.database

2015-05-28 Thread miazo via Digitalmars-d
On Thursday, 28 May 2015 at 05:12:34 UTC, Vadim Lopatin wrote: On Thursday, 28 May 2015 at 05:00:30 UTC, Rikki Cattermole wrote: On 28/05/2015 4:57 p.m., Robert burner Schadek wrote: On Thursday, 28 May 2015 at 04:45:52 UTC, Erik Smith wrote: Shouldn't the statement be reusable? Yes it shoul