Le 4 août 2012 00:50, David Nadlinger s...@klickverbot.at a écrit :
On Friday, 3 August 2012 at 22:23:23 UTC, Era Scarecrow wrote:
Seems like an ugly hack though (to get this done). Why not have another
method of fullpathStringof or something similar? Then again if this is one
of the few
On Saturday, August 04, 2012 09:57:36 Philippe Sigaud wrote:
For std.reflection that Andrei proposed 2 weeks ago, I feel the internal
code will contain many __traits() calls. Nothing to be done about it.
__traits is *the* way compile-time introspection is done in D.
That and std.traits.
Era Scarecrow rtcv...@yahoo.com
Then doesn't it seem like we're missing a potentially important piece of
the puzzle for mixins and templates? very likely my modified template will
include you including the same variable twice, but if someone gets lazy
then it may not work.
On Saturday, 4 August 2012 at 07:57:46 UTC, Philippe Sigaud wrote:
FWIW, I agree with David that using .stringof is a last resort
and can lead to nasty bugs. .stringof has a sometime incoherent
behavior (I remember it showing the entire code inside a
delegate literal)
But then, the code
On Saturday, 4 August 2012 at 08:06:31 UTC, Jonathan M Davis
wrote:
On Saturday, August 04, 2012 09:57:36 Philippe Sigaud wrote:
For std.reflection that Andrei proposed 2 weeks ago, I feel
the internal
code will contain many __traits() calls. Nothing to be done
about it.
__traits is *the* way
On Saturday, 4 August 2012 at 07:57:46 UTC, Philippe Sigaud wrote:
It uses __traits(parent, ) and __traits(qualifier, ), which are
much more
'modern' and well-behaved.
An example of what I mean: Try this with your CurryTemplate from
dranges:
---
import dranges.templates;
template Foo(A,
On Sat, 04 Aug 2012 03:01:31 +0200, Zeh zec...@yahoo.com.br wrote:
Thanks for the help, but i tryed both solutions posted and still not
working. :/
I get erros to compile the code posted by simendsjo. I try modify at my
own, but without success. The code suggest by Timon Gehr compiles, but
On Sat, Aug 4, 2012 at 10:25 AM, David Nadlinger s...@klickverbot.at wrote:
An example of what I mean: Try this with your CurryTemplate from dranges:
---
import dranges.templates;
template Foo(A, B) {
pragma(msg, A.stringof, , B.stringof);
}
alias CurryTemplate!Foo FooCurried;
On Saturday, 4 August 2012 at 11:29:36 UTC, Philippe Sigaud wrote:
Oh, I completely forgot this. Nice code, if I may say so myself
:)
Huh? It's broken, precisely because of the use of
__traits(identifier, …) in combination with string mixins. The
example doesn't compile.
David
On Sat, Aug 4, 2012 at 1:35 PM, David Nadlinger s...@klickverbot.at wrote:
On Saturday, 4 August 2012 at 11:29:36 UTC, Philippe Sigaud wrote:
Oh, I completely forgot this. Nice code, if I may say so myself :)
Huh? It's broken, precisely because of the use of __traits(identifier, …) in
Hi,
As I said on #d, foreach with __traits seems to ignore
ForeachTypeList's type.
Look at this ! :p
http://dpaste.dzfl.pl/0885e1de
Wtf ?
Thanks
On 04-Aug-12 17:57, Namespace wrote:
This code http://dpaste.dzfl.pl/6caed813 does only compile if i comment
out the Clone method. Why? o.O
Because it calls constructor and fails? I've done substitution for you:
this(const vec!(float,2) values) {
foreach (index, val; values) {
It looks like the problem is TypeTuple :
http://dpaste.dzfl.pl/de2264dd
On Saturday, 4 August 2012 at 14:05:32 UTC, Dmitry Olshansky
wrote:
On 04-Aug-12 17:57, Namespace wrote:
This code http://dpaste.dzfl.pl/6caed813 does only compile if
i comment
out the Clone method. Why? o.O
Because it calls constructor and fails? I've done substitution
for you:
this(const
Eyyub:
It looks like the problem is TypeTuple :
http://dpaste.dzfl.pl/de2264dd
Fixed in DMD 2.060?
http://d.puremagic.com/issues/show_bug.cgi?id=5435
Bye,
bearophile
On Saturday, 4 August 2012 at 14:27:44 UTC, bearophile wrote:
Eyyub:
It looks like the problem is TypeTuple :
http://dpaste.dzfl.pl/de2264dd
Fixed in DMD 2.060?
http://d.puremagic.com/issues/show_bug.cgi?id=5435
Bye,
bearophile
Oh, indeed.
Sorry I did not look at the changelog before
n 04-Aug-12 18:16, Namespace wrote:
On Saturday, 4 August 2012 at 14:05:32 UTC, Dmitry Olshansky wrote:
On 04-Aug-12 17:57, Namespace wrote:
This code http://dpaste.dzfl.pl/6caed813 does only compile if i comment
out the Clone method. Why? o.O
Because it calls constructor and fails? I've
http://dpaste.dzfl.pl/ff58ffc5
I'm even more confused. o.O
auto a = map!((a)=2*a)(iota(10));
Appears to do exactly what is says on the can. However, whilst:
auto threads = new Thread [ numberOfThreads ] ;
foreach ( i ; 0 .. numberOfThreads ) {
auto closedPartialSum ( ) {
immutable ii = i ;
return delegate ( ) { partialSum ( ii ,
I have a piece of code that looks like this:
https://github.com/jacob-carlborg/dstep/blob/master/clang/Visitor.d#L168
If I change that first function to look like this:
@property ParamCursor first ()
{
assert(any, Cannot get the first parameter of an empty parameter
list);
foreach
On Saturday, 4 August 2012 at 15:23:39 UTC, Russel Winder wrote:
[...]
I can do:
[...]
auto f() { return delegate () { writeln(Hello
World.); }; }
auto t = new Thread(f);
[...]
However:
[...]
auto t = new Thread( delegate () { return delegate ()
{
Gotchas!
The module std.random documentation doesn't work as per the
examples.
The example shows getting a random number by the following code
does not work:
code
// Generate a uniformly-distributed integer in the range [0,
14]
auto i = uniform(0, 15);
// Generate a
On 8/4/12, Jacob Carlborg d...@me.com wrote:
Have I done a mistake somewhere or is this a bug in DMD?
Could be related to: http://d.puremagic.com/issues/show_bug.cgi?id=7453
IOW, maybe your opApply function needs fixing?
On Sat, Aug 4, 2012 at 6:40 PM, Ralph Main rmain1...@live.com wrote:
Hello Ralph,
The module std.random documentation doesn't work as per the examples.
The example shows getting a random number by the following code does not
work:
(snip)
Both code samples you gave work perfectly for me (DMD
Ralph Main:
The module std.random documentation doesn't work as per the
examples.
The example shows getting a random number by the following code
does not work:
code
// Generate a uniformly-distributed integer in the range
[0, 14]
auto i = uniform(0, 15);
// Generate a
On 08/04/2012 06:23 PM, Jacob Carlborg wrote:
I have a piece of code that looks like this:
https://github.com/jacob-carlborg/dstep/blob/master/clang/Visitor.d#L168
If I change that first function to look like this:
@property ParamCursor first ()
{
assert(any, Cannot get the first parameter of
On Saturday, 4 August 2012 at 16:59:09 UTC, Philippe Sigaud wrote:
On Sat, Aug 4, 2012 at 6:40 PM, Ralph Main rmain1...@live.com
wrote:
Hello Ralph,
The module std.random documentation doesn't work as per the
examples.
The example shows getting a random number by the following
code does not
On Saturday, 4 August 2012 at 17:02:19 UTC, bearophile wrote:
Ralph Main:
The module std.random documentation doesn't work as per the
examples.
The example shows getting a random number by the following
code does not work:
code
// Generate a uniformly-distributed integer in the range
On Saturday, 4 August 2012 at 17:45:19 UTC, Ralph Main wrote:
On Saturday, 4 August 2012 at 17:02:19 UTC, bearophile wrote:
Ralph Main:
The module std.random documentation doesn't work as per the
examples.
The example shows getting a random number by the following
code does not work:
code
On 2012-08-04 19:08, Timon Gehr wrote:
int opApply (Delegate dg)
{
auto result = clang_visitChildren(cursor,
visitorFunction,cast(CXClientData) dg);
return result == CXChildVisitResult.CXChildVisit_Break ? 1 : 0; //
culprit
}
Yes, right. I forgot about that. The Clang API doesn't
On 2012-08-04 18:41, Russel Winder wrote:
Isn't there an overload for function and one for delegate?
threadFunctionPointerUnnamed.d(5): Error: constructor core.thread.Thread.this
called with argument types:
((void function()))
matches both:
core.thread.Thread.this(void
On Saturday, 4 August 2012 at 15:23:39 UTC, Russel Winder wrote:
trial.d(7): Error: constructor core.thread.Thread.this (void
function()
fn, ulong sz = cast(ulong)0) is not callable using argument
types (void
delegate() delegate() pure nothrow @safe)
Failed: 'dmd' '-v' '-o-' 'trial.d' '-I.'
On Saturday, 4 August 2012 at 19:03:30 UTC, David Nadlinger wrote:
In your first example is that […]
Darn, make this »In your first example, …«.
On 08/04/2012 08:54 PM, Jacob Carlborg wrote:
On 2012-08-04 19:08, Timon Gehr wrote:
int opApply (Delegate dg)
{
auto result = clang_visitChildren(cursor,
visitorFunction,cast(CXClientData) dg);
return result == CXChildVisitResult.CXChildVisit_Break ? 1 : 0; // culprit
}
Yes,
On Sat, Aug 4, 2012 at 7:27 PM, Ralph Main rmain1...@live.com wrote:
I tried the code in just main() like bearophile's post, and it worked just
fine. I also removed the new keyword from my program and it compiled.
The error message that I got yesterday with the example code returned an
I'd like to write some unit tests to check my software. Writing
unittest blocks and putting assert statements in there seems easy
enough, but I noticed that if the code I run in there throws an
exception, I don't get the unit test failed message.
How does unittest check for success/failure?
On Sunday, August 05, 2012 00:00:24 Maxime Chevalier wrote:
I'd like to write some unit tests to check my software. Writing
unittest blocks and putting assert statements in there seems easy
enough, but I noticed that if the code I run in there throws an
exception, I don't get the unit test
On Saturday, 4 August 2012 at 22:09:03 UTC, Jonathan M Davis
wrote:
On Sunday, August 05, 2012 00:00:24 Maxime Chevalier wrote:
How does unittest check for success/failure? Does assert throw
a
special kind of error class when it fails? How would you check
that some code didn't throw an
On Saturday, 4 August 2012 at 20:22:23 UTC, Philippe Sigaud wrote:
On Sat, Aug 4, 2012 at 7:27 PM, Ralph Main rmain1...@live.com
wrote:
I tried the code in just main() like bearophile's post, and it
worked just
fine. I also removed the new keyword from my program and it
compiled.
The
On Sunday, August 05, 2012 00:15:49 David Nadlinger wrote:
A failed unit test really just means that a unit test block is
left via an exception. Currently, it just bubbles up to the
druntime main(), where it is printed to console and causes a
non-zero exit code, but future unit test frameworks
On Saturday, 4 August 2012 at 22:15:53 UTC, David Nadlinger wrote:
On Saturday, 4 August 2012 at 22:09:03 UTC, Jonathan M Davis
wrote:
On Sunday, August 05, 2012 00:00:24 Maxime Chevalier wrote:
How does unittest check for success/failure? Does assert
throw a special kind of error class when
On Saturday, 4 August 2012 at 22:26:26 UTC, Jonathan M Davis
wrote:
On Sunday, August 05, 2012 00:15:49 David Nadlinger wrote:
A failed unit test really just means that a unit test block is
left via an exception. Currently, it just bubbles up to the
druntime main(), where it is printed to
On Sunday, August 05, 2012 01:01:03 Tobias Pankrath wrote:
you can do it as a library solution just fine.
You shouldn't have to use a library to get named unit tests, since unit
testing is built into D, and the lack of name unit tests is a real problem for
stack traces and the like. It was
These improvements would be very nice. The unit test framework,
as it is, is rather underpowered.
Exceptions could also use more documentation on the D website. I
heard there was some exception chaining mechanism, but I can't
even seem to find any info on the Error class.
You shouldn't have
On Sunday, August 05, 2012 01:43:55 Maxime Chevalier wrote:
These improvements would be very nice. The unit test framework,
as it is, is rather underpowered.
Exceptions could also use more documentation on the D website. I
heard there was some exception chaining mechanism, but I can't
even
In the following code:
Variant j;
j = 1.0; // make it a double
auto x = cast(float)(j.get!(double)); // fail: cannot cast
j.get!(double)
auto y = cast(float)x; // fine
The first attempt to cast doesn't compile, but the second
less-direct cast is OK. Is that a bit strange?
On Sat, 2012-08-04 at 21:03 +0200, David Nadlinger wrote:
[…]
You are trying to pass a delegate which returns a delegate –
this isn't going to work. ;)
But that is my whole point, it does a lot of the time, and it depends on
whether you are working with named functions and delegates or with
47 matches
Mail list logo