On 2013-07-23 06:27, Paul O'Neil wrote:
I'm trying to write some code that finds all the members of a class that
have a particular user defined attribute. My current attempt is at
https://github.com/todayman/d_template_experiments/tree/8fccd27d7d5557ec6e2f0614374cf5f79fe80b4c
I would like to h
I'm trying to write some code that finds all the members of a class that
have a particular user defined attribute. My current attempt is at
https://github.com/todayman/d_template_experiments/tree/8fccd27d7d5557ec6e2f0614374cf5f79fe80b4c
I would like to have a static method that returns an arra
On Tuesday, July 23, 2013 05:42:10 Carl Sturtivant wrote:
> On Sunday, 21 July 2013 at 18:37:23 UTC, Jonathan M Davis wrote:
> > On Sunday, July 21, 2013 16:25:15 Carl Sturtivant wrote:
> >> That's too bad, because in the real code this example was
> >> derived
> >> from I can't have type inference
On Sunday, 21 July 2013 at 18:37:23 UTC, Jonathan M Davis wrote:
On Sunday, July 21, 2013 16:25:15 Carl Sturtivant wrote:
That's too bad, because in the real code this example was
derived
from I can't have type inference call the right constructor as
there are two constructors with the same run
On 07/22/2013 03:53 PM, bearophile wrote:
> Ali Çehreli:
>
>> Going off topic, why not -w then? If I want to be warned about
>> something, I don't want the program to be compiled anyway but perhaps
>> others want to look at warning messages. :)
>
> There are discussions like this:
> http://d.pure
On Monday, 22 July 2013 at 21:08:48 UTC, bearophile wrote:
So the standard idiom to use foreach on interval needs to be:
foreach (immutable i; 0 .. 10) { ... }
Bye,
bearophile
This comes with another issue embedded here
http://forum.dlang.org/thread/felqszcrbvtrepjtf...@forum.dlang.org
On Monday, 22 July 2013 at 21:22:42 UTC, bearophile wrote:
Given all that, isn't it good to have the "Set operations"
(that actually work on _sorted bags_, so their name is
misleading and probably even wrong) of std.algorithm, like
std.algorithm.setDifference accept only SortedRanges?
SetDiff
On Monday, 22 July 2013 at 21:04:42 UTC, John Colvin wrote:
On Sunday, 21 July 2013 at 17:24:11 UTC, JS wrote:
This seems to be a somewhat efficient string splitter
http://dpaste.dzfl.pl/4307aa5f
The basic idea is
for(int j = 0; j < s.length; j++)
{
mixin(ExpandVariadicIf!("??Cs[j]?
On Monday, 22 July 2013 at 21:04:42 UTC, John Colvin wrote:
On Sunday, 21 July 2013 at 17:24:11 UTC, JS wrote:
This seems to be a somewhat efficient string splitter
http://dpaste.dzfl.pl/4307aa5f
The basic idea is
for(int j = 0; j < s.length; j++)
{
mixin(ExpandVariadicIf!("??Cs[j]?
Ali Çehreli:
Going off topic, why not -w then? If I want to be warned about
something, I don't want the program to be compiled anyway but
perhaps others want to look at warning messages. :)
There are discussions like this:
http://d.puremagic.com/issues/show_bug.cgi?id=10147
Bye,
bearophile
On 07/22/2013 02:13 PM, bearophile wrote:
> Please always compile all your D code with the "-wi" switch
Going off topic, why not -w then? If I want to be warned about
something, I don't want the program to be compiled anyway but perhaps
others want to look at warning messages. :)
Ali
Joseph Rushton Wakeling:
It so happens that for the code in question I did, and had got
that warning, and made the switch. I just hadn't realized that
in either case the value would be positive! I just noticed
because of a case where I was initializing a value to
real.min_normal and then taki
On Monday, 22 July 2013 at 21:13:49 UTC, bearophile wrote:
Please always compile all your D code with the "-wi" switch,
because Walter is deaf at my suggestions to have informational
warnings active on default in D compilations :-)
It so happens that for the code in question I did, and had got
In Phobos we have std.range.assumeSorted, std.algorithm.isSorted,
and various sort() functions that return a SortedRange. If you
call a release() on a SortedRange you get the range that's under
it (often an array).
(A SortedRange was so far only a RandomAccessRange, but I've
shown Andrei that
Joseph Rushton Wakeling:
I just realized that while e.g. int.min gives a negative value,
the floating point equivalent, e.g. double.min, gives a very
small positive value -- I guess the smallest possible positive
value.
Please always compile all your D code with the "-wi" switch,
because Wa
On Mon, Jul 22, 2013 at 11:02:28PM +0200, Joseph Rushton Wakeling wrote:
> Always amusing to run into those little quirks of parts of the
> language you've never worked with before ...
>
> I just realized that while e.g. int.min gives a negative value, the
> floating point equivalent, e.g. double.
Andrej Mitrovic:
Actually it used to be a bug that writing to the index
/without/ ref
would end up changing the iteration order, but this was fixed in
2.063. It's in the changelog:
http://dlang.org/changelog.html#foreachref
The right design in my opinion is to have the iteration variable
im
On Monday, 22 July 2013 at 21:02:30 UTC, Joseph Rushton Wakeling
wrote:
Always amusing to run into those little quirks of parts of the
language you've never worked with before ...
I just realized that while e.g. int.min gives a negative value,
the floating point equivalent, e.g. double.min, gi
On Sunday, 21 July 2013 at 17:24:11 UTC, JS wrote:
This seems to be a somewhat efficient string splitter
http://dpaste.dzfl.pl/4307aa5f
The basic idea is
for(int j = 0; j < s.length; j++)
{
mixin(ExpandVariadicIf!("??Cs[j]??s[j..min(s.length-1, j +
%%L)]::", "d", "
Always amusing to run into those little quirks of parts of the
language you've never worked with before ...
I just realized that while e.g. int.min gives a negative value,
the floating point equivalent, e.g. double.min, gives a very
small positive value -- I guess the smallest possible positiv
On Monday, 22 July 2013 at 16:29:39 UTC, Maxim Fomin wrote:
This also compiles, but I used a different aggregate, yet
represents the same thing. Because it is implemented
differently, I get a completely different result. Unless I'm
mistaken, when a result depends on the implementation, and the
On 7/22/13, monarch_dodra wrote:
> 99% sure that's unspecified behavior. I wouldn't rely on anything
> like that.
Actually it used to be a bug that writing to the index /without/ ref
would end up changing the iteration order, but this was fixed in
2.063. It's in the changelog:
http://dlang.org/c
On Monday, 22 July 2013 at 09:26:33 UTC, David wrote:
Am 22.07.2013 10:41, schrieb Namespace:
It's part of Dgame and it's the shape draw method. The method
collects
the vertices and give them to the vertex buffer.
I will try it with my current way: static stack buffer with a
size of
1024 and o
Justin Whear wrote:
> On Mon, 22 Jul 2013 20:07:28 +0200, moechofe wrote:
>
>> Hi,
>>
>> I have a problem when I try to compile Derelict3 under linux. I try
>> different orders of the linked libraries without success.
>>
>> I've got this error:
>>
>> /home/martin/Derelict3/lib/dmd/libDerelictS
On Monday, 22 July 2013 at 18:08:15 UTC, Jesse Phillips wrote:
I disagree, those discussions were about @property, they had
very little to do with accessor methods (getX setY). Most of
the discussion was on how to add properties into the language
where disagreement was around if optional parens
On Mon, 22 Jul 2013 20:07:28 +0200, moechofe wrote:
> Hi,
>
> I have a problem when I try to compile Derelict3 under linux. I try
> different orders of the linked libraries without success.
>
> I've got this error:
>
> /home/martin/Derelict3/lib/dmd/libDerelictSDL2.a(sdl_106_698.o):(.rodata
+0x
On Jul 22, 2013, at 10:25 AM, Alex Horvat wrote:
> On Monday, 22 July 2013 at 16:58:00 UTC, Sean Kelly wrote:
>> On Jul 22, 2013, at 9:45 AM, "Alex Horvat" wrote:
>>
When a detached thread terminates, its resources are auto- matically
released back to the system:"
>>> Sound
Hi,
I have a problem when I try to compile Derelict3 under linux. I
try different orders of the linked libraries without success.
I've got this error:
/home/martin/Derelict3/lib/dmd/libDerelictSDL2.a(sdl_106_698.o):(.rodata+0x3094):
référence indéfinie vers «
_D6object6Object8opEqualsMFC6Obj
On Monday, 22 July 2013 at 17:27:02 UTC, Dicebot wrote:
On Monday, 22 July 2013 at 17:15:53 UTC, Jesse Phillips wrote:
Use properties. You'll find it more common in other D code.
Whether you use a field or a method is up to you, I suspect
using method will be more common.
As multiple property
Am Mon, 22 Jul 2013 05:47:34 +0200
schrieb "JS" :
> Doing simple stuff like
>
> for(int i = 0; i < s.length - 1; i++) fails catastrophically if s
> is empty. To make right one has to reduce performance by writing
> extra checks.
And my opinion on the matter is that it is catastrophic style
to
On Monday, 22 July 2013 at 16:58:00 UTC, Sean Kelly wrote:
On Jul 22, 2013, at 9:45 AM, "Alex Horvat"
wrote:
When a detached thread terminates, its resources are auto-
matically released back to the system:"
Sounds like I can call Thread.getThis().thread_detachThis()
from within Dela
On Monday, 22 July 2013 at 17:15:53 UTC, Jesse Phillips wrote:
Use properties. You'll find it more common in other D code.
Whether you use a field or a method is up to you, I suspect
using method will be more common.
As multiple property threads have shown this is a _very_ varying
preference
Am Fri, 19 Jul 2013 21:43:38 +0200
schrieb Johannes Pfau :
> Am Fri, 19 Jul 2013 12:38:45 +0200
> schrieb Marco Leise :
>
> Would be nice to know if this is working with gdc or ldc. In theory it
> should work as we use gcc's exception handling/stack unwinding so it's
> probably a dmd bug.
That's
On Monday, 22 July 2013 at 15:07:29 UTC, Land wrote:
I was just thinking about properties and to be honest, I don't
like them all that much. There's no way to tell if it's a
read-only or write-only property (right?), but getValue and
setValue are pretty self-explanatory.
After many discussion I
On Monday, 22 July 2013 at 16:42:57 UTC, Land wrote:
Thank you for the replies. So, what's the bottom line? Should I
use accessor methods or should I use properties? (I've read
quite a bit of the mentioned 500-post topic, by the way, but
I'm still not clear on what's the most logical step here)
When a detached thread terminates, its resources are auto-
matically released back to the system:"
Sounds like I can call Thread.getThis().thread_detachThis() from
within DelayedHideTitle() and that will make the thread detached
and therefore it will destroy itself properly.
Or, if tha
On Jul 22, 2013, at 9:45 AM, "Alex Horvat" wrote:
>>
>> When a detached thread terminates, its resources are auto- matically
>> released back to the system:"
>
> Sounds like I can call Thread.getThis().thread_detachThis() from within
> DelayedHideTitle() and that will make the thread deta
On Monday, 22 July 2013 at 15:51:45 UTC, monarch_dodra wrote:
So... you are saying that if the grammar allows it, then the
behavior is specified?
You may argue that although grammar does allows it, the feature
is semantically not defined. However here it is known what "ref
int i" means, to
On Monday, 22 July 2013 at 16:42:57 UTC, Land wrote:
Thank you for the replies. So, what's the bottom line? Should I
use accessor methods or should I use properties? (I've read
quite a bit of the mentioned 500-post topic, by the way, but
I'm still not clear on what's the most logical step here)
On Jul 20, 2013, at 12:34 PM, Alex Horvat wrote:
> If I use core.thread.Thread to create a new thread associated to a function
> like this:
>
> Thread testThread = new Thread(&DoSomething);
>
> Will the testThread dispose of itself after DoSomething() completes, or do I
> need to join/destroy
On Jul 22, 2013, at 9:15 AM, Ali Çehreli wrote:
>
> Apparently, it is possible to detach from a thread or even to start it in the
> detached state to begin with: "By default, a new thread is created in a
> joinable state, unless attr was set to create the thread in a detached state
> (using pt
On 07/22/2013 08:32 AM, Alex Horvat wrote:
On Sunday, 21 July 2013 at 15:30:06 UTC, Ali Çehreli wrote:
On 07/20/2013 09:43 PM, Ali Çehreli wrote:
> When the parent thread terminates the child processes
terminate as well.
I am wrong there: What I said above is true for the main program
thread.
On Sunday, 21 July 2013 at 07:22:08 UTC, JS wrote:
void foo(T...)(T t)
{
pragma(msg, B(t));
}
void main() {
foo("x", "a", "b");
din.getc();
}
does work. I need to have B generate compile time code so it is
efficient. Your method calls an actual function at runtime so
it is ne
Thank you for the replies. So, what's the bottom line? Should I
use accessor methods or should I use properties? (I've read quite
a bit of the mentioned 500-post topic, by the way, but I'm still
not clear on what's the most logical step here)
On Monday, 22 July 2013 at 15:04:25 UTC, monarch_dodra wrote:
On Monday, 22 July 2013 at 12:51:31 UTC, Andrej Mitrovic wrote:
On 7/22/13, JS wrote:
foreach doesn't allow you to modify the index to skip over
elements.
It does:
-
import std.stdio;
void main()
{
int[] x = [1, 2, 3, 4,
On 07/22/2013 08:04 AM, monarch_dodra wrote:
> On Monday, 22 July 2013 at 12:51:31 UTC, Andrej Mitrovic wrote:
>> On 7/22/13, JS wrote:
>>> foreach doesn't allow you to modify the index to skip over
>>> elements.
>>
>> It does:
>>
>> -
>> import std.stdio;
>>
>> void main()
>> {
>> int[]
On Monday, 22 July 2013 at 15:07:29 UTC, Land wrote:
I was just thinking about properties and to be honest, I don't
like them all that much. There's no way to tell if it's a
read-only or write-only property (right?), but getValue and
setValue are pretty self-explanatory.
Also, someone was angry
On Sunday, 21 July 2013 at 15:30:06 UTC, Ali Çehreli wrote:
On 07/20/2013 09:43 PM, Ali Çehreli wrote:
> When the parent thread terminates the child processes
terminate as well.
I am wrong there: What I said above is true for the main
program thread. When the main program terminates, its threa
On 07/22/2013 08:07 AM, Land wrote:
> I was just thinking about properties and to be honest, I don't
> like them all that much. There's no way to tell if it's a
> read-only or write-only property (right?),
Documentation should make it clear. Otherwise, it should be possible to
detect whether a
On Monday, 22 July 2013 at 15:39:11 UTC, Maxim Fomin wrote:
On Monday, 22 July 2013 at 15:04:25 UTC, monarch_dodra wrote:
On Monday, 22 July 2013 at 12:51:31 UTC, Andrej Mitrovic wrote:
On 7/22/13, JS wrote:
foreach doesn't allow you to modify the index to skip over
elements.
It does:
I was just thinking about properties and to be honest, I don't
like them all that much. There's no way to tell if it's a
read-only or write-only property (right?), but getValue and
setValue are pretty self-explanatory.
Also, someone was angry about .keys making a copy. I agree with
that person an
On Monday, 22 July 2013 at 12:51:31 UTC, Andrej Mitrovic wrote:
On 7/22/13, JS wrote:
foreach doesn't allow you to modify the index to skip over
elements.
It does:
-
import std.stdio;
void main()
{
int[] x = [1, 2, 3, 4, 5];
foreach (ref i; 0 .. 5)
{
writeln(x[i]);
On Monday, 22 July 2013 at 12:51:31 UTC, Andrej Mitrovic wrote:
On 7/22/13, JS wrote:
foreach doesn't allow you to modify the index to skip over
elements.
It does:
-
import std.stdio;
void main()
{
int[] x = [1, 2, 3, 4, 5];
foreach (ref i; 0 .. 5)
{
writeln(x[i]);
On 7/22/13, JS wrote:
> foreach doesn't allow you to modify the index to skip over
> elements.
It does:
-
import std.stdio;
void main()
{
int[] x = [1, 2, 3, 4, 5];
foreach (ref i; 0 .. 5)
{
writeln(x[i]);
++i;
}
}
-
Writes:
1
3
5
On Monday, 22 July 2013 at 11:56:35 UTC, Regan Heath wrote:
If we were to design the perfect type for representing a size
or length it would hold the maximum value of an unsigned int,
but would not undeflow to max unsigned int, instead it would
truncate.
This type would have to be built on to
On Mon, 22 Jul 2013 04:47:34 +0100, JS wrote:
Doing simple stuff like
for(int i = 0; i < s.length - 1; i++) fails catastrophically if s is
empty. To make right one has to reduce performance by writing extra
checks.
There seems to be no real good reason why size_t is unsigned... Surely
> how about s[i - 1..n]?
>
> You going to go throw some ifs around the statement that uses that? Use
> a ternary if? So I'm forced to use a longer more verbose method, and
> also introduce bugs, because the most obvious, simplest, and logical
> solution, s[max(0, i-1)..n] won't work.
-1 as index
On Monday, 22 July 2013 at 09:34:35 UTC, JS wrote:
On Monday, 22 July 2013 at 07:12:07 UTC, monarch_dodra wrote:
On Monday, 22 July 2013 at 03:47:36 UTC, JS wrote:
Doing simple stuff like
for(int i = 0; i < s.length - 1; i++) fails catastrophically
if s is empty. To make right one has to redu
On 2013-07-21 12:18, Namespace wrote:
But then I have mostly far too much and maybe a few times a bit too less
store. It's not flexible. But maybe with a smaller granule.
What's about this:
You said you needed between 100 and 4000 floats. My suggestion will
allocate 4000 floats once per threa
On Monday, 22 July 2013 at 07:12:07 UTC, monarch_dodra wrote:
On Monday, 22 July 2013 at 03:47:36 UTC, JS wrote:
Doing simple stuff like
for(int i = 0; i < s.length - 1; i++) fails catastrophically
if s is empty. To make right one has to reduce performance by
writing extra checks.
Not reall
Am 22.07.2013 10:41, schrieb Namespace:
> It's part of Dgame and it's the shape draw method. The method collects
> the vertices and give them to the vertex buffer.
> I will try it with my current way: static stack buffer with a size of
> 1024 and otherwise I will temporary allocate memory. But how
It's part of Dgame and it's the shape draw method. The method
collects the vertices and give them to the vertex buffer.
I will try it with my current way: static stack buffer with a
size of 1024 and otherwise I will temporary allocate memory. But
how much shapes grow larger than 1024 vertices ;)
On Sunday, 21 July 2013 at 21:35:15 UTC, Namespace wrote:
On Sunday, 21 July 2013 at 21:31:08 UTC, bearophile wrote:
Namespace:
I have a float[1024] buffer which is used, as long as the
requested size is less than 1024. If it's greater, I will
temporary allocate the whole array with new float
On Monday, 22 July 2013 at 03:47:36 UTC, JS wrote:
Doing simple stuff like
for(int i = 0; i < s.length - 1; i++) fails catastrophically if
s is empty. To make right one has to reduce performance by
writing extra checks.
Not really, you could instead just write your loop correctly.
1. Don't l
64 matches
Mail list logo