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.
I
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 Mock(); //Will not compile.Mock doesn't (yet)
exist
auto bar = new Bar(foo);
bar.gun()
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;
writeln(data.a[
On 2/5/13, Dan 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. And I have no idea
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.
I
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 "s
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 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.
>
On 2/5/13, Stephan wrote:
> In phobos there are places with void[] and places with ubyte[]
One benefit of void[] over ubyte[] is implicit conversion. E.g.:
void input(void[] arr) { }
void main()
{
input([1, 2]);
input([1.0, 2.0]);
input(["foo", "bar"]);
}
You don't get that convers
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, it'
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
http://rosettacode.org/wiki/Universal_Tu
See also:
http://d.puremagic.com/issues/show_bug.cgi?id=9265
Bye,
bearophile
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
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
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 Mon, 04 Feb 2013 15:09:06 -0500, Steven Schveighoffer wrote:
> On Mon, 04 Feb 2013 14:45:02 -0500, ollie 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 im
On Mon, 04 Feb 2013 14:45:02 -0500, ollie 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 stored in c
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 a
On Mon, 04 Feb 2013 13:28:43 -0500, Steven Schveighoffer wrote:
> On Mon, 04 Feb 2013 13:13:22 -0500, ollie 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[] != ws
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
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 fil
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 n
On Mon, 04 Feb 2013 13:13:22 -0500, 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[]";
It's not so much the wchar vs. char, but the mutable vs. imm
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 acces
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 2013-13-04 17:02, Steven Schveighoffer wrote:
BTW, "all (but last of) the dimensions" isn't correct, you know them all
in your example, and it looks great!
I believe his point was that this also works if you don't know the last
dimension beforehand.
--
Simen
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 wh
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 Mon, 04 Feb 2013 10:58:36 -0500, bearophile
wrote:
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 ass
It's not a big deal, but indexing *might* be a little slower
with this scheme.
Thanks a lot for your reply. It was extremely useful, since I am
optimizing for performance.
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
stati
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 a
Thanks for your prompt reply. It was very helpful.
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 yo
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 wrot
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 a dynamic array)? It is a square grid and
dimensions are already k
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
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 do
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
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:
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
:interf
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(
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;
:
43 matches
Mail list logo