Re: alias overloading strange error

2015-07-31 Thread simendsjo via Digitalmars-d-learn
On Friday, 31 July 2015 at 10:56:33 UTC, vitus wrote: //Why expression 'foobar(1);' doesn't work? void foo()(){} void bar(int){} alias foobar = foo; alias foobar = bar; void main(){ .foobar(1); //OK foobar(1); //Error: overload alias 'foo' is not a var

No Unix socket support?

2015-07-29 Thread simendsjo via Digitalmars-d-learn
Is there no Unix socket support in Phobos? Or vibe? Or any other library? I've found some discussions: * https://issues.dlang.org/show_bug.cgi?id=9384 * http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/10870/ , but it seems there are no support yet.

Re: GC stats

2015-07-26 Thread simendsjo via Digitalmars-d-learn
On Sunday, 26 July 2015 at 14:16:46 UTC, Gary Willoughby wrote: On Saturday, 25 July 2015 at 17:43:44 UTC, Martin Nowak wrote: On Saturday, 25 July 2015 at 17:34:26 UTC, Márcio Martins wrote: What I want is a clean non-intrusive way to log when a collection happened, how long my threads were st

Why hide a trusted function as safe?

2015-07-26 Thread simendsjo via Digitalmars-d-learn
Is there a reason why you would hide the fact that a function is trusted rather than safe? Technically it doesn't matter, right? To me, it seems like this would give wrong assumptions to the caller. The reason I ask is because I found the following in std.concurrency: @property Tid this

Re: File.tmpfile() cannot be used as a pipe?

2014-08-24 Thread simendsjo via Digitalmars-d-learn
On 08/24/2014 09:03 PM, simendsjo wrote: > I don't know the arguments for my process before reading some of stdin. > I was thinking I could solve this by creating a temporary file as a > "stdin buffer" while I found out the correct argument and could launch > the process

File.tmpfile() cannot be used as a pipe?

2014-08-24 Thread simendsjo via Digitalmars-d-learn
I don't know the arguments for my process before reading some of stdin. I was thinking I could solve this by creating a temporary file as a "stdin buffer" while I found out the correct argument and could launch the process. Unfortunately, this fails. Error: 'object.Exception@std/stdio.d(2070): Enf

Re: std.stdio.tmpfile() return shared(_IO_FILE)* and not File

2014-08-24 Thread simendsjo via Digitalmars-d-learn
On 08/24/2014 08:09 PM, anonymous wrote: > On Sunday, 24 August 2014 at 17:55:05 UTC, simendsjo wrote: >> Using DMD 2.066 on GNU/Linux x86_64. >> >> This is strange: >> >> import std.stdio; >> void main() { >> auto f = tmpfile(); >

Re: std.stdio.tmpfile() return shared(_IO_FILE)* and not File

2014-08-24 Thread simendsjo via Digitalmars-d-learn
On 08/24/2014 07:56 PM, simendsjo wrote: > Using DMD 2.066 on GNU/Linux x86_64. > > This is strange: > > import std.stdio; > void main() { > auto f = tmpfile(); > pragma(msg, typeof(f)); // shared(_IO_FILE)* > } > > But stdio.d looks like the following:

std.stdio.tmpfile() return shared(_IO_FILE)* and not File

2014-08-24 Thread simendsjo via Digitalmars-d-learn
Using DMD 2.066 on GNU/Linux x86_64. This is strange: import std.stdio; void main() { auto f = tmpfile(); pragma(msg, typeof(f)); // shared(_IO_FILE)* } But stdio.d looks like the following: static File tmpfile() @safe What is going on here?

Re: safe pure unittest

2014-08-13 Thread simendsjo via Digitalmars-d-learn
On 08/13/2014 02:50 PM, Dicebot wrote: > On Wednesday, 13 August 2014 at 12:26:02 UTC, simendsjo wrote: >> This is the first time I've seen attributes on unittests: >> https://github.com/D-Programming-Language/phobos/pull/2349/files#diff-ba05e420ac1da65db044e79304d641b6R1

safe pure unittest

2014-08-13 Thread simendsjo via Digitalmars-d-learn
This is the first time I've seen attributes on unittests: https://github.com/D-Programming-Language/phobos/pull/2349/files#diff-ba05e420ac1da65db044e79304d641b6R179 Has this always been supported? I guess it's good practice to add these on unittests too, but does people even know about this featur

Re: Best practices for testing functions that opens files

2014-08-06 Thread simendsjo via Digitalmars-d-learn
On 08/06/2014 01:22 AM, splatterdash wrote: > Hi all, > > Is there a recommended way to test functions that opens and iterates > over files? The unittest block seems more suited for testing functions > whose input and output can be defined in the program itself. I'm > wondering if there is a bette

Re: monodevelop mono-d versions

2014-08-01 Thread simendsjo via Digitalmars-d-learn
On 08/01/2014 03:15 PM, Dicebot wrote: > (...) or use /opt/ bundle by simendsjo By Alexander Bothe. The files are just hosted at my domain.

Re: Using enum constant from different modules

2014-07-10 Thread simendsjo via Digitalmars-d-learn
On 07/11/2014 01:08 AM, sigod wrote: > On Thursday, 10 July 2014 at 20:59:17 UTC, simendsjo wrote: >> Strings behaves a bit odd with is(). The following passes: >> >> import std.stdio; >> void f(string a, string b) { >> assert(a is b); // also true >> } &

Re: Using enum constant from different modules

2014-07-10 Thread simendsjo via Digitalmars-d-learn
On 07/10/2014 10:47 PM, "Marc Schütz" " wrote: > On Thursday, 10 July 2014 at 20:27:39 UTC, Jacob Carlborg wrote: >> Here's a code example: >> >> module main; >> >> import foo; >> >> enum Get = "GET"; >> >> void bar (string a) >> { >> assert(a is Get); >> } >> >> void main () >> { >> asd();

Re: Insert a char in string

2014-07-10 Thread simendsjo via Digitalmars-d-learn
ma ), we use > comma to separate the cents, here in Brazil... > > On Thursday, 10 July 2014 at 19:33:15 UTC, simendsjo wrote: >> On 07/10/2014 06:05 PM, Alexandre wrote: >>> I have a string X and I need to insert a char in that string... >>> >>> auto X =

Re: Insert a char in string

2014-07-10 Thread simendsjo via Digitalmars-d-learn
On 07/10/2014 06:05 PM, Alexandre wrote: > I have a string X and I need to insert a char in that string... > > auto X = "100"; > > And I need to inser a ',' in position 3 of this string..., I try to use > the array.insertInPlace, but, not work... > > I try this: > auto X = "1

Re: Concatenates int

2014-07-10 Thread simendsjo via Digitalmars-d-learn
On 07/10/2014 02:22 PM, Rikki Cattermole wrote: > On 11/07/2014 12:11 a.m., Sean Campbell wrote: >> i have the ints 4, 7, 0 and 1 how can i Concatenate them into four >> thousand seven hundred and one. > > If we talking at compile time definition: > > int myint = 4_7_0_1; > > Would work. > Howev

Re: rehabilitating Juno

2014-06-21 Thread simendsjo via Digitalmars-d-learn
On 06/21/2014 06:40 AM, Jesse Phillips wrote: > On Thursday, 19 June 2014 at 15:24:41 UTC, Jesse Phillips wrote: >> Once I get some examples compiling again in 32bit, it should be easier >> for you to play around with COM in D. > > I've pushed changes which get the library building and examples wo

Re: Basics of calling C from D

2014-06-11 Thread simendsjo via Digitalmars-d-learn
On 06/11/2014 04:22 PM, Adam D. Ruppe wrote: > On Wednesday, 11 June 2014 at 14:11:04 UTC, simendsjo wrote: >> I believe the correct answer should be "Buy my book!". > > ah, of course! I should just make a .sig file lol > > http://www.packtpub.com/discover-advantag

Re: Basics of calling C from D

2014-06-11 Thread simendsjo via Digitalmars-d-learn
On 06/11/2014 03:54 PM, Adam D. Ruppe wrote: > On Wednesday, 11 June 2014 at 13:52:09 UTC, belkin wrote: >> Question: How do I use it from D? > > Write the prototype in your D file with extern(C): > extern(C) int factorial(int n); > > then just call the function normally in D. Make sure you inclu

Re: Separate Piping of dmd stdout and stderr through ddemangle

2014-05-22 Thread simendsjo via Digitalmars-d-learn
On 05/22/2014 11:29 AM, "Nordlöw" wrote: > Is there a Bash way to pipe stdout and stderr *separately* through > ddemangle? > > I'm aware of > > 2>&1 > > but this removes separation of stdout and stderr. 2>&1 means "redirect file handle 2 to the same as file handle 1". So it will redirect st

Re: How to find documentation of hard-to-google keywords and symbols

2014-04-03 Thread simendsjo
On 04/03/2014 06:50 PM, dnspies wrote: On Thursday, 3 April 2014 at 16:39:02 UTC, simendsjo wrote: On 04/03/2014 06:31 PM, dnspies wrote: On Thursday, 3 April 2014 at 16:10:45 UTC, bearophile wrote: dnspies: I still don't know where to find documentation for "is" (which I ju

Re: How to find documentation of hard-to-google keywords and symbols

2014-04-03 Thread simendsjo
On 04/03/2014 06:31 PM, dnspies wrote: On Thursday, 3 April 2014 at 16:10:45 UTC, bearophile wrote: dnspies: I still don't know where to find documentation for "is" (which I just found out in another forum post is overloaded for dynamic arrays). Can users overload the meaning of "is" themselve

Re: Do equality checks for dynamic arrays attempt to shortcut with pointer comparison

2014-04-03 Thread simendsjo
On 04/03/2014 09:23 AM, dnspies wrote: On Thursday, 3 April 2014 at 07:16:53 UTC, simendsjo wrote: On 04/03/2014 09:03 AM, dnspies wrote: If two dynamic arrays point to the same place in memory, is it fast to compare them for equality? or does every element still have to be compared? Equals

Re: Do equality checks for dynamic arrays attempt to shortcut with pointer comparison

2014-04-03 Thread simendsjo
On 04/03/2014 09:03 AM, dnspies wrote: If two dynamic arrays point to the same place in memory, is it fast to compare them for equality? or does every element still have to be compared? Equals will first check for memory location. This is from the runtime: bool opEquals(Object lhs, Object rhs)

Re: reflection over templates

2014-03-19 Thread simendsjo
On 03/19/2014 05:34 PM, Adam D. Ruppe wrote: On Wednesday, 19 March 2014 at 16:10:52 UTC, Dicebot wrote: Wait just a bit more https://github.com/D-Programming-Language/dmd/pull/3380 :) megarox. Make it so. Nice. I have some ugly hacks that's probably full of bugs for this (look at the botto

Re: getopt example please

2014-02-26 Thread simendsjo
On 02/26/2014 11:06 AM, Tobias Pankrath wrote: On Wednesday, 26 February 2014 at 09:57:19 UTC, Andrew Edwards wrote: Request a small example of how to use getopt to accomplish the following: [1] program subcommand //process subcommand with default arguments if any [2] program -h subcommand //ou

Re: Non-Initialized Dynamic Arrays Construction

2014-02-24 Thread simendsjo
On 02/24/2014 01:08 PM, "Nordlöw" wrote: On Monday, 24 February 2014 at 11:29:39 UTC, bearophile wrote: TheFlyingFiddle: http://dlang.org/phobos/std_array.html#.uninitializedArray is what you want. Wouldn't it be nice to have some kind of syntactic sugar for this similar to what we have for

Re: hiding a class property behind a method

2014-02-22 Thread simendsjo
On 02/22/2014 11:33 PM, Francesco Cattoglio wrote: On Saturday, 22 February 2014 at 17:21:50 UTC, luka8088 wrote: It seems to me that the following code should be illegal, but I am uncertain of it so I am posting here for a confirmation before I post it on bug tracker: [snip] Nice find. I gues

Re: hiding a class property behind a method

2014-02-22 Thread simendsjo
On 02/22/2014 09:43 PM, Ali Çehreli wrote: It looks like name hiding, which I am familiar from C++. Name hiding does not differentiate between functions and variables. Ali The problem is that hiding a name *is* a problem. When you are hiding a name, then a class would no longer behave as yo

Re: hiding a class property behind a method

2014-02-22 Thread simendsjo
On 02/22/2014 06:21 PM, luka8088 wrote: import std.stdio; class A { string x () { return "A"; }; } class B : A { override string x () { return "B"; }; } class C : A { string x = "C"; // should this be illegal? } void main () { A o1 = new B(); writeln(o1.x); // B A o2 = new

Re: [video tutorial] Defensive programming with Design By Contract basics

2014-02-21 Thread simendsjo
On Friday, 21 February 2014 at 09:46:20 UTC, Mengu wrote: On Thursday, 20 February 2014 at 10:28:45 UTC, simendsjo wrote: http://youtu.be/wFqHTCBt72M enjoyed it, thanks! what are you going to talk about next? I only have a rough outline in my head that will probably change as I go

Re: [video tutorial] Defensive programming with Design By Contract basics

2014-02-20 Thread simendsjo
On Thursday, 20 February 2014 at 14:32:40 UTC, Craig Dillabaugh wrote: On Thursday, 20 February 2014 at 10:28:45 UTC, simendsjo wrote: http://youtu.be/wFqHTCBt72M Thanks for posting these. They are well done. What text editor are you using, emacs? Vim with dcd and syntastic for some D

[video tutorial] Defensive programming with Design By Contract basics

2014-02-20 Thread simendsjo
http://youtu.be/wFqHTCBt72M

Re: DMD exit code -9

2014-02-20 Thread simendsjo
On Wednesday, 19 February 2014 at 22:15:47 UTC, Craig Dillabaugh wrote: (...) I just realized that I tried to build this on my Linode, where DMD tends to choke and die with anything Vibe-d related (basic Linodes have very little RAM). To many terminals open! Same code/build config work fine

Re: [video tutorial] Cleaning up our command line argument parsing code

2014-02-19 Thread simendsjo
On Wednesday, 19 February 2014 at 21:55:35 UTC, Brad Anderson wrote: On Wednesday, 19 February 2014 at 14:46:57 UTC, simendsjo wrote: Spam spam http://youtu.be/ZRUcTJC0D7M Good stuff. Are you going to upload the older videos to this same channel? Is that necessary? The playlist includes

[video tutorial] Cleaning up our command line argument parsing code

2014-02-19 Thread simendsjo
Spam spam http://youtu.be/ZRUcTJC0D7M

[video tutorial] Command line arguments with std.getopt

2014-02-19 Thread simendsjo
http://youtu.be/mNQqtauO9IM The entire playlist: http://www.youtube.com/playlist?list=PLqABwcsDQUo59iBOM5DFtqbwrMhL4PWcQ I wont be maintaining the old channel anymore. New videos are uploaded here: http://www.youtube.com/channel/UCz3NlrGpjV9NlJAhKJLu_-w

Re: How to resume iteration from previous point in associative array

2014-02-19 Thread simendsjo
On Wednesday, 19 February 2014 at 09:21:48 UTC, Tarman wrote: Hi, We're doing some "super computing" "big data" style stuff with D. We have a system where we're comparing associative arrays with billions of entries. However in this system we need to fairly consider possible solutions for ma

Re: What learning resources are available?

2014-02-18 Thread simendsjo
On Tuesday, 18 February 2014 at 19:17:55 UTC, Mark Isaacson wrote: Hi everyone - I'm a D newbie with a very strong C++ background looking to get started. I've read "The D Programming Language" a couple of times now, but I've heard rumblings at several points in time from several people that som

Re: [video tutorial] Refactoring the number guessing game

2014-02-18 Thread simendsjo
On Tuesday, 18 February 2014 at 14:51:28 UTC, Rikki Cattermole wrote: On Tuesday, 18 February 2014 at 14:48:53 UTC, simendsjo wrote: Not sure I'm able to connect.. When pressing the link, it turns up for my G+ user. If I log in as the YouTube user and go to that link, I still turn up as

Re: [video tutorial] Refactoring the number guessing game

2014-02-18 Thread simendsjo
On Tuesday, 18 February 2014 at 14:42:22 UTC, Rikki Cattermole wrote: On Tuesday, 18 February 2014 at 14:36:17 UTC, simendsjo wrote: I'll be more than happy to place the videos elsewhere, but I don't want to commit to a large ongoing project as I'm pretty busy with school too

Re: [video tutorial] Refactoring the number guessing game

2014-02-18 Thread simendsjo
On Tuesday, 18 February 2014 at 14:36:17 UTC, simendsjo wrote: On Tuesday, 18 February 2014 at 14:27:19 UTC, Rikki Cattermole wrote: On Tuesday, 18 February 2014 at 14:25:33 UTC, simendsjo wrote: On Tuesday, 18 February 2014 at 14:20:44 UTC, Rikki Cattermole wrote: On Tuesday, 18 February 2014

Re: [video tutorial] Refactoring the number guessing game

2014-02-18 Thread simendsjo
On Tuesday, 18 February 2014 at 14:27:19 UTC, Rikki Cattermole wrote: On Tuesday, 18 February 2014 at 14:25:33 UTC, simendsjo wrote: On Tuesday, 18 February 2014 at 14:20:44 UTC, Rikki Cattermole wrote: On Tuesday, 18 February 2014 at 14:19:47 UTC, simendsjo wrote: On Tuesday, 18 February 2014

Re: [video tutorial] Refactoring the number guessing game

2014-02-18 Thread simendsjo
On Tuesday, 18 February 2014 at 14:20:44 UTC, Rikki Cattermole wrote: On Tuesday, 18 February 2014 at 14:19:47 UTC, simendsjo wrote: On Tuesday, 18 February 2014 at 14:16:27 UTC, Rikki Cattermole wrote: On Tuesday, 18 February 2014 at 13:00:09 UTC, simendsjo wrote: http://youtu.be/yhK7zvnWmiU

Re: [video tutorial] Implementing a simple number guessing game

2014-02-18 Thread simendsjo
On Tuesday, 18 February 2014 at 14:04:50 UTC, John Colvin wrote: On Tuesday, 18 February 2014 at 13:47:22 UTC, simendsjo wrote: On Tuesday, 18 February 2014 at 13:46:11 UTC, simendsjo wrote: On Tuesday, 18 February 2014 at 13:39:38 UTC, John Colvin wrote: On Tuesday, 18 February 2014 at 07:19

Re: [video tutorial] Refactoring the number guessing game

2014-02-18 Thread simendsjo
On Tuesday, 18 February 2014 at 14:16:27 UTC, Rikki Cattermole wrote: On Tuesday, 18 February 2014 at 13:00:09 UTC, simendsjo wrote: http://youtu.be/yhK7zvnWmiU Would you be interested in doing a Lets make series on ApplyYourDLang? As this falls under this heading. Combining efforts is

Re: [video tutorial] Implementing a simple number guessing game

2014-02-18 Thread simendsjo
On Tuesday, 18 February 2014 at 13:46:11 UTC, simendsjo wrote: On Tuesday, 18 February 2014 at 13:39:38 UTC, John Colvin wrote: On Tuesday, 18 February 2014 at 07:19:05 UTC, simendsjo wrote: On Tuesday, 18 February 2014 at 07:06:11 UTC, Suliman wrote: On Monday, 17 February 2014 at 13:35:34

Re: [video tutorial] Implementing a simple number guessing game

2014-02-18 Thread simendsjo
On Tuesday, 18 February 2014 at 13:39:38 UTC, John Colvin wrote: On Tuesday, 18 February 2014 at 07:19:05 UTC, simendsjo wrote: On Tuesday, 18 February 2014 at 07:06:11 UTC, Suliman wrote: On Monday, 17 February 2014 at 13:35:34 UTC, simendsjo wrote: http://youtu.be/2Co65Ftxfdo Thanks! But

[video tutorial] Refactoring the number guessing game

2014-02-18 Thread simendsjo
http://youtu.be/yhK7zvnWmiU

Re: [video tutorial] Implementing a simple number guessing game

2014-02-17 Thread simendsjo
On Tuesday, 18 February 2014 at 07:06:11 UTC, Suliman wrote: On Monday, 17 February 2014 at 13:35:34 UTC, simendsjo wrote: http://youtu.be/2Co65Ftxfdo Thanks! But could you use bigger fonts and more contrast color scheme for better view in next videos? I'll increase the font size,

Re: foreach/iota countdown

2014-02-17 Thread simendsjo
On Monday, 17 February 2014 at 21:06:50 UTC, Timon Gehr wrote: On 02/17/2014 09:21 PM, simendsjo wrote: On Monday, 17 February 2014 at 20:03:32 UTC, Timon Gehr wrote: ... It was just to illustrate the issue more clearly. Eg. it means one and the same iota expression can sometimes iterate in

Re: foreach/iota countdown

2014-02-17 Thread simendsjo
On Monday, 17 February 2014 at 20:03:32 UTC, Timon Gehr wrote: On 02/17/2014 08:33 PM, simendsjo wrote: On Monday, 17 February 2014 at 19:30:38 UTC, Timon Gehr wrote: On 02/17/2014 08:22 PM, simendsjo wrote: Should the following two uses be a compile-time error? foreach(i; 10 .. 0) // Never

foreach/iota countdown

2014-02-17 Thread simendsjo
Should the following two uses be a compile-time error? foreach(i; 10 .. 0) // Never executes foreach(i; iota(10, 0)) // .. neither does this I would like the second to either be a compile-time error or automagically use a negative step. So we need to use a negative step in iota() or use a

Re: foreach/iota countdown

2014-02-17 Thread simendsjo
On Monday, 17 February 2014 at 19:30:38 UTC, Timon Gehr wrote: On 02/17/2014 08:22 PM, simendsjo wrote: Should the following two uses be a compile-time error? foreach(i; 10 .. 0) // Never executes foreach(i; iota(10, 0)) // .. neither does this I would like the second to either be a

Re: [video tutorial] Implementing a simple number guessing game

2014-02-17 Thread simendsjo
On Monday, 17 February 2014 at 14:00:06 UTC, Rikki Cattermole wrote: On Monday, 17 February 2014 at 13:42:28 UTC, Dicebot wrote: On Monday, 17 February 2014 at 13:35:34 UTC, simendsjo wrote: http://youtu.be/2Co65Ftxfdo Slightly OT: hm, does D have own YouTube community channel? I&#

Re: [video tutorial] Implementing a simple number guessing game

2014-02-17 Thread simendsjo
On Monday, 17 February 2014 at 13:42:28 UTC, Dicebot wrote: On Monday, 17 February 2014 at 13:35:34 UTC, simendsjo wrote: http://youtu.be/2Co65Ftxfdo Slightly OT: hm, does D have own YouTube community channel? I'd subscribe to one ;) I don't think so. The closest is Andrei Ale

[video tutorial] Implementing a simple number guessing game

2014-02-17 Thread simendsjo
http://youtu.be/2Co65Ftxfdo

Re: Timer

2014-02-17 Thread simendsjo
On Monday, 17 February 2014 at 11:20:05 UTC, Chris wrote: On Monday, 17 February 2014 at 11:11:06 UTC, simendsjo wrote: On Monday, 17 February 2014 at 11:08:16 UTC, Chris wrote: The D way of implementing a timer? I need to (automatically) execute a function that performs a clean up, say every

Re: Timer

2014-02-17 Thread simendsjo
On Monday, 17 February 2014 at 11:08:16 UTC, Chris wrote: The D way of implementing a timer? I need to (automatically) execute a function that performs a clean up, say every hour. if (file.older than 1 hour) { remove; } Vibe.d can be used for this to get an OS agnostic solution. Haven't u

Re: [video tutorial] hello world using dmd, rdmd, dub and vibe.d

2014-02-16 Thread simendsjo
On Sunday, 16 February 2014 at 22:57:44 UTC, Brad Anderson wrote: (...) Nicely done. It's a bit quiet (I had to max out my volume and put on headphones to hear). Thanks. I'll crank up the volume for the next one.

Re: [video tutorial] hello world using dmd, rdmd, dub and vibe.d

2014-02-15 Thread simendsjo
On Saturday, 15 February 2014 at 15:39:51 UTC, Stanislav Blinov wrote: On Saturday, 15 February 2014 at 13:28:24 UTC, simendsjo wrote: http://youtu.be/8TV9ZZteYEU Concise and informative. Maybe a little rushed for total newcomers, but for people familiar with programming and wanting to

Re: [video tutorial] hello world using dmd, rdmd, dub and vibe.d

2014-02-15 Thread simendsjo
On Saturday, 15 February 2014 at 15:46:26 UTC, Rikki Cattermole wrote: On Saturday, 15 February 2014 at 13:28:24 UTC, simendsjo wrote: http://youtu.be/8TV9ZZteYEU The content wasn't planned, and English is not my native tongue. Hopefully it can still be useful for newbies. This is p

Re: [video tutorial] hello world using dmd, rdmd, dub and vibe.d

2014-02-15 Thread simendsjo
On Saturday, 15 February 2014 at 15:33:55 UTC, Jakob Lundberg wrote: Nice video! It was very good. Is there any chance that you would be willing to share your Vim configuration? In particular the integration with DCD. let g:dcd_importPath=['/home/simendsjo/.dub/packages/vibe-d-master/s

Re: [video tutorial] hello world using dmd, rdmd, dub and vibe.d

2014-02-15 Thread simendsjo
On Saturday, 15 February 2014 at 15:35:41 UTC, simendsjo wrote: On Saturday, 15 February 2014 at 15:33:55 UTC, Jakob Lundberg wrote: Nice video! It was very good. Is there any chance that you would be willing to share your Vim configuration? In particular the integration with DCD. let

[video tutorial] hello world using dmd, rdmd, dub and vibe.d

2014-02-15 Thread simendsjo
http://youtu.be/8TV9ZZteYEU The content wasn't planned, and English is not my native tongue. Hopefully it can still be useful for newbies. This is pretty much a response to a recent discussion on the lack of documentation/tutorials: http://forum.dlang.org/post/spdddifmaacihlcum...@forum.dlang.

Re: Higher Order Type Tuple Predicate

2014-02-13 Thread simendsjo
On Thursday, 13 February 2014 at 11:25:09 UTC, Nordlöw wrote: Is there some trait in Phobos to check if each element of a type tuple fulfil a type predicate? I want this in a variadic function limiter to assert that all its arguments function fulfils a predicate. Something like: void f(T...

Re: Thrift maintained..?

2014-02-11 Thread simendsjo
On Wednesday, 12 February 2014 at 02:27:51 UTC, David Eagen wrote: On Wednesday, 25 December 2013 at 17:14:17 UTC, David Eagen wrote: I've filed a bug: https://issues.apache.org/jira/browse/THRIFT-2294 So the Thrift guys are not too excited about fixing this. The bug was closed since it affec

Re: Array as an argument, ambiguous behaviour.

2014-01-29 Thread simendsjo
On Wednesday, 29 January 2014 at 13:15:30 UTC, Cooler wrote: On Wednesday, 29 January 2014 at 12:40:00 UTC, Tobias Pankrath wrote: On Wednesday, 29 January 2014 at 11:46:23 UTC, Cooler wrote: Thank you for detailed explanation. But the question is - "Is that correct that language allows ambiguo

Re: Array as an argument, ambiguous behaviour.

2014-01-29 Thread simendsjo
On Wednesday, 29 January 2014 at 11:46:23 UTC, Cooler wrote: Thank you for detailed explanation. But the question is - "Is that correct that language allows ambiguous behavior?" Could you expand your example? fun(int[] a) {} is passing a by value, that is, the pointer and length is copied ove

Re: Keywords: How to trick the compiler?

2014-01-28 Thread simendsjo
On Tuesday, 28 January 2014 at 12:25:19 UTC, Namespace wrote: On Tuesday, 28 January 2014 at 11:22:10 UTC, Chris wrote: Is there a simple way to trick the compiler (e.g. with alias), if a keyword conflicts with a function/method, e.g. as in a HTML document: auto docBody = document.body; // c

Re: How to skip permission denied exceptions if iterate through directories?

2014-01-25 Thread simendsjo
On Friday, 24 January 2014 at 23:46:04 UTC, Clas Onnebrink wrote: (...) I want work through a directory on my linux server but there are some directories I have no permissions to access so I get following: ~/Projects/cltools/smdups $ source/smdups -r -p=/media/clas/Elements2 -e=*.* std.file.

Re: Circular Buffer

2013-12-21 Thread simendsjo
Modifying it to use a static array shouldn't be too difficult, but you're probably better off using some of the others code as this is dynamic and haven't been used in production. https://gist.github.com/simendsjo/3b8a9c60bd92e16691d7

Re: D game engine -- Any suggestions?

2013-11-20 Thread simendsjo
On Wednesday, 20 November 2013 at 07:48:21 UTC, Mineko wrote: (...) ..That and if I'm using the GPL right. >_>" Do you really plan on using 677 lines per file on the license header..?

Red-Black tree storing color without additional memory requirements

2013-11-20 Thread simendsjo
Wikipedia states that the color bit can be stored without taking additional space: "In many cases the additional bit of information can be stored at no additional memory cost." Looking at the Phobos implementation, it stores it as a regular byte: https://github.com/D-Programming-Language/phob

Thrift maintained..?

2013-11-15 Thread simendsjo
I thrid compiling thrift 0.9.1 from github with d support, but there's a bug in the makefile it seems. $(addprefix.log: $(addprefix @p='$(addprefix'; \ b='$(addprefix'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs

Re: balancedParens is not nothrow bug, is this known?

2013-11-08 Thread simendsjo
On Friday, 8 November 2013 at 14:07:38 UTC, Gary Willoughby wrote: import std.path; void main(string[] args) { globMatch("foo.bar", "*"); } compile with: dmd -profile test.d Error: /usr/share/dmd/src/phobos/std/path.d(2187): Error: balancedParens is not nothrow /usr/share/dmd/src/pho

Re: Limiting template functions to template instantiations of a struct

2013-11-07 Thread simendsjo
On Thursday, 7 November 2013 at 15:46:53 UTC, Marco Leise wrote: Am Wed, 06 Nov 2013 14:22:13 +0100 schrieb "simendsjo" : template isFoo(T) { static if(is(T:Foo!U, int U)) enum isFoo = true; else enum isFoo = false; } enum isF

Re: Limiting template functions to template instantiations of a struct

2013-11-06 Thread simendsjo
On Wednesday, 6 November 2013 at 13:00:17 UTC, Atila Neves wrote: The title isn't very clear but I wasn't sure how to phrase it without code. Basically what I want to do is this (won't compile): struct Foo(int N) { } void func(T)(T obj) if(is(T:Foo)) { } void func(T)(T obj) if(!is(T:Foo)) {

Re: How to iterate using foreach on a class?

2013-11-01 Thread simendsjo
On Friday, 1 November 2013 at 11:41:52 UTC, Jonathan M Davis wrote: On Friday, November 01, 2013 12:30:10 Gary Willoughby wrote: I have a class which contains an array as a core collection of data. I want to pass an instance of this class to a foreach loop and iterate through the enclosed arra

Re: How to iterate using foreach on a class?

2013-11-01 Thread simendsjo
On Friday, 1 November 2013 at 11:30:12 UTC, Gary Willoughby wrote: I have a class which contains an array as a core collection of data. I want to pass an instance of this class to a foreach loop and iterate through the enclosed array. How do i do this? I've asked this before and got an answer b

Re: selectively running unittest functions

2013-10-25 Thread simendsjo
On Friday, 25 October 2013 at 14:14:39 UTC, Dicebot wrote: This will work starting with 2.064: module a; import std.stdio; struct ID { string data; } @ID("one") unittest { writeln("1"); } @ID("two") unittest { writeln("2"); } void main() { import std.typetuple; alias tes

Re: Sql -> Any tuto ?

2013-10-25 Thread simendsjo
t be more performant. https://github.com/simendsjo/mysqln/blob/master/source/mysql/protocol/packets.d#L782

Re: running a command in a directory using std.process

2013-10-24 Thread simendsjo
On Thursday, 24 October 2013 at 06:25:40 UTC, Benjamin Thaut wrote: As far as I can tell std.process can only run commands in the working directory of the currently executing function. I want to execute a certain program inside a subdirectory on windows and can't get it to work: myproject |-

Re: Allow illegal code in enum initialization?

2013-10-23 Thread simendsjo
On Wednesday, 23 October 2013 at 16:27:47 UTC, Ali Çehreli wrote: On 10/23/2013 02:55 AM, simendsjo wrote: Illegal code is accepted in static if, but not in enum declarations. This leads to having three lines when one is enough. Is this just an oversight, or by design? template T(alias A

Allow illegal code in enum initialization?

2013-10-23 Thread simendsjo
Illegal code is accepted in static if, but not in enum declarations. This leads to having three lines when one is enough. Is this just an oversight, or by design? template T(alias A) { enum T = true; } void main() { struct S { } static if(__traits(compiles, S.a) && T!(S.a)) // ok

Re: Templates with alias param instantiated with null cached by DMD..?

2013-10-23 Thread simendsjo
On Wednesday, 23 October 2013 at 08:11:59 UTC, Kenji Hara wrote: On Wednesday, 23 October 2013 at 07:22:56 UTC, simendsjo wrote: I've stumbled upon a strange bug, and I'm not sure what I should write in the bug report. Could someone explain what's going on here or file

Templates with alias param instantiated with null cached by DMD..?

2013-10-23 Thread simendsjo
I've stumbled upon a strange bug, and I'm not sure what I should write in the bug report. Could someone explain what's going on here or file the bug for me? template A(alias T) { alias A = T; } void main() { struct S1 { S1* p; } static assert(is(typeof(A!(S1.init.p)) == S1*)); // o

Re: Cannot alias expression

2013-10-21 Thread simendsjo
On Monday, 21 October 2013 at 16:51:02 UTC, simendsjo wrote: On Monday, 21 October 2013 at 15:00:26 UTC, Dicebot wrote: On Monday, 21 October 2013 at 12:58:55 UTC, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template

Re: Cannot alias expression

2013-10-21 Thread simendsjo
On Monday, 21 October 2013 at 16:51:02 UTC, simendsjo wrote: On Monday, 21 October 2013 at 15:00:26 UTC, Dicebot wrote: On Monday, 21 October 2013 at 12:58:55 UTC, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template

Re: Cannot alias expression

2013-10-21 Thread simendsjo
On Monday, 21 October 2013 at 18:42:27 UTC, John Colvin wrote: On Monday, 21 October 2013 at 12:58:55 UTC, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template B(alias A) { alias B = A; } template C(A ...) { alias C

Re: Cannot alias expression

2013-10-21 Thread simendsjo
On Monday, 21 October 2013 at 15:00:26 UTC, Dicebot wrote: On Monday, 21 October 2013 at 12:58:55 UTC, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template B(alias A) { alias B = A; } template C(A ...) { alias C = A

Collections

2013-10-19 Thread simendsjo
Last I heard, collection design was delayed while waiting for the allocator design. But I guess there are plenty of collection implementations already. So where are they? o Phobos: std.container - RedBlackTree, BinaryHeap, Array, SList, DList o DCollections: Not updated in 4 years - dead? o

Re: Error: cannot call public/export function someFunction from invariant

2013-10-18 Thread simendsjo
On Friday, 18 October 2013 at 09:08:53 UTC, Jonathan M Davis wrote: On Friday, October 18, 2013 11:04:25 bearophile wrote: simendsjo: > See topic. Why is this not allowed? The function in question > is > not virtual. > > struct S { > > void someFunction() const {}

Re: Warnings/What should I know?

2013-10-18 Thread simendsjo
On Friday, 18 October 2013 at 06:13:38 UTC, DDD wrote: I'm learning D. I'm curious about surprises I may get. I typically use C++, C# and javascript Some stuff from the top of my head. Remember that you're asking for gotchas and surprises rather than the nice features of D :) * D has built-i

Error: cannot call public/export function someFunction from invariant

2013-10-18 Thread simendsjo
See topic. Why is this not allowed? The function in question is not virtual. struct S { void someFunction() const {} const invariant() { someFunction(); } } void main() { S s; }

Re: Warnings/What should I know?

2013-10-18 Thread simendsjo
On Friday, 18 October 2013 at 06:56:49 UTC, monarch_dodra wrote: (...) struct S { this(int i = 5) {} } S s = S(); //Does *not* call the constructor with the value 5. I didn't know that. In that case, I think struct ctors with only optional parameters should be illegal - how is it possi

Re: Starting D with a project in mind.

2013-10-16 Thread simendsjo
On Wednesday, 16 October 2013 at 19:18:53 UTC, Andrew wrote: I'm a very happy man ! Everything is built and working including dub and the http_server example from vibe.d. It's slow to build, but it executes quickly and strips down to about 3MB which is heavy but tolerable. Thanks to everybod

Re: How to check for instantiation of specific template?

2013-10-10 Thread simendsjo
On Thursday, 10 October 2013 at 17:24:37 UTC, H. S. Teoh wrote: I have a template used for storing compile-time values: template Def(int x, string y) { alias impl = TypeTuple!(x,y); } How do I define a template isDef that, given some template alias A, evaluates

  1   2   3   4   5   6   7   >