I'm a C# programmer, when I apply IoC pattern I use readonly
keyword
(http://msdn.microsoft.com/en-us/library/acdd6hb7%28v=vs.71%29.aspx)
in this manner:
:// C# code
:interface IFoo {
: void Fun();
:}
:
:class Foo: IFoo {
: void Fun() {...}
:}
:class Bar {
: private readonly IFoo foo;
:
On Monday, 4 February 2013 at 09:02:31 UTC, o3o wrote:
I'm a C# programmer, when I apply IoC pattern I use readonly
keyword
(http://msdn.microsoft.com/en-us/library/acdd6hb7%28v=vs.71%29.aspx)
in this manner:
:// C# code
:interface IFoo {
: void Fun();
:}
:
:class Foo: IFoo {
: void Fun()
On Monday, 4 February 2013 at 10:26:55 UTC, simendsjo wrote:
On Monday, 4 February 2013 at 09:02:31 UTC, o3o wrote:
I'm a C# programmer, when I apply IoC pattern I use
readonly keyword
(http://msdn.microsoft.com/en-us/library/acdd6hb7%28v=vs.71%29.aspx)
in this manner:
:// C# code
On 2013-02-04 10:02, o3o wrote:
I'm a C# programmer, when I apply IoC pattern I use readonly keyword
(http://msdn.microsoft.com/en-us/library/acdd6hb7%28v=vs.71%29.aspx) in
this manner:
:// C# code
:interface IFoo {
: void Fun();
:}
:
:class Foo: IFoo {
: void Fun() {...}
:}
:class Bar {
:
On Monday, 4 February 2013 at 10:26:55 UTC, simendsjo wrote:
[cut]
So.. Every method you call through a const instance must also
be const, otherwise you have the ability to change something
that should be a constant.
Thanks simendsjo, now I get it...
So, let me continue the example (I remove
Dear,
I am looking to parse efficiently huge file but i think D lacking
for this purpose.
To parse 12 Go i need 11 minutes wheras fastxtoolkit (written in
c++ ) need 2 min.
My code is maybe not easy as is not easy to parse a fastq file
and is more harder when using memory mapped file.
I
On Sunday, 3 February 2013 at 16:07:06 UTC, Artur Skawina wrote:
On 02/03/13 16:53, SaltySugar wrote:
GTKD. Can someone explain me how to change button size in
vbox, hbox? setSizeRequest (70, 50); doesn't work. Thanks.
Try playing with an interactive gui tool, such as glade. The
fill, expand
First, AFAIK, there is no equivalent of C# readonly in D,
despite the fact that D uses 3 keywords for various kinds of
immutability.
Second, here you can find a mocking library for D:
http://www.dsource.org/projects/dmocks/wiki/DMocks
On Monday, 4 February 2013 at 13:35:24 UTC, o3o
Sparsh Mittal:
I am allocating 2d array as:
double[gridSize][gridSize] gridInfo;
which works for small dimension, but for large dimension, 16Mb
limit comes.
Walter has decided to introduce a very low limit for the size of
static arrays. (Both Clang and G++ support larger ones).
Would
Thanks for your prompt reply. It was very helpful.
On Monday, 4 February 2013 at 15:23:20 UTC, Sparsh Mittal wrote:
I am allocating 2d array as:
double[gridSize][gridSize] gridInfo;
which works for small dimension, but for large dimension, 16Mb
limit comes.
Would you please tell me how do allocate a large 2d array
(which has to be done as
monarch_dodra:
If all (but last of) the dimensions are known at compile time,
then you can dynamically allocate an array of fixed sized
arrays:
//
enum size_t gridSize = 4_000;
enum size_t total = gridSize * gridSize;
static assert (total == 16_000_000); //16 million doubles total
Steven Schveighoffer:
Wow, this is something I didn't know was possible. Very useful!
It's it cute when you use a language almost daily for few years,
and then you see a new way to allocate built-in arrays? :-)
Bye,
bearophile
On 2013-02-04 15:04, bioinfornatics wrote:
I am looking to parse efficiently huge file but i think D lacking for this
purpose.
To parse 12 Go i need 11 minutes wheras fastxtoolkit (written in c++ ) need 2
min.
My code is maybe not easy as is not easy to parse a fastq file and is more
harder
I am using wchar[] and find the usage clunky. Am I doing something wrong?
Example:
// Compiler complains that wchar[] != immutable(char)[]
wchar[] wstr = This is a wchar[];
// Compiler accepts this
wchar[] wstr = This is a wchar[]w.dup;
// Compiler accepts this
On 02/04/2013 10:13 AM, ollie wrote:
I am using wchar[] and find the usage clunky. Am I doing something wrong?
Example:
// Compiler complains that wchar[] != immutable(char)[]
wchar[] wstr = This is a wchar[];
There is nothing but a wchar slice that is going to provide access to
On Mon, 04 Feb 2013 13:13:22 -0500, ollie ol...@home.net wrote:
I am using wchar[] and find the usage clunky. Am I doing something wrong?
Example:
// Compiler complains that wchar[] != immutable(char)[]
wchar[] wstr = This is a wchar[];
It's not so much the wchar vs. char, but the
On 02/04/2013 10:22 AM, Ali Çehreli wrote:
On 02/04/2013 10:13 AM, ollie wrote:
I am using wchar[] and find the usage clunky. Am I doing something
wrong?
Example:
// Compiler complains that wchar[] != immutable(char)[]
wchar[] wstr = This is a wchar[];
There is nothing but a
FG wrote:
On 2013-02-04 15:04, bioinfornatics wrote:
I am looking to parse efficiently huge file but i think D lacking for this
purpose. To parse 12 Go i need 11 minutes wheras fastxtoolkit (written in c++
) need 2 min.
My code is maybe not easy as is not easy to parse a fastq file and is
On Monday, 4 February 2013 at 19:30:59 UTC, Dejan Lekic wrote:
FG wrote:
On 2013-02-04 15:04, bioinfornatics wrote:
I am looking to parse efficiently huge file but i think D
lacking for this
purpose. To parse 12 Go i need 11 minutes wheras fastxtoolkit
(written in c++
) need 2 min.
My code
On Mon, 04 Feb 2013 13:28:43 -0500, Steven Schveighoffer wrote:
On Mon, 04 Feb 2013 13:13:22 -0500, ollie ol...@home.net wrote:
wchar[] wstr = This is a wchar[];
It's not so much the wchar vs. char, but the mutable vs. immutable. It
could be argued that the message should say wchar[]
On Monday, February 04, 2013 19:45:02 ollie wrote:
Right, because you are duplicating the string onto the heap, and making
it mutable.
I thought druntime always created dynamic arrays on the heap and returned
a slice.
It does, but duping or iduping an array or string literal would
On Mon, 04 Feb 2013 14:45:02 -0500, ollie ol...@home.net wrote:
What is the storage (heap/stack) of straight assignment if this were a
local variable. Or do you mean that This is a wchar[] was already
created on the heap as an immutable(wchar)[] then assigned to wstr.
The string is actually
On Mon, 04 Feb 2013 15:09:06 -0500, Steven Schveighoffer wrote:
On Mon, 04 Feb 2013 14:45:02 -0500, ollie ol...@home.net wrote:
What is the storage (heap/stack) of straight assignment if this were
a local variable. Or do you mean that This is a wchar[] was already
created on the heap as an
On Monday, 4 February 2013 at 16:54:37 UTC, bearophile wrote:
Steven Schveighoffer:
Wow, this is something I didn't know was possible. Very
useful!
It's it cute when you use a language almost daily for few years,
and then you see a new way to allocate built-in arrays? :-)
Bye,
bearophile
On 02/04/2013 03:03 PM, SaltySugar wrote:
On Sunday, 3 February 2013 at 16:07:06 UTC, Artur Skawina wrote:
On 02/03/13 16:53, SaltySugar wrote:
GTKD. Can someone explain me how to change button size in vbox, hbox?
setSizeRequest (70, 50); doesn't work. Thanks.
Try playing with an interactive
monarch_dodra:
Ideally, I wish we could allocate static arrays on the heap
easily:
int[2]* p = new int[2]()
To do that I wrap the array inside a static struct:
struct Arr {
int[2] a;
}
Arr* data = new Arr;
writeln(data.a[1]);
Anybody know why this doesn't work?
Maybe it's just a
See also:
http://d.puremagic.com/issues/show_bug.cgi?id=9265
Bye,
bearophile
Is the Fwend user of Rosettacode (or some other interested
person) around here? I have written partial D implementations for
three tasks, maybe a little of coordination will speedup the work:
http://rosettacode.org/wiki/Permutations/Rank_of_a_permutation
Hi,
In phobos there are places with void[] and places with ubyte[],
and I can't really understand why there is this difference. I
don't even see why D has a void array or void pointer anyway.
For example, in std.base64, ubyte[] is used as the basic quantity
for encoding, while in std.zlib,
On Mon, 4 Feb 2013, monarch_dodra wrote:
AFAIK, he is reading text data that needs to be parsed line by line, so
byChunk may not be the best approach. Or at least, not the easiest approach.
I'm just wondering if maybe the reason the D code is slow is not just because
of:
- unicode.
-
I've seen these type of errors often and usually the cause kind
of jumps out. In this case I'm totally confused. Just trying to
move from 2.06 to 2.061.
The code is: http://dpaste.dzfl.pl/f40e4d6f
and fails with the error in subject line. Observations:
- If static if(1) is changed to static
On 02/04/2013 05:15 PM, Dan wrote:
I've seen these type of errors often and usually the cause kind of jumps
out. In this case I'm totally confused. Just trying to move from 2.06 to
2.061.
The code is: http://dpaste.dzfl.pl/f40e4d6f
and fails with the error in subject line. Observations:
- If
On Tuesday, 5 February 2013 at 01:38:54 UTC, Ali Çehreli wrote:
Further reduced:
[snip]
The problem is related to History.opEquals being 'const'.
Remove that 'const' and the code compiles. This must be a (lack
of) const-correctness issue.
Thanks Ali. If const is removed it will compile.
On 2/5/13, Dan dbdavid...@yahoo.com wrote:
and I still don't understand the error.
The error in the git-head version is:
Error: mutable method test.RC.__postblit is not callable using a const object
Error: cannot modify struct this Slot with immutable members
Yeah, it's still not very helpful.
On Monday, 4 February 2013 at 22:02:48 UTC, bearophile wrote:
monarch_dodra:
Ideally, I wish we could allocate static arrays on the heap
easily:
int[2]* p = new int[2]()
To do that I wrap the array inside a static struct:
struct Arr {
int[2] a;
}
Arr* data = new Arr;
On 2013-02-04 14:35, o3o wrote:
So, let me continue the example (I remove const for simplicity)...
I would like check that bar.gun() call fun() function from IFoo
unittest {
auto foo = new MockIFoo(); //Will not compile.Mock doesn't (yet)
exist
auto bar = new Bar(foo);
On 2013-02-04 20:39, monarch_dodra wrote:
AFAIK, he is reading text data that needs to be parsed line by line, so
byChunk may not be the best approach. Or at least, not the easiest
approach.
He can still read a chunk from the file, or the whole file and then read
that chunk line by line.
38 matches
Mail list logo