On 20/04/12 04:36, Joseph Rushton Wakeling wrote:
On 03/04/12 02:24, Cristi Cobzarenco wrote:
Mixins templates would be the answer:
OK, I've had a go at writing up some mixin template-based policy code of my own.
Oh, fun. You can even have the constructor provided by a template mixin ... !
Am 21.04.2012 01:16, schrieb Stephen Jones:
glBufferData(GL_ARRAY_BUFFER, v.length * GL_FLOAT.sizeof, v,
GL_STATIC_DRAW);
Error spotted!
This has to be:
glBufferData(GL_ARRAY_BUFFER, v.length * float.sizeof, v.ptr,
GL_STATIC_DRAW);
float.sizeof is just cosmetic, the important thing
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, null);//is this right
casting a void pointer for 0 offset?
I do it like this: cast(void*)OFFSET; e.g.
cast(void*)12;
On 20/04/2012 21:29, H. S. Teoh wrote:
Is there a way to format std.datetime.Date objects with a custom format
string?
My utility library has a datetime module with a custom formatting facility.
http://pr.stewartsplace.org.uk/d/sutil/
The format string scheme is one of my own design, using
On 20/04/2012 01:53, Andrej Mitrovic wrote:
Can I remove this section from the D docs, in functions? :
Local Variables
It is an error to use a local variable without first assigning it a
value. The implementation may not always be able to detect these
cases. Other language compilers sometimes
Why does the following implementation of the binomial coefficient
yield two different answers?
import std.stdio, std.bigint;
void main()
{
// Correct result when using long
writeln((40 20) = , binomial(40L, 20L));
// 2 times the expected result when using BigInt
writeln((40
Al 21/04/12 16:07, En/na Tyro[17] ha escrit:
Why does the following implementation of the binomial coefficient yield two
different answers?
Only happens when compiling to 32-bit.
32-bit:
(40 20) = 137846528820
(40 20) = 68923264410
64-bit:
(40 20) = 137846528820
(40 20) = 137846528820
On Saturday, 21 April 2012 at 14:30:49 UTC, Jordi Sayol wrote:
Al 21/04/12 16:07, En/na Tyro[17] ha escrit:
Why does the following implementation of the binomial
coefficient yield two different answers?
Only happens when compiling to 32-bit.
32-bit:
(40 20) = 137846528820
(40 20) =
On Sat, Apr 21, 2012 at 01:03:13PM +0100, Stewart Gordon wrote:
On 20/04/2012 01:53, Andrej Mitrovic wrote:
[...]
It is an error to declare a local variable that is never referred to.
Dead variables, like anachronistic dead code, are just a source of
confusion for maintenance programmers.
Al 21/04/12 16:42, En/na Tyro[17] ha escrit:
Actually, in that case it only happens when compiling to 64-bit.
Note: comb1(BigInt(40), BigInt(20))/2; The the BigInt version is
being divided by two (on MAC OS X) in order to yield the
correct result.
You are right, sorry.
My test was done
On 4/21/12, H. S. Teoh hst...@quickfur.ath.cx wrote:
It would be a major pain if every
single time you need to temporarily suppress a section of code, you also
have to hunt down every last stray variable that's now no longer
referenced in the function and comment them out as well.
Next thing
H. S. Teoh:
Why do you want to be able to declare local variables and then
never use them?
[...]
It happens a lot when you're debugging code (temporarily
comment out
some stuff for testing purposes). It would be a major pain if
every
single time you need to temporarily suppress a section of
Hi guys,
I'm trying to use std.regex to parse a string like the following:
string myString = preOuter {if condition1} content1 {if condition2} content2
{elseif condition3} content3 {else}any other content{/if}{/if} postOuter;
Is there any chance to use std.regex to parse the string above? I
On 21.04.2012 21:24, nrgyzer wrote:
Hi guys,
I'm trying to use std.regex to parse a string like the following:
string myString = preOuter {if condition1} content1 {if condition2} content2
{elseif condition3} content3 {else}any other content{/if}{/if} postOuter;
Simply put pure regex is
On 20.4.2012 19:00, John Chapman wrote:
On Friday, 20 April 2012 at 14:57:03 UTC, Martin Drasar wrote:
On 20.4.2012 16:09, Timon Gehr wrote:
I tried but it still refuses to compile:
string interfaceGuid(string ifaceName)
{
return ifaceName ~ Guid;
}
mixin template
On Sat, Apr 21, 2012 at 06:42:06PM +0200, bearophile wrote:
H. S. Teoh:
Why do you want to be able to declare local variables and then
never use them?
[...]
It happens a lot when you're debugging code (temporarily comment out
some stuff for testing purposes). It would be a major pain if
On Sat, Apr 21, 2012 at 06:26:52PM +0200, Andrej Mitrovic wrote:
On 4/21/12, H. S. Teoh hst...@quickfur.ath.cx wrote:
It would be a major pain if every single time you need to
temporarily suppress a section of code, you also have to hunt down
every last stray variable that's now no longer
On Sat, Apr 21, 2012 at 09:41:18PM +0400, Dmitry Olshansky wrote:
On 21.04.2012 21:24, nrgyzer wrote:
Hi guys,
I'm trying to use std.regex to parse a string like the following:
string myString = preOuter {if condition1} content1 {if condition2} content2
{elseif condition3} content3
Thank you very very much, Dmitry. Now all it's fine!
Xan.
On Friday, 20 April 2012 at 19:51:40 UTC, Dmitry Olshansky wrote:
On 20.04.2012 23:33, Xan wrote:
Yes, you're wright. So in.
But what fails?
I reveice these errors and I have no idea what fails!
Sorry, the errors are:
$ gdmd-4.6
On 21.04.2012 22:46, H. S. Teoh wrote:
On Sat, Apr 21, 2012 at 09:41:18PM +0400, Dmitry Olshansky wrote:
On 21.04.2012 21:24, nrgyzer wrote:
Hi guys,
I'm trying to use std.regex to parse a string like the following:
string myString = preOuter {if condition1} content1 {if condition2} content2
My question is, why D hasn't got an explicit Keyword to check at
compile time for non null references?
I understand that such check when they're implicit and refer to
all objects they slow down the programm, but why doesn't exist an
explicit keyword like @ref or a simple '@' before the Object
On Saturday, 21 April 2012 at 11:02:51 UTC, David wrote:
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, null);//is
this right casting a void pointer for 0 offset?
I do it like this: cast(void*)OFFSET; e.g.
cast(void*)12;
Thankyou David. Just to complete the code for those who follow:
On Saturday, April 21, 2012 18:26:52 Andrej Mitrovic wrote:
On 4/21/12, H. S. Teoh hst...@quickfur.ath.cx wrote:
It would be a major pain if every
single time you need to temporarily suppress a section of code, you also
have to hunt down every last stray variable that's now no longer
My C programming lies in cobwebs but from memory an array was a
pointer to the zeroth index of a set of uniformly sized chunks of
memory. I am perplexed to find that in D a call to an array (of
float vertices for example) cannot be accomplished by handing v
to functions that need the zeroth
We can do not null in the library reasonably
well. I have a basic one in github:
https://github.com/D-Programming-Language/phobos/pull/477
On Saturday, 21 April 2012 at 20:56:27 UTC, Kamil Slowikowski
wrote:
This link fails to load for me:
http://digitalmars.com/d/2.0/dlangspec.mobi
I'd really like a copy for myself. Can I get it elsewhere?
The eBook is a compilation of the pages on dlang.org, which
sources are hosted on
Am 21.04.2012 23:49, schrieb Stephen Jones:
On Saturday, 21 April 2012 at 11:02:51 UTC, David wrote:
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, null);//is this
right casting a void pointer for 0 offset?
I do it like this: cast(void*)OFFSET; e.g.
cast(void*)12;
Thankyou David. Just
On 04/21/2012 03:05 PM, Stephen Jones wrote:
My C programming lies in cobwebs but from memory an array was a pointer
to the zeroth index of a set of uniformly sized chunks of memory.
Yes and no. :) What you are describing is the feature where an array
decays to what you describe.
But there
On 4/22/12, Stephen Jones siwe...@gmail.com wrote:
My C programming lies in cobwebs but from memory an array was a
pointer to the zeroth index of a set of uniformly sized chunks of
memory. I am perplexed to find that in D a call to an array (of
float vertices for example) cannot be
Below are measured times on operations on an unzipped 2GB layout.
My observation is that use of a slightly modified version of
std.file.write for the creation of the unzipped files results in
a folder that is much more efficient for sequential file system
operations. In particular, the ntfs
On Saturday, 21 April 2012 at 22:18:02 UTC, Adam D. Ruppe wrote:
We can do not null in the library reasonably
well. I have a basic one in github:
https://github.com/D-Programming-Language/phobos/pull/477
So every time i want to avoid null references i have to write
NotNull!(Foo) f (or
On 04/21/2012 11:40 PM, Namespace wrote:
My question is, why D hasn't got an explicit Keyword to check at compile
time for non null references?
It shouldn't be a special keyword. If the compiler can do the necessary
analysis to actually enforce that the reference cannot hold a null
On 04/22/2012 12:48 AM, Namespace wrote:
On Saturday, 21 April 2012 at 22:18:02 UTC, Adam D. Ruppe wrote:
We can do not null in the library reasonably
well. I have a basic one in github:
https://github.com/D-Programming-Language/phobos/pull/477
So every time i want to avoid null references i
On Saturday, 21 April 2012 at 22:48:27 UTC, Namespace wrote:
So every time i want to avoid null references i have to write
NotNull!(Foo) f (or better, because it's a struct: ref
NotNull!(Foo) f)?
It is already a reference! Otherwise, it couldn't be null anyway.
But, yes, you'd write
I see you're right. Great! But it is only on git hub and not in
the standard typecons header in 2.059, right?
While playing with sorting the unzip archive entries I tried use
of the last example in
http://dlang.org/phobos/std_algorithm.html#sort
std.algorithm.sort!(toLower(a.name)
toLower(b.name),std.algorithm.SwapStrategy.stable)(entries);
It was terribly slow for sorting the 34k entries in my
Adam D. Ruppe:
We can do not null in the library reasonably
well. I have a basic one in github:
https://github.com/D-Programming-Language/phobos/pull/477
It says:
I haven't actually used any NotNull in practice, but from the
attached tests, it looks like it will work well - hence, the
pull
On Saturday, 21 April 2012 at 23:18:40 UTC, Namespace wrote:
I see you're right. Great! But it is only on git hub and not in
the standard typecons header in 2.059, right?
But one thing: i missed there an invariant which check if t is
null.
If i write f.t = null; no error occured.
On Saturday, 21 April 2012 at 23:27:38 UTC, Namespace wrote:
But one thing: i missed there an invariant which check if t is
null.
If i write f.t = null; no error occured.
Don't do that!
Maybe I should make t private...
On Saturday, 21 April 2012 at 23:26:04 UTC, bearophile wrote:
I think before putting something in Phobos it's generally
better to have used it in Real Code for some time.
I agree, but this comes up a LOT on the newsgroup,
so I figure we need to get something up there to point
people to.
I am
On Sunday, April 22, 2012 01:24:56 Jay Norwood wrote:
While playing with sorting the unzip archive entries I tried use
of the last example in
http://dlang.org/phobos/std_algorithm.html#sort
std.algorithm.sort!(toLower(a.name)
toLower(b.name),std.algorithm.SwapStrategy.stable)(entries);
I just pushed an update to git with
a few changes people have suggested.
I removed one of the old opAssigns
to keep a static type check.
Added assumeNotNull and checkNotNull
as entry points.
Made the data member private.
I think that's closer to what everyone
wants.
On Saturday, April 21, 2012 20:36:18 bearophile wrote:
Jonathan M Davis:
I'm not sure if it's
an order of magnitude worse than your solution though, since it's been a
while since I studied Big(O) notation (doing the conversion only once is
still more expensive than not converting, but I'm
On Sat, Apr 21, 2012 at 05:45:35PM -0700, Jonathan M Davis wrote:
On Saturday, April 21, 2012 20:36:18 bearophile wrote:
Jonathan M Davis:
I'm not sure if it's an order of magnitude worse than your
solution though, since it's been a while since I studied Big(O)
notation (doing the
On 04/21/2012 04:24 PM, Jay Norwood wrote:
While playing with sorting the unzip archive entries I tried use of the
last example in http://dlang.org/phobos/std_algorithm.html#sort
std.algorithm.sort!(toLower(a.name)
toLower(b.name),std.algorithm.SwapStrategy.stable)(entries);
Stealing this
On Saturday, 21 April 2012 at 23:54:26 UTC, Jonathan M Davis
wrote:
Yeah. toLower would be called on both strings on _every_
compare. And since
that involves a loop, that would make the overall call to sort
an order of
magnitude worse than if you didn't call toLower at all. I'm not
sure if
On Sunday, April 22, 2012 03:47:30 Jay Norwood wrote:
On Saturday, 21 April 2012 at 23:54:26 UTC, Jonathan M Davis
wrote:
Yeah. toLower would be called on both strings on _every_
compare. And since
that involves a loop, that would make the overall call to sort
an order of
magnitude
On Saturday, April 21, 2012 18:43:23 Ali Çehreli wrote:
On 04/21/2012 04:24 PM, Jay Norwood wrote:
While playing with sorting the unzip archive entries I tried use of the
last example in http://dlang.org/phobos/std_algorithm.html#sort
std.algorithm.sort!(toLower(a.name)
On Saturday, April 21, 2012 18:26:42 H. S. Teoh wrote:
Actually, I don't think the nested loops affect Big-O complexity at all.
The O(l) complexity (where l = string length) is already inherent in the
string comparison str otherStr. Adding more loops over the strings
doesn't change the Big-O
On 04/18/2012 01:26 AM, Somedude wrote:
For a complete beginner, it's very frustrating to have to read 4
chapters of fluff, then write the program, and still not knowing how to
run the program. Where is the fun ? I can guarantee that at this point,
9 out of 10 beginners will drop the
On Sat, 2012-04-21 at 22:14 -0700, Ali Çehreli wrote:
[...]
That part is done:
http://ddili.org/ders/d.en/hello_world.html
Surely Hello World shows just a few, and definitely not all, of the
essential concepts of a programming language.
--
Russel.
51 matches
Mail list logo