Is a type not a symbol?

2015-12-22 Thread Shriramana Sharma via Digitalmars-d-learn
http://dlang.org/spec/template.html#TemplateTupleParameter says that an AliasSeq (wording needs to be updated) "is a sequence of any mix of types, expressions or symbols." Is a type not a symbol? I mean, alias can refer to both, no? -- Shriramana Sharma, Penguin #395953

: in template specialization vs constraint

2015-12-22 Thread Shriramana Sharma via Digitalmars-d-learn
import std.stdio; void func(T)(T v) { writeln(1); } void func(T: int)(T v) { writeln(2); } void func(T)(T v) if (is(T: int)) { writeln(3); } void main() { func(100); ubyte s = 200; func(s); } The above code prints 2 twice. A fwe questions: 1) At func(100) why isn't the compiler

Re: Let dmd or ldc be easy to setup on Ubuntu

2015-12-22 Thread FrankLike via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 14:37:21 UTC, Rikki Cattermole wrote: I'm confused. The commands listed e.g. $ sudo wget http://netcologne.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list $ sudo apt-get update && sudo apt-get -y --allow-unauthenticated

Re: Let dmd or ldc be easy to setup on Ubuntu

2015-12-22 Thread FrankLike via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 15:08:20 UTC, FrankLike wrote: On Tuesday, 22 December 2015 at 14:37:21 UTC, Rikki Cattermole wrote: I'm confused. The commands listed e.g. $ sudo wget http://netcologne.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list $

Re: : in template specialization vs constraint

2015-12-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 15:29:16 UTC, Shriramana Sharma wrote: 1) At func(100) why isn't the compiler complaining that it is able to match two templates i.e. the ones printing 2 and 3? Because the specialized one just wins the context. It only complains when there's two equal ones.

Re: Is a type not a symbol?

2015-12-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 15:22:49 UTC, Shriramana Sharma wrote: Is a type not a symbol? I mean, alias can refer to both, no? Keywords aren't symbols so `int` is a type, but not a symbol and thus qualifies as `T` but not as `alias T`.

Re: Let dmd or ldc be easy to setup on Ubuntu

2015-12-22 Thread Jordi Sayol via Digitalmars-d-learn
El 22/12/15 a les 18:28, Jordi Sayol via Digitalmars-d-learn ha escrit: > "d-lang" splits it in few deb packages: s/d-lang/d-apt/

Re: Most performant way of converting int to string

2015-12-22 Thread Daniel Kozák via Digitalmars-d-learn
V Tue, 22 Dec 2015 18:39:16 + Ivan Kazmenko via Digitalmars-d-learn napsáno: > On Tuesday, 22 December 2015 at 18:11:24 UTC, rumbu wrote: > > On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew Chapman > > wrote: > >> Sorry if this is a silly question

MonoTime longevity

2015-12-22 Thread Tanel Tagaväli via Digitalmars-d-learn
I discovered something potentially troublesome in druntime. Namely, applications that use MonoTime will break if run 18 hours after booting, according to a short program I wrote. Here's my code: ``` import core.time : MonoTime; auto mt = MonoTime.currTime; import std.stdio : writeln;

Re: MonoTime longevity

2015-12-22 Thread Tanel Tagaväli via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 20:07:58 UTC, Steven Schveighoffer wrote: MonoTime uses whatever precision is given to it by the OS. So if on your OS, ticksPerSecond is 1e9, then your OS clock wraps at 18 hours as well. Thanks, I didn't know that. I actually just realized that my use case

Re: Most performant way of converting int to string

2015-12-22 Thread Daniel Kozák via Digitalmars-d-learn
V Tue, 22 Dec 2015 18:11:24 + rumbu via Digitalmars-d-learn napsáno: > On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew Chapman > wrote: > > Sorry if this is a silly question but is the to! method from > > the conv library the most efficient way of

Re: Most performant way of converting int to string

2015-12-22 Thread rumbu via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew Chapman wrote: Sorry if this is a silly question but is the to! method from the conv library the most efficient way of converting an integer value to a string? e.g. string s = to!string(100); I'm seeing a pretty dramatic slow down in my

Re: Most performant way of converting int to string

2015-12-22 Thread Daniel Kozák via Digitalmars-d-learn
V Tue, 22 Dec 2015 17:15:27 + Andrew Chapman via Digitalmars-d-learn napsáno: > Sorry if this is a silly question but is the to! method from the > conv library the most efficient way of converting an integer > value to a string? > > e.g. > string s =

Re: Most performant way of converting int to string

2015-12-22 Thread Daniel Kozák via Digitalmars-d-learn
V Tue, 22 Dec 2015 20:52:07 + rumbu via Digitalmars-d-learn napsáno: > On Tuesday, 22 December 2015 at 19:45:46 UTC, Daniel Kozák wrote: > > V Tue, 22 Dec 2015 18:11:24 + > > rumbu via Digitalmars-d-learn > > > >

Re: Most performant way of converting int to string

2015-12-22 Thread Andrew Chapman via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 18:11:24 UTC, rumbu wrote: On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew Chapman wrote: Sorry if this is a silly question but is the to! method from the conv library the most efficient way of converting an integer value to a string? e.g. string s =

Re: MonoTime longevity

2015-12-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/22/15 2:48 PM, Tanel Tagaväli wrote: I discovered something potentially troublesome in druntime. Namely, applications that use MonoTime will break if run 18 hours after booting, according to a short program I wrote. Here's my code: ``` import core.time : MonoTime; auto mt =

Re: Most performant way of converting int to string

2015-12-22 Thread rumbu via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 20:52:07 UTC, rumbu wrote: On Tuesday, 22 December 2015 at 19:45:46 UTC, Daniel Kozák wrote: V Tue, 22 Dec 2015 18:11:24 + rumbu via Digitalmars-d-learn napsáno: On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew

Re: Most performant way of converting int to string

2015-12-22 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Dec 22, 2015 at 08:54:35PM +0100, Daniel Kozák via Digitalmars-d-learn wrote: > V Tue, 22 Dec 2015 09:43:00 -0800 > "H. S. Teoh via Digitalmars-d-learn" > napsáno: > > > On Tue, Dec 22, 2015 at 05:23:11PM +, Andrew Chapman via > >

Re: Most performant way of converting int to string

2015-12-22 Thread Daniel Kozák via Digitalmars-d-learn
V Tue, 22 Dec 2015 21:10:54 + rumbu via Digitalmars-d-learn napsáno: > On Tuesday, 22 December 2015 at 20:52:07 UTC, rumbu wrote: > > On Tuesday, 22 December 2015 at 19:45:46 UTC, Daniel Kozák > > wrote: > >> V Tue, 22 Dec 2015 18:11:24 + > >> rumbu

Re: How is D doing?

2015-12-22 Thread Cavanni via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 03:43:24 UTC, ShinraTensei wrote: A friend of mine told me that my post might have sounded a bit trollish i assure you that was not the case. In fact it sounds very nonsense to me. You know you just came here asking on a "D FORUM" if the "D Programming

Re: How is D doing?

2015-12-22 Thread ShinraTensei via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 21:58:24 UTC, Cavanni wrote: On Tuesday, 22 December 2015 at 03:43:24 UTC, ShinraTensei wrote: A friend of mine told me that my post might have sounded a bit trollish i assure you that was not the case. In fact it sounds very nonsense to me. You know you

Lots of D code

2015-12-22 Thread steven kladitis via Digitalmars-d-learn
I have 843 programs written in D. 805 actually create an 32 bit exe in windows 10. I am running the latest D. Some just start to link and the linker disappears. Some just have issues I am not able figure out. I can attach the code and scripts I use to compile and run these. If anyone is

Re: MonoTime longevity

2015-12-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, December 22, 2015 15:07:58 Steven Schveighoffer via Digitalmars-d-learn wrote: > MonoTime uses whatever precision is given to it by the OS. So if on your > OS, ticksPerSecond is 1e9, then your OS clock wraps at 18 hours as well. 1e9 ticks per second should still take over 293 years

Re: : in template specialization vs constraint

2015-12-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/22/15 10:40 AM, Adam D. Ruppe wrote: In specialization, it will implicitly convert, it will just select the best match available. Make #1: void func(T : ubyte)(T v) { writeln(1); } It will then use that for for the second line because it is a *better* match than :int, but :int

Re: Most performant way of converting int to string

2015-12-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/22/15 12:15 PM, Andrew Chapman wrote: Sorry if this is a silly question but is the to! method from the conv library the most efficient way of converting an integer value to a string? e.g. string s = to!string(100); I'm seeing a pretty dramatic slow down in my code when I use a conversion

Re: curl : access violation

2015-12-22 Thread Ali Çehreli via Digitalmars-d-learn
On 12/22/2015 03:10 AM, Vic wrote: I am testing simple code in Geany (Windows 7, DMD compiler): import std.stdio,std.net.curl; void main() { // Return a char[] containing the content specified by an URL auto content = get("dlang.org"); } It compiled ok, but I get error after running exe file:

Re: How is D doing?

2015-12-22 Thread ZombineDev via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 17:49:34 UTC, Jakob Jenkov wrote: On Tuesday, 22 December 2015 at 03:30:32 UTC, ShinraTensei wrote: I recently noticed massive increase in new languages for a person to jump into(Nim, Rust, Go...etc) but my question is weather the D is actually used anywhere or

Re: Most performant way of converting int to string

2015-12-22 Thread Daniel Kozak via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 18:27:12 UTC, cym13 wrote: ... I don't think there is anything in the standard library that would really help here as (if I read it correctly) it is mainly because of the conversion from ranges to arrays that this code is slow. Yes, it has been faster in past,

Re: Most performant way of converting int to string

2015-12-22 Thread Ali Çehreli via Digitalmars-d-learn
On 12/22/2015 10:15 AM, Andrew Chapman wrote: > On Tuesday, 22 December 2015 at 18:11:24 UTC, rumbu wrote: >> Converting numbers to string involves the most expensive known two >> operations : division and modulus by 10. > > Cool thanks, so essentially it's unavoidable There is hope. :) > I

Re: Most performant way of converting int to string

2015-12-22 Thread Ivan Kazmenko via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 18:11:24 UTC, rumbu wrote: On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew Chapman wrote: Sorry if this is a silly question but is the to! method from the conv library the most efficient way of converting an integer value to a string? e.g. string s =

Re: Most performant way of converting int to string

2015-12-22 Thread Daniel Kozák via Digitalmars-d-learn
V Tue, 22 Dec 2015 09:43:00 -0800 "H. S. Teoh via Digitalmars-d-learn" napsáno: > On Tue, Dec 22, 2015 at 05:23:11PM +, Andrew Chapman via > Digitalmars-d-learn wrote: [...] > > for({int i; i = 0;} i < num; i++) { > > //string s =

Re: Most performant way of converting int to string

2015-12-22 Thread Andrew Chapman via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 17:43:00 UTC, H. S. Teoh wrote: I wonder if the slowdown is caused by GC collection cycles (because calling to!string will allocate, and here you're making a very large number of small allocations, which is known to cause GC performance issues). Try inserting

Re: Most performant way of converting int to string

2015-12-22 Thread Daniel Kozák via Digitalmars-d-learn
V Tue, 22 Dec 2015 12:55:10 -0800 "H. S. Teoh via Digitalmars-d-learn" napsáno: > On Tue, Dec 22, 2015 at 08:54:35PM +0100, Daniel Kozák via > Digitalmars-d-learn wrote: > > V Tue, 22 Dec 2015 09:43:00 -0800 > > "H. S. Teoh via Digitalmars-d-learn" > >

Re: segfault in invariant { assert(super); }

2015-12-22 Thread SimonN via Digitalmars-d-learn
On Monday, 21 December 2015 at 20:29:14 UTC, Steven Schveighoffer wrote: 1) Is this recursion expected? Yes. assert calls the virtual invariant function, which in the case of super is equivalent to this. So you are essentially calling assert(this). 2) The example is a dustmite'd version of

Setting native OS thread name (eg, via prctl)

2015-12-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
I have this trivial code where the main thread clones a child thread. import std.stdio; import core.thread; import std.concurrency; class DerivedThread : Thread { this() { super(); } void quit() { _quit = true; } private: void setOSThreadName()

Re: Setting native OS thread name (eg, via prctl)

2015-12-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 16:08:01 UTC, Dejan Lekic wrote: Arun, isn't that what the 'name' property is there for? Hi Dejan, Thanks for a quick reply. Setting the name property is not reflecting in the OS level. May be it is just used only at the object level? After setting the

curl : access violation

2015-12-22 Thread Vic via Digitalmars-d-learn
I am testing simple code in Geany (Windows 7, DMD compiler): import std.stdio,std.net.curl; void main() { // Return a char[] containing the content specified by an URL auto content = get("dlang.org"); } It compiled ok, but I get error after running exe file: object.Error@(0): Access Violation

Re: Socket - handling large numbers of incoming connections

2015-12-22 Thread Johannes Pfau via Digitalmars-d-learn
Am Mon, 21 Dec 2015 23:29:14 + schrieb Adam D. Ruppe : > On Monday, 21 December 2015 at 23:17:45 UTC, Daniel Kozák wrote: > > If you want to reinvent the wheel you can use > > [...] it isn't like the bundled functions with the OS are > hard to use [...] >

Re: Socket - handling large numbers of incoming connections

2015-12-22 Thread Jakob Jenkov via Digitalmars-d-learn
The same as in C [1]. Just change #include to import core.sys.posix.poll; [1] http://linux.die.net/man/2/poll I have a background in Java, so I am a bit handicapped :-)

Re: How is D doing?

2015-12-22 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 03:30:32 UTC, ShinraTensei wrote: I recently noticed massive increase in new languages for a person to jump into(Nim, Rust, Go...etc) but my question is weather the D is actually used anywhere or are there chances of it dying anytime soon. So far I've tried a

Re: Socket - handling large numbers of incoming connections

2015-12-22 Thread Jakob Jenkov via Digitalmars-d-learn
Thanks, everyone, I have looked a bit at different frameworks, and it seems that libasync might have a decently narrow scope to fit what I need. I have a background in Java, so a lot of this OS-specific stuff is new to me (EPoll etc.). In Java that stuff is used under the hood for you,

Re: Set color to a single point in Cairo

2015-12-22 Thread Luis via Digitalmars-d-learn
On Sunday, 20 December 2015 at 01:17:50 UTC, Basile B. wrote: On Saturday, 19 December 2015 at 14:16:23 UTC, TheDGuy wrote: is it possible to set the color of a single pixel with Cairo? Not like you would do with a classic canvas (2d grid), because colors are applied with `cairo_fill()` and

Re: Setting native OS thread name (eg, via prctl)

2015-12-22 Thread Dejan Lekic via Digitalmars-d-learn
Arun, isn't that what the 'name' property is there for?

Re: Let dmd or ldc be easy to setup on Ubuntu

2015-12-22 Thread Rikki Cattermole via Digitalmars-d-learn
On 23/12/15 3:32 AM, FrankLike wrote: On Tuesday, 22 December 2015 at 14:11:29 UTC, Rikki Cattermole wrote: On 23/12/15 3:09 AM, FrankLike wrote: Now,we can't setup dmd or ldc like this: sudo apt-get install dmd sudo apt-get install ldc2 If I set 'The Installation Source' is : deb

Let dmd or ldc be easy to setup on Ubuntu

2015-12-22 Thread FrankLike via Digitalmars-d-learn
Now,we can't setup dmd or ldc like this: sudo apt-get install dmd sudo apt-get install ldc2 If I set 'The Installation Source' is : deb http://downloads.dlang.org/releases/2015/ main But it's error,why? Thank you.

Re: Let dmd or ldc be easy to setup on Ubuntu

2015-12-22 Thread Rikki Cattermole via Digitalmars-d-learn
On 23/12/15 3:09 AM, FrankLike wrote: Now,we can't setup dmd or ldc like this: sudo apt-get install dmd sudo apt-get install ldc2 If I set 'The Installation Source' is : deb http://downloads.dlang.org/releases/2015/ main But it's error,why? Thank you. dlang.org does not host a apt

Re: Let dmd or ldc be easy to setup on Ubuntu

2015-12-22 Thread FrankLike via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 14:11:29 UTC, Rikki Cattermole wrote: On 23/12/15 3:09 AM, FrankLike wrote: Now,we can't setup dmd or ldc like this: sudo apt-get install dmd sudo apt-get install ldc2 If I set 'The Installation Source' is : deb http://downloads.dlang.org/releases/2015/ main

Most performant way of converting int to string

2015-12-22 Thread Andrew Chapman via Digitalmars-d-learn
Sorry if this is a silly question but is the to! method from the conv library the most efficient way of converting an integer value to a string? e.g. string s = to!string(100); I'm seeing a pretty dramatic slow down in my code when I use a conversion like this (when looped over 10 million

Re: Most performant way of converting int to string

2015-12-22 Thread cym13 via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew Chapman wrote: Sorry if this is a silly question but is the to! method from the conv library the most efficient way of converting an integer value to a string? e.g. string s = to!string(100); I'm seeing a pretty dramatic slow down in my

Re: Let dmd or ldc be easy to setup on Ubuntu

2015-12-22 Thread Jordi Sayol via Digitalmars-d-learn
El 22/12/15 a les 16:38, FrankLike via Digitalmars-d-learn ha escrit: > sudo apt-get install dmd ← it's error. dmd_2.069.2-0-amd64.deb from http://downloads.dlang.org/ is an all-in-one deb package, containing all the tools and libraries for each release. "d-lang" splits it in few deb packages:

Re: Most performant way of converting int to string

2015-12-22 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Dec 22, 2015 at 05:23:11PM +, Andrew Chapman via Digitalmars-d-learn wrote: [...] > for({int i; i = 0;} i < num; i++) { > //string s = to!string(i); > Customer c = Customer(i, "Customer", "", i * 2); > string result =

Re: Most performant way of converting int to string

2015-12-22 Thread Andrew Chapman via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 17:18:16 UTC, cym13 wrote: On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew Chapman wrote: Sorry if this is a silly question but is the to! method from the conv library the most efficient way of converting an integer value to a string? e.g. string s =

Re: How is D doing?

2015-12-22 Thread Jakob Jenkov via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 03:30:32 UTC, ShinraTensei wrote: I recently noticed massive increase in new languages for a person to jump into(Nim, Rust, Go...etc) but my question is weather the D is actually used anywhere or are there chances of it dying anytime soon. Check out Google

Re: Lots of D code

2015-12-22 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 00:59:53 UTC, steven kladitis wrote: I have 843 programs written in D. [...] All of the programs are from RosettaCode.org. The script to compile them generates a log file and you will see a few that the linker just stops No idea why. A few have 64K link

Re: Most performant way of converting int to string

2015-12-22 Thread cym13 via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 17:52:52 UTC, Andrew Chapman wrote: On Tuesday, 22 December 2015 at 17:43:00 UTC, H. S. Teoh wrote: I wonder if the slowdown is caused by GC collection cycles (because calling to!string will allocate, and here you're making a very large number of small

Re: Most performant way of converting int to string

2015-12-22 Thread rumbu via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 19:45:46 UTC, Daniel Kozák wrote: V Tue, 22 Dec 2015 18:11:24 + rumbu via Digitalmars-d-learn napsáno: On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew Chapman wrote: > Sorry if this is a silly question but is the