On Thu, 21 Aug 2014 06:34:10 +
Shachar via Digitalmars-d-learn
wrote:
> Indeed. I ended up simply directly calling
> "a.opDispatch!"do_something_cool"(5, 6)", which brought most of
> those issues to light.
ah, silly me. i forgot about such simple thing.
signature.asc
Description: PGP sign
On Thursday, 21 August 2014 at 06:11:06 UTC, ketmar via
Digitalmars-d-learn wrote:
that will do the trick.
Indeed. I ended up simply directly calling
"a.opDispatch!"do_something_cool"(5, 6)", which brought most of
those issues to light.
Shachar
On Thu, 21 Aug 2014 05:39:14 +
Shachar via Digitalmars-d-learn
wrote:
that's it: failing to evaluate opDispatch() template is not a
compilation error. compiler will silently try to find direct method if
opDispatch() fails. so be very careful with it.
you can add pragma(msg, "...") to your op
On Thu, 21 Aug 2014 05:39:14 +
Shachar via Digitalmars-d-learn
wrote:
> auto onDispatch(string m, Args...)(Args args)
first: opDispatch, not onDispatch.
second: underscoresToCamelCase() can't be evaluated in compile-time
anymore. the necessary changes:
1. add 'import std.string' -- we need
I'm trying to compile the onDispatch demo program from "The D
Programming Language" (page 387). At first I had an import
problem, but I fixed that. Now, however, when I try to call
"a.do_something_cool", I get an error message saying:
onDispatch.d(43): Error: no property 'do_something_cool' fo
Hi All,
I am playing with a small hack OS for fun and in 2066 there are
these undefined refs (I have no druntime):
_d_arraybounds (new to 2066)
_d_assert (new to 2066)
_d_unittest (new to 2066)
_Dmodule_ref (also in 2065)
_d_dso_registry (also in 2065)
It is trivial to stub these out but it g
What changed? It ran okay with early beta versions, but not
with the release.
Paul
It compiles in beta-5 but not beta-6. Is the list of changes in
the beta testing wiki complete? None seem pertinent.
monarch_dodra: Thanks for checking. I was trying to avoid tearing
everything down. I was
On Wed, 20 Aug 2014 23:03:48 +0200
Philippe Sigaud via Digitalmars-d-learn
wrote:
> Can compiler switches be used with the shebang notation? If yes, there
> is certainly a GDC flag (-run?) that tells it to run the generated
> executable.
it's possible to use switches, but GDC is not fitted for su
On Wed, 20 Aug 2014 17:47:36 +
monarch_dodra via Digitalmars-d-learn
wrote:
> Yeah, what he said. It's a language artifact.
by the way, it would be nice to have wiki page with such artifacts and
their explanations.
signature.asc
Description: PGP signature
On Wednesday, 20 August 2014 at 23:56:23 UTC, Baz wrote:
Hello, I've been very interested about the announce saying that
DMD is able to produce COFF object files. Mostly because I'm
thinking using some objects programmed in D in a software
programmed in another lang, a bit like when statically
Hello, I've been very interested about the announce saying that
DMD is able to produce COFF object files. Mostly because I'm
thinking using some objects programmed in D in a software
programmed in another lang, a bit like when statically linking a
dll to a program but with an obj, to keep a nic
On Wednesday, 20 August 2014 at 21:30:41 UTC, Etienne wrote:
So, my question inspired a new optimization? :-p
A decent optimizing compiler would detect that the function is
calling itself and save stack space by using register where
possible...
On Wednesday, 20 August 2014 at 21:06:49 UTC, monarch_dodra wrote:
On Wednesday, 20 August 2014 at 20:39:42 UTC, Jonathan M Davis
wrote:
is(typeof(foo)) and __traits(compiles, foo) are not the same.
The first tests for the existence of the symbol, whereas the
second checks whether the code will
On 2014-08-20 5:25 PM, Ola Fosheim Gr wrote:
Well, I guess simple recursion could be solved easily too by having a
wrapper function that puts the frame pointer in a free callee save
register...
So, my question inspired a new optimization? :-p
On Wednesday, 20 August 2014 at 21:19:18 UTC, Ola Fosheim Gr
wrote:
On Wednesday, 20 August 2014 at 20:48:38 UTC, Chris
Nicholson-Sauls wrote:
On Wednesday, 20 August 2014 at 15:17:52 UTC, Ola Fosheim Gr
wrote:
Only if it is recursive.
Or if it refers to any state of the parent function.
As
On Wednesday, 20 August 2014 at 20:46:20 UTC, Paul D Anderson
wrote:
Re-compiling existing code with version 2.066 generates a lot
of errors complaining about implicit conversion to const.
Typical is this call (inside a struct with properties 1 & 2):
z.sign = x.sign ^ y.sign;
Error: N
On Wednesday, 20 August 2014 at 20:48:38 UTC, Chris
Nicholson-Sauls wrote:
On Wednesday, 20 August 2014 at 15:17:52 UTC, Ola Fosheim Gr
wrote:
non-static nested functions are effectively delegates as it
needs a context pointer to parent stack frame.
Only if it is recursive.
Or if it refers t
On Wednesday, 20 August 2014 at 20:39:42 UTC, Jonathan M Davis
wrote:
is(typeof(foo)) and __traits(compiles, foo) are not the same.
The first tests for the existence of the symbol, whereas the
second checks whether the code will actually compile.
Is that even true? I mean, are you just repeati
>> gdc just compiles the program to a.out. It doesn't run the
>> resulting executable. You need to use something like rdmd instead
>> of gdc. rdmd compiles to some temporary location and then runs
>> the executable.
>
>
> Wow, that was fast. Thanks a lot!
Can compiler switches be used with the she
Re-compiling existing code with version 2.066 generates a lot of
errors complaining about implicit conversion to const. Typical is
this call (inside a struct with properties 1 & 2):
z.sign = x.sign ^ y.sign;
Error: None of the overloads of 'sign' are callable using
argument types bool
On Wednesday, 20 August 2014 at 15:17:52 UTC, Ola Fosheim Gr
wrote:
non-static nested functions are effectively delegates as it
needs a context pointer to parent stack frame.
Only if it is recursive.
Or if it refers to any state of the parent function.
On Wednesday, 20 August 2014 at 20:12:58 UTC, Justin Whear wrote:
On Wed, 20 Aug 2014 20:01:03 +, Colin wrote:
It looks veryhacky.
I see 3 distinct parts playing a role in my confusion:
A) The 'is' keyword. What does it do when you have
is(expression);
B) typeof( expression ); whats t
On Wednesday, 20 August 2014 at 20:21:13 UTC, anonymous wrote:
On Wednesday, 20 August 2014 at 20:17:49 UTC, Newbie wrote:
#!/usr/bin/gdc
import std.stdio;
void main()
{
writeln("Hello, world with automated script running!");
}
When I compile the code above normal to an a.out binary it run
On Wednesday, 20 August 2014 at 20:17:49 UTC, Newbie wrote:
#!/usr/bin/gdc
import std.stdio;
void main()
{
writeln("Hello, world with automated script running!");
}
When I compile the code above normal to an a.out binary it runs
like expected. But running it with shebang it does nothing. N
On Wednesday, 20 August 2014 at 20:01:05 UTC, Colin wrote:
I see 3 distinct parts playing a role in my confusion:
A) The 'is' keyword. What does it do when you have
is(expression);
http://dlang.org/expression.html#IsExpression
It is a tool for type checking. It has many options but plain
`is
#!/usr/bin/gdc
import std.stdio;
void main()
{
writeln("Hello, world with automated script running!");
}
When I compile the code above normal to an a.out binary it runs
like expected. But running it with shebang it does nothing. No
output, especially no error message. Nothing.
What do I wr
On Wed, 20 Aug 2014 20:01:03 +, Colin wrote:
> It looks veryhacky.
>
> I see 3 distinct parts playing a role in my confusion:
> A) The 'is' keyword. What does it do when you have is(expression);
> B) typeof( expression ); whats this doing? Particularly when the
> expression its acting on
Hi,
I'm implementing some template checks on some types I'm using in
a project, and went to phobos for some indications on how to use
them.
In std.range, I see this construct quite a bit:
template isInputRange(R)
{
enum bool isInputRange = is(typeof(
(inout int = 0)
{
R r
On Wednesday, 20 August 2014 at 17:02:59 UTC, Dicebot wrote:
On Wednesday, 20 August 2014 at 15:34:30 UTC, Dominikus Dittes
Scherkl wrote:
And why historical? Is that not necessary anymore? What better
solution is there today?
Historical in a sense that distinct "can be anything" template
par
On Wednesday, 20 August 2014 at 15:34:30 UTC, Dominikus Dittes
Scherkl wrote:
And why historical? Is that not necessary anymore? What better
solution is there today?
Historical in a sense that distinct "can be anything" template
parameter is probably a better approach but it is too late to
ch
On Wednesday, 20 August 2014 at 16:16:03 UTC, ketmar via
Digitalmars-d-learn wrote:
On Wed, 20 Aug 2014 16:07:47 +
KrzaQ via Digitalmars-d-learn
wrote:
It's as if the implementation didn't expect the last argument.
try to upgrade to dmd 2.066.
That did the trick. Thanks.
On Wed, 20 Aug 2014 16:07:47 +
KrzaQ via Digitalmars-d-learn wrote:
> It's as if the implementation didn't expect the last argument.
try to upgrade to dmd 2.066.
signature.asc
Description: PGP signature
Hello,
I'm trying to follow the documentation:
http://dlang.org/phobos/std_process.html#.execute
Unfortunately, the following code gives me a compiler error:
class Probator
{
char[] dir;
this(const char[] dir){
this.dir = dir.dup;
}
int revisio
On Wednesday, 20 August 2014 at 15:37:18 UTC, Philippe Sigaud via
Digitalmars-d-learn wrote:
No better solution that I know of.
alias template parameters (alias a) match symbols (names,
user-defined
types) whereas type parameter (T) match only pure types.
So when we need to match anything, we
On Wed, Aug 20, 2014 at 5:34 PM, Dominikus Dittes Scherkl via
Digitalmars-d-learn wrote:
> On Wednesday, 20 August 2014 at 15:26:14 UTC, monarch_dodra wrote:
>>
>> AFAIK, it's a historical workaround to accept T as either alias or not
>> alias, as varargs have "auto alias". EG:
>>
>> foo!int //OK
On Wednesday, 20 August 2014 at 15:11:53 UTC, Dominikus Dittes
Scherkl wrote:
I have several times seen a construct
template foo(T...) if(T.length == 1)
{
...
}
What is that good for?
Why using variadic parameter if anyway exactly one parameter is
required?!?
That's because template alias
On Wednesday, 20 August 2014 at 15:26:14 UTC, monarch_dodra wrote:
AFAIK, it's a historical workaround to accept T as either alias
or not alias, as varargs have "auto alias". EG:
foo!int //OK
foo!"hello" //OK too
Ah, ok.
And why historical? Is that not necessary anymore? What better
solution
On Wednesday, 20 August 2014 at 15:11:53 UTC, Dominikus Dittes
Scherkl wrote:
I have several times seen a construct
template foo(T...) if(T.length == 1)
{
...
}
What is that good for?
Why using variadic parameter if anyway exactly one parameter is
required?!?
AFAIK, it's a historical work
On Wednesday, 20 August 2014 at 14:44:39 UTC, Etienne wrote:
I've been hearing that delegates get a context pointer which
will be allocated on the GC. Is this also true for delegates
which stay in scope?
e.g.
void addThree() {
int val;
void addOne() {
val++;
non-static nested functions are effectively delegates as it
needs a context pointer to parent stack frame.
Only if it is recursive.
I have several times seen a construct
template foo(T...) if(T.length == 1)
{
...
}
What is that good for?
Why using variadic parameter if anyway exactly one parameter is
required?!?
On Wednesday, 20 August 2014 at 14:54:31 UTC, ketmar via
Digitalmars-d-learn wrote:
On Wed, 20 Aug 2014 10:44:38 -0400
Etienne via Digitalmars-d-learn
wrote:
and this is not delegate, this is just nested function.
non-static nested functions are effectively delegates as it needs
a context
On Wed, 20 Aug 2014 10:44:38 -0400
Etienne via Digitalmars-d-learn
wrote:
and this is not delegate, this is just nested function.
signature.asc
Description: PGP signature
On Wed, 20 Aug 2014 10:44:38 -0400
Etienne via Digitalmars-d-learn
wrote:
> Will the above function allocate on the GC?
no.
signature.asc
Description: PGP signature
I've been hearing that delegates get a context pointer which will be
allocated on the GC. Is this also true for delegates which stay in scope?
e.g.
void addThree() {
int val;
void addOne() {
val++;
}
addOne();
addOne();
ad
On Wednesday, 20 August 2014 at 09:13:15 UTC, Jonathan M Davis
via Digitalmars-d-learn wrote:
On Wed, 20 Aug 2014 01:38:52 +
uri via Digitalmars-d-learn
wrote:
Hi all,
Bit new to D so this might be a very naive question...
Can the compiler auto infer function attributes?
I am often ad
On Wed, 20 Aug 2014 01:38:52 +
uri via Digitalmars-d-learn wrote:
> Hi all,
>
> Bit new to D so this might be a very naive question...
>
> Can the compiler auto infer function attributes?
>
> I am often adding as many attributes as possible and use the
> compiler to show me where they're not
Thank you!
On Wednesday, 20 August 2014 at 07:18:12 UTC, Kagamin wrote:
http://dlang.org/phobos/std_traits.html#TemplateOf
Or isInstanceOf.
static if (__traits(isSame, TemplateOf!R, SortedRange))
static if (isInstanceOf!(SortedRange, R))
http://dlang.org/phobos/std_traits.html#TemplateOf
50 matches
Mail list logo