Re: Is it possible to store properties via opDispatch using tuples?

2014-01-16 Thread Jacob Carlborg
On 2014-01-16 23:31, bearophile wrote: A Variant needs to keep the type of the value you have stored in, look at the Variant documentation. (But the usual limitations of a ahead-of-time compiled statically typed language apply.) A Varian won't work, since it only stores a TypeInfo, not the sta

Re: std.prelude vs core library

2014-01-16 Thread Kagamin
Initially druntime was a part of phobos, and tango was an alternative implementation of standard library, and you couldn't use phobos and tango in one application, that's why druntime was extracted as common base library for tango and phobos.

Re: errors with filesystem operations

2014-01-16 Thread Kagamin
Does it fail for that one directory only or for any directory?

Re: std.prelude vs core library

2014-01-16 Thread Rikki Cattermole
On Thursday, 16 January 2014 at 19:54:45 UTC, Ross Hays wrote: I was reading about Rust and one thing that caught my attention as interesting was the inclusion of std::prelude in the beginning of every package. I was curious what the advantage of this were versus having things declared in objec

Re: chaining immutable methods vs functions

2014-01-16 Thread Ola Fosheim Grøstad
On Friday, 17 January 2014 at 01:49:24 UTC, Ola Fosheim Grøstad wrote: pure immutable fbool and(immutable fbool b){return b.data < Nevermind, I figured this out. immutable(fbool), not immutable fbool...

chaining immutable methods vs functions

2014-01-16 Thread Ola Fosheim Grøstad
Why do I get the error message: Error: immutable method fbool.fbool.and is not callable using a mutable object when chaining methods? It works fine using regular function calls? struct fbool { ubyte data; pure immutable fbool and(immutable fbool b){return b.data < data ? b : this;} pur

Re: What is difference between std.signal and events?

2014-01-16 Thread Orvid King
On Thu, 16 Jan 2014 13:43:39 -0600, Uranuz wrote: I have read some posts about new std.signal implementation. The last was this review thread: http://forum.dlang.org/thread/ujlhznaphepibgtpc...@forum.dlang.org. What I still can't understand what is difference between signals and events i

Re: Is it possible to store properties via opDispatch using tuples?

2014-01-16 Thread Gary Willoughby
On Thursday, 16 January 2014 at 22:31:01 UTC, bearophile wrote: Gary Willoughby: Yes exactly but i would like to preserve the types of differently typed properties so i can cast them back on retrieval. A Variant needs to keep the type of the value you have stored in, look at the Variant doc

Re: Is it possible to store properties via opDispatch using tuples?

2014-01-16 Thread bearophile
Gary Willoughby: Yes exactly but i would like to preserve the types of differently typed properties so i can cast them back on retrieval. A Variant needs to keep the type of the value you have stored in, look at the Variant documentation. (But the usual limitations of a ahead-of-time compil

Re: Get "discarded" data from std.regex.splitter (or something else?)

2014-01-16 Thread Dmitry Olshansky
17-Jan-2014 00:52, Steven Schveighoffer пишет: writeln(splitter("abc123def456", regex("[0-9]+", "g"))); outputs: ["abc", "def", ""] But what if I want the "123" and "456" tokens too? Is there a way to do that? Well these 3 pieces are _slices_ of the original input, and with a bit of calcul

Re: Is it possible to store properties via opDispatch using tuples?

2014-01-16 Thread Gary Willoughby
On Thursday, 16 January 2014 at 21:48:14 UTC, bearophile wrote: Gary Willoughby: What i would like to achieve is to dynamically assign and retrieve properties without declaring them first. Do you mean something like this? http://rosettacode.org/wiki/Add_a_variable_to_a_class_instance_at_runti

Re: Is it possible to store properties via opDispatch using tuples?

2014-01-16 Thread bearophile
Gary Willoughby: What i would like to achieve is to dynamically assign and retrieve properties without declaring them first. Do you mean something like this? http://rosettacode.org/wiki/Add_a_variable_to_a_class_instance_at_runtime#D Bye, bearophile

Get "discarded" data from std.regex.splitter (or something else?)

2014-01-16 Thread Steven Schveighoffer
writeln(splitter("abc123def456", regex("[0-9]+", "g"))); outputs: ["abc", "def", ""] But what if I want the "123" and "456" tokens too? Is there a way to do that? -Steve

Is it possible to store properties via opDispatch using tuples?

2014-01-16 Thread Gary Willoughby
What i would like to achieve is to dynamically assign and retrieve properties without declaring them first. For example: class T { public this() { this.foo = "bar"; } } Ordinarily the above won't compile because 'foo' hasn't been declared but with opDispatch i can handle th

Re: Array of pointers

2014-01-16 Thread Philippe Sigaud
On Thu, Jan 16, 2014 at 10:47 AM, Rene Zwanenburg wrote: > Keep in mind that, unlike in c++, D classes are reference types: > > class Node > { > Node[] nodes; // This is valid > } > > Structs are value types though, so using a struct in the above example is > illegal. That's not true. Indeed

std.prelude vs core library

2014-01-16 Thread Ross Hays
I was reading about Rust and one thing that caught my attention as interesting was the inclusion of std::prelude in the beginning of every package. I was curious what the advantage of this were versus having things declared in object.d for what seems to be the same effect. Also after looking

What is difference between std.signal and events?

2014-01-16 Thread Uranuz
I have read some posts about new std.signal implementation. The last was this review thread: http://forum.dlang.org/thread/ujlhznaphepibgtpc...@forum.dlang.org. What I still can't understand what is difference between signals and events in languages like JavaScript, C# and Borland C++ (that ha

Re: Building D from source on Windows

2014-01-16 Thread Andrew Edwards
On 1/16/14, 2:03 PM, Dmitry Olshansky wrote: 16-Jan-2014 21:41, Andrew Edwards пишет: it would help to know when exactly this problem comes up. I guess bulding Phobos? dmd, druntime, and phobos all build properly. The problem comes up when trying to build with dmd. It could also mean tha

Re: Building D from source on Windows

2014-01-16 Thread Andrew Edwards
On 1/16/14, 1:10 PM, evilrat wrote: On Thursday, 16 January 2014 at 17:41:02 UTC, Andrew Edwards wrote: I am using Windows 7 Home Premium. [1] http://wiki.dlang.org/Building_DMD is this x64? probably windows .lib's not linked such as kernel32 and others... Yes. Win7x64

Re: Building D from source on Windows

2014-01-16 Thread Dmitry Olshansky
16-Jan-2014 21:41, Andrew Edwards пишет: I'm having problems setting up my programming environment on Windows and would really appreciate some assistance. Following instructions for Windows at [1], everything builds fine, however I cannot build with DMD afterwards because of linker errors. The f

Re: Building D from source on Windows

2014-01-16 Thread evilrat
On Thursday, 16 January 2014 at 17:41:02 UTC, Andrew Edwards wrote: I'm having problems setting up my programming environment on Windows and would really appreciate some assistance. Following instructions for Windows at [1], everything builds fine, however I cannot build with DMD afterwards bec

Re: Is continuously seeding a random number generator performance intensive?

2014-01-16 Thread Jeroen Bollen
On Wednesday, 15 January 2014 at 21:23:03 UTC, Frustrated wrote: Anyways, now that you have your RND2D you don't ever have to pre-generate your noise. Obviously it is more computationally expensive though. Thing is, the image is finite so I figured it'd be best to pre-generate a set of seeds,

Building D from source on Windows

2014-01-16 Thread Andrew Edwards
I'm having problems setting up my programming environment on Windows and would really appreciate some assistance. Following instructions for Windows at [1], everything builds fine, however I cannot build with DMD afterwards because of linker errors. The first such error said that the file C:\D

package.d imports

2014-01-16 Thread Lemonfiend
The following behavior seems odd to me. Could anyone explain why it works as it does? (Does package.d have a page on dlang.org?) --- main.d module main; void main() { test1(); test2(); } void test1() { import pack; // works foo(); // works, did

Re: package.d imports

2014-01-16 Thread Lemonfiend
Sorry, that's --- pack/package.d and --- pack/sub.d

Re: errors with filesystem operations

2014-01-16 Thread Hugo Florentino
On Thu, 16 Jan 2014 15:41:06 +, Kagamin wrote: Probably because you use ansi api: if filename contains non-english character, there could be a problem. A filesystem support is primarily for storing files, attributes can be safely ignored. Hmm... that may be true for Linux filesystems, but

Re: errors with filesystem operations

2014-01-16 Thread Kagamin
Probably because you use ansi api: if filename contains non-english character, there could be a problem. A filesystem support is primarily for storing files, attributes can be safely ignored.

Re: Compile/link Win64

2014-01-16 Thread Vladimir Panteleev
On Friday, 10 January 2014 at 20:32:53 UTC, Brad Anderson wrote: Hmm, that's strange, %WindowsSdkDir% isn't set. I thought vcvarsall.bat was supposed to set up all of that. Appears to be a common problem with VC2008: http://stackoverflow.com/questions/1102689/windowssdkdir-is-not-set-correctly

Re: Compile/link Win64

2014-01-16 Thread Vladimir Panteleev
On Wednesday, 15 January 2014 at 22:21:18 UTC, Nick Sabalausky wrote: "\Program Files (x86)\Windows Kits\" doesn't exist :( As I suspected, it must not have installed correctly. Nick, did you notice my reply from 4 days ago? http://forum.dlang.org/post/lumcuftlvokawuneq...@forum.dlang.org I

Re: A little of coordination for Rosettacode

2014-01-16 Thread bearophile
qznc: This sounds somewhat paradox to me. How can a new feature have a regression? A "regression" means it has worked before, but new feature did not exist before. "Regressions" on older betas; or to see if using the new features breaks other apparently unrelated parts of old code. In pra

Re: Array of pointers

2014-01-16 Thread Namespace
On Thursday, 16 January 2014 at 09:47:21 UTC, Rene Zwanenburg wrote: On Thursday, 16 January 2014 at 09:03:00 UTC, Arjan Fetahu wrote: On Thursday, 16 January 2014 at 09:00:18 UTC, Namespace wrote: On Thursday, 16 January 2014 at 08:55:43 UTC, Arjan Fetahu wrote: Hi. I started my first program

Re: Array of pointers

2014-01-16 Thread Rene Zwanenburg
On Thursday, 16 January 2014 at 09:03:00 UTC, Arjan Fetahu wrote: On Thursday, 16 January 2014 at 09:00:18 UTC, Namespace wrote: On Thursday, 16 January 2014 at 08:55:43 UTC, Arjan Fetahu wrote: Hi. I started my first program in D (I have a little experience in c). I wanted to create an array o

Re: Array of pointers

2014-01-16 Thread Namespace
On Thursday, 16 January 2014 at 08:55:43 UTC, Arjan Fetahu wrote: Hi. I started my first program in D (I have a little experience in c). I wanted to create an array of pointers for creating a node with multiple connections. In C you can make one directly (node *nedePtr[]). What is the equivalen

Re: Array of pointers

2014-01-16 Thread Arjan Fetahu
On Thursday, 16 January 2014 at 09:00:18 UTC, Namespace wrote: On Thursday, 16 January 2014 at 08:55:43 UTC, Arjan Fetahu wrote: Hi. I started my first program in D (I have a little experience in c). I wanted to create an array of pointers for creating a node with multiple connections. In C you

Array of pointers

2014-01-16 Thread Arjan Fetahu
Hi. I started my first program in D (I have a little experience in c). I wanted to create an array of pointers for creating a node with multiple connections. In C you can make one directly (node *nedePtr[]). What is the equivalent for the D's syntax?? Regards Arjan