Re: std.socket replacement

2015-11-29 Thread tired_eyes via Digitalmars-d-learn
On Sunday, 29 November 2015 at 16:10:22 UTC, Alex Parrill wrote: std.stream, and the stream interface in general, is deprecated in favor of ranges, which are more generic and flexible. Could you please give a small example? Consider this minimal app: import std.stdio; import std.socket;

Re: std.socket replacement

2015-11-29 Thread tired_eyes via Digitalmars-d-learn
On Sunday, 29 November 2015 at 09:05:37 UTC, tcak wrote: On Sunday, 29 November 2015 at 08:56:30 UTC, tired_eyes wrote: I was a bit surprised to see that std.socket is deprecated as of 2.069. Just curious, what's wrong with it? And what should I use as a replacement? I know there is

std.socket replacement

2015-11-29 Thread tired_eyes via Digitalmars-d-learn
I was a bit surprised to see that std.socket is deprecated as of 2.069. Just curious, what's wrong with it? And what should I use as a replacement? I know there is vibe.socket, but I don't want to include fullstack web framework as a dependency just to make some HTTP reqests. I also don't

String interpolation

2015-11-10 Thread tired_eyes via Digitalmars-d-learn
Hi, The only example of string interpolation I've found so far is on Rosetta Code: void main() { import std.stdio, std.string; "Mary had a %s lamb.".format("little").writeln; "Mary had a %2$s %1$s lamb.".format("little", "white").writeln; } Is this a "proper" way of string

Re: String interpolation

2015-11-10 Thread tired_eyes via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath wrote: On Tuesday, 10 November 2015 at 10:21:32 UTC, tired_eyes wrote: Hi, The only example of string interpolation I've found so far is on Rosetta Code: void main() { import std.stdio, std.string; "Mary had a %s

Re: String interpolation

2015-11-10 Thread tired_eyes via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 11:29:32 UTC, TheFlyingFiddle wrote: On Tuesday, 10 November 2015 at 10:41:52 UTC, tired_eyes wrote: On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath wrote: Ruby: a = 1 b = 4 puts "The number #{a} is less than #{b}" PHP: $a = 1; $b = 4; echo "The

Re: Compilation time profiling

2015-10-25 Thread tired_eyes via Digitalmars-d-learn
On Saturday, 24 October 2015 at 22:16:35 UTC, Vladimir Panteleev wrote: On Saturday, 24 October 2015 at 21:56:05 UTC, tired_eyes wrote: Hi, are there any tools for compilation time profiling? I'm trying to find what part of the code increases compilation time and don't want to stumble around.

Compilation time profiling

2015-10-24 Thread tired_eyes via Digitalmars-d-learn
Hi, are there any tools for compilation time profiling? I'm trying to find what part of the code increases compilation time and don't want to stumble around.

Re: Dub package with C code

2015-09-25 Thread tired_eyes via Digitalmars-d-learn
I meant if there is already a place where I can upload my post to. Something like blog.dlang.org OT: Once again, I'm absolutely sure tha D should have an official blog! Forums can't replace blogs, forums are for discussions, not for content presentation.

Re: std.net.curl

2015-08-17 Thread tired_eyes via Digitalmars-d-learn
On Monday, 17 August 2015 at 13:26:29 UTC, Adam D. Ruppe wrote: On Monday, 17 August 2015 at 13:04:31 UTC, tired_eyes wrote: Error: unrecognized switch '-lcurl' ooh I'm sorry, should have been `dmd -L-lcurl yourprogram.d` Yes, it did the trick.

std.net.curl

2015-08-17 Thread tired_eyes via Digitalmars-d-learn
Hi, I'm trying to compile this trivial example of std.net.curl: // app.d import std.stdio; import std.net.curl; void main() { auto content = get(dlang.org); } Hovewer, dmd app.d spits a whole bunch of strange error messages: /usr/lib64/libphobos2.a(curl.o): In function

Re: std.net.curl

2015-08-17 Thread tired_eyes via Digitalmars-d-learn
On Monday, 17 August 2015 at 12:58:54 UTC, Adam D. Ruppe wrote: On Monday, 17 August 2015 at 12:52:37 UTC, tired_eyes wrote: Hovewer, dmd app.d spits a whole bunch of strange error messages: try dmd -lcurl app.d and see if that helps. Error: unrecognized switch '-lcurl'

Re: How to avoid multiple spelling `import`

2015-06-16 Thread tired_eyes via Digitalmars-d-learn
On Tuesday, 16 June 2015 at 15:42:02 UTC, Dennis Ritchie wrote: On Tuesday, 16 June 2015 at 12:41:14 UTC, Daniel Kozák wrote: On Tue, 16 Jun 2015 11:45:22 + Dennis Ritchie via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I just want to import individual features of these

Re: How to avoid multiple spelling `import`

2015-06-16 Thread tired_eyes via Digitalmars-d-learn
On Wednesday, 17 June 2015 at 01:56:45 UTC, flamencofantasy wrote: On Tuesday, 16 June 2015 at 16:40:39 UTC, tired_eyes wrote: On Tuesday, 16 June 2015 at 15:42:02 UTC, Dennis Ritchie wrote: On Tuesday, 16 June 2015 at 12:41:14 UTC, Daniel Kozák wrote: [...] Thanks. Maybe I'll use this code

Re: How to simulate a new type

2015-05-15 Thread tired_eyes via Digitalmars-d-learn
On Friday, 15 May 2015 at 06:11:41 UTC, Charles Hixson wrote: On 05/14/2015 06:38 PM, Adam D. Ruppe via Digitalmars-d-learn wrote: On Friday, 15 May 2015 at 01:03:32 UTC, Charles Hixson wrote: Yes, that looks as if it would do the job, but what are its advantages over a simple struct?

Re: Array of objects and their inheritance

2015-05-15 Thread tired_eyes via Digitalmars-d-learn
Thank you for the explanation

Array of objects and their inheritance

2015-05-14 Thread tired_eyes via Digitalmars-d-learn
Hi. I'm having a hard time understanding D's inheritance. Consider the following code: class Parent { public int x = 10; } class Child : Parent { public int y = 20; } void main() { import std.stdio; Parent[] array; auto obj1 = new Parent(); auto obj2 = new Child();

std.random question

2015-05-03 Thread tired_eyes via Digitalmars-d-learn
Feels pretty silly, but I can't compile this: import std.random; auto i = uniform(0, 10); DMD spits this: /usr/include/dmd/phobos/std/random.d(1188): Error: static variable initialized cannot be read at compile time /usr/include/dmd/phobos/std/random.d(1231):called from here:

Re: std.random question

2015-05-03 Thread tired_eyes via Digitalmars-d-learn
On Sunday, 3 May 2015 at 08:48:52 UTC, Dennis Ritchie wrote: On Sunday, 3 May 2015 at 08:42:57 UTC, tired_eyes wrote: Feels pretty silly, but I can't compile this: import std.random; auto i = uniform(0, 10); DMD spits this: /usr/include/dmd/phobos/std/random.d(1188): Error: static

Re: std.random question

2015-05-03 Thread tired_eyes via Digitalmars-d-learn
import std.random; struct Mystruct { int id; static opCall() { Mystruct s; s.id = uniform(0, 10); return s; } } void main() { auto s = Mystruct(); // whatever } --- This make sense, thant you for the

Re: std.random question

2015-05-03 Thread tired_eyes via Digitalmars-d-learn
Hmmm. hap.random from http://code.dlang.org/packages/hap behaves exactly the same.

Re: std.json questions

2015-04-26 Thread tired_eyes via Digitalmars-d-learn
Thank everybody for you help. For now, yajl-d seems to be an optimal for my task, however will keep an eye for stdx.data.json too.

std.json questions

2015-04-25 Thread tired_eyes via Digitalmars-d-learn
Hello, D community! I'm pretty new to D and to compiled languages in general, and have primarily web background (PHP, JS), when JSON workflow is very organic. I was always sure that JSON is a simple thing, but std.json proves me wrong. So may I have a little advice from more experienced D