Am Sat, 08 Sep 2012 16:25:49 +0100
schrieb Russel Winder rus...@winder.org.uk:
On Sat, 2012-09-08 at 07:20 -0700, Ellery Newcomer wrote:
[…]
Okay, here:
https://bitbucket.org/ariovistus/deimos-elfutils/overview
I have some code with a working makefile and a nonworking
SConstruct
On Saturday, 8 September 2012 at 09:10:30 UTC, Jonathan M Davis
wrote:
If you were to operate on a string in a manner similar to a
stream, you'd be
operating on it as a range, and there are a lot of range-based
functions in
Phobos. But if you want to specifically parse a range of
characters,
On Sunday, September 09, 2012 12:21:59 monarch_dodra wrote:
Hum, parse. Looks useful. No need to create a temp stream like in
C++ then. Good. Thanks for the info.
That said, is the abstraction itself available? Say *someone*
wrote an xml parser, and the public interface expects to operate
On Sun, 2012-09-09 at 10:15 +0200, Johannes Pfau wrote:
[…]
Please note that pragma(lib) is an evil feature. For example it will
never work in gdc.
So this is a DMD-only (*) feature and not a feature of the D programming
language per se?
(*) and hence LDC.
--
Russel.
Johannes Pfau:
pragma(lib) is an evil feature. For example it will never work
in gdc.
Do you know why it's impossible to implement it in GDC?
And if it's impossible to implement in GDC, then maybe it's
better to ask Walter to deprecate its usage in general.
Bye,
bearophile
On Sunday, 9 September 2012 at 10:36:14 UTC, Jonathan M Davis
wrote:
On Sunday, September 09, 2012 12:21:59 monarch_dodra wrote:
Hum, parse. Looks useful. No need to create a temp stream like
in
C++ then. Good. Thanks for the info.
That said, is the abstraction itself available? Say *someone*
I would like to create an associative array that maps a string to
a multidimensional dynamic array. In other words, I would like a
data structure where I can access elements like this:
foo[key][0][0]
Is this possible? If so I'm having trouble figuring out the
correct syntax, the following
On Sunday, September 09, 2012 14:13:26 monarch_dodra wrote:
Okay, that makes a sense to me. In c++, the paradigm is:
*Streams for formating.
*Iterators for algorithms.
Two paradigms = object to go from string(pointer/iterator) to
stream.
And you are telling me that in D, everything is
On Sun, Sep 9, 2012 at 2:18 PM, Samuele Carcagno sam.carca...@gmail.com wrote:
I would like to create an associative array that maps a string to a
multidimensional dynamic array. In other words, I would like a data
structure where I can access elements like this:
foo[key][0][0]
The type you
On Sunday, 9 September 2012 at 12:17:47 UTC, Samuele Carcagno
wrote:
I would like to create an associative array that maps a string
to a multidimensional dynamic array. In other words, I would
like a data structure where I can access elements like this:
foo[key][0][0]
Is this possible? If so
Still struggling..
test.d:
---
( ... ) /* Other imports */
import win32.directx.d2d1;
alias win32.directx.d2d1.IID IID;
IID IID_ID2D1Factory = { 0x06152247, 0x6F50, 0x465A, [0x92, 0x45,
0x11, 0x8B, 0xFD, 0x3B, 0x60, 0x07] };
extern (Windows)
int WinMain( ...
thanks a lot! both solutions work, to initialize the arrays of
int I'm doing:
int[][][string] foo;
foo[key] = new int[][](6,6);
foo[key][0][0] = 5;
it seems to work.
On Saturday, 8 September 2012 at 23:18:14 UTC, Timon Gehr wrote:
On 09/09/2012 01:16 AM, Namespace wrote:
Why fail this code?
without const on Name it works fine.
http://dpaste.dzfl.pl/9fa0986a
const fields cannot be written to. This includes the case when
the
entire struct is written to
On 9/9/2012 7:30 AM, newToCOM wrote:
Still struggling..
test.d:
---
( ... ) /* Other imports */
import win32.directx.d2d1;
alias win32.directx.d2d1.IID IID;
IID IID_ID2D1Factory = { 0x06152247, 0x6F50, 0x465A, [0x92, 0x45, 0x11,
0x8B, 0xFD, 0x3B, 0x60, 0x07] };
On 9/9/2012 7:57 AM, Sean Cavanaugh wrote:
On 9/9/2012 7:30 AM, newToCOM wrote:
I've been super busy at work so haven't had much time to respond to this
thread.
I also have a D version of something resembling ATL's CComPtr which I am
finally happy enough with to share, that I could post
On Sun, Sep 9, 2012 at 2:48 PM, Samuele Carcagno sam.carca...@gmail.com wrote:
thanks a lot! both solutions work, to initialize the arrays of int I'm
doing:
int[][][string] foo;
foo[key] = new int[][](6,6);
foo[key][0][0] = 5;
it seems to work.
Great!
Keep in mind all these structures
In this example the pID2D1Factory is a void*, so it will need a
cast to the proper type with a cast(ID2D1Factory) soemtime
after the create call;
Since this particular API takes an out void* (since it is
capable of creating multiple unrelated types), it would need to
look something like
I also have a D version of something resembling ATL's CComPtr
which I am finally happy enough with to share, that I could
post when i get home later tonight.
The class is a good argument for keeping the rather esoteric
opDot operator, since alias this is extremely dangerous for
smart pointer
Philippe Sigaud:
Keep in mind all these structures (AA and dynamic arrays) are
reference types.
There are bug-prone things you have to keep in mind.
Not exactly a reference type, this is by D specs:
import std.stdio;
import std.array: popFront;
void main() {
auto d = [1:[2, 3]];
Am Sun, 09 Sep 2012 13:53:23 +0200
schrieb bearophile bearophileh...@lycos.com:
Do you know why it's impossible to implement it in GDC?
And if it's impossible to implement in GDC, then maybe it's
better to ask Walter to deprecate its usage in general.
Bye,
bearophile
IIRC this is the
Johannes Pfau:
Putting linker flags into source files is just not a good idea:
Thank you for the explanation. Then maybe we should deprecate
pragma(lib).
Bye,
bearophile
On Sunday, 9 September 2012 at 14:26:48 UTC, bearophile wrote:
Thank you for the explanation. Then maybe we should deprecate
pragma(lib).
If it doesn't work, there's no difference between having it and
not - you have to do it yourself anyway. So deprecation
accomplishes nothing except
On Saturday, 8 September 2012 at 23:18:14 UTC, Timon Gehr wrote:
On 09/09/2012 01:16 AM, Namespace wrote:
Why fail this code?
without const on Name it works fine.
http://dpaste.dzfl.pl/9fa0986a
const fields cannot be written to. This includes the case when
the
entire struct is written to
On 09/09/2012 07:27 AM, bearophile wrote:
Johannes Pfau:
Putting linker flags into source files is just not a good idea:
Thank you for the explanation. Then maybe we should deprecate
pragma(lib).
Bye,
bearophile
Similar to pragmas in C and C++, D pragmas allow language extensions:
On Sun, 2012-09-09 at 08:05 -0700, Ali Çehreli wrote:
[…]
Similar to pragmas in C and C++, D pragmas allow language extensions:
Pragmas are a way to pass special information to the compiler and to
add vendor specific extensions to D.
http://dlang.org/pragma.html
This states that:
On 09/09/2012 08:48 AM, Russel Winder wrote:
On Sun, 2012-09-09 at 08:05 -0700, Ali Çehreli wrote:
http://dlang.org/pragma.html
This states that:
pragma(lib, blah.lib)
is a part of the D language and not just a DMD extension.
I hadn't read that far. :*)
Personally I would say
Given this little program testing regexs, I decided to replace
one of the example's assert with an enforce:
import std.regex;
import std.exception;
void main()
{
auto m = match(hello world, regex(world));
assert(m);
enforce(m); // -- HERE
enforce(cast(bool)m);
On 9/9/2012 1:15 AM, Johannes Pfau wrote:
Am Sat, 08 Sep 2012 16:25:49 +0100
schrieb Russel Winder rus...@winder.org.uk:
On Sat, 2012-09-08 at 07:20 -0700, Ellery Newcomer wrote:
[…]
Okay, here:
https://bitbucket.org/ariovistus/deimos-elfutils/overview
I have some code with a working
I'd like to achieve the following:
import std.stdio,std.range,std.algorithm,std.array;
void main(){
auto dg=a=a*2;
auto a=iota(0,10);
writeln(a.map!dg.array);
}
but this doesn't compile:
Error: variable [...]dg type void is inferred from initializer
delegate (__T26 a)
{
Is there a way to use Object.factory with template classes?
eg:
class A(T){
T x;
}
auto a=Object.factory(A!int);
Right now this fails (returns null).
Use case:
If we had this, it would GREATLY simplify serialization (eg as in
the orange library) by not having to manually register
I'd like to have something like:
---
import std.stdio:!writeln,write;
---
which would import all symbols from std.stdio except the ones
listed (writeln,write).
Use case:
The reason is to avoid writing verbose code (specifying all
symbols to import except those 2), example when writing a
I would like to find the indexes of all the elements of an array
matching a certain value. I could simply loop over all the
elements to do the job, but I was hoping for some ready made
function that also works across different types (ints, floats
etc...).
I saw the countUntil function in
This works:
import std.stdio;
void main(){
writeln(std.conv.to!double(1));
}
This doesn't compile:
import std.stdio;
void main(){
std.stdio.writeln(std.conv.to!double(1));
}
=Error: undefined identifier std
So it seems for conv, import std.conv is not needed,
On 09/09/2012 08:09 AM, Namespace wrote:
On Saturday, 8 September 2012 at 23:18:14 UTC, Timon Gehr wrote:
On 09/09/2012 01:16 AM, Namespace wrote:
Why fail this code?
without const on Name it works fine.
http://dpaste.dzfl.pl/9fa0986a
const fields cannot be written to. This includes the
Can we filter out compiler errors involving _error_ as template
parameter?
Clearly the error is coming from upstream so there's no need to
even show those.
eg:
Error: template mypackage.mymodule.myfunction cannot deduce
template function from argument types !()(_error_)
On Sunday, September 09, 2012 17:09:23 Namespace wrote:
On Saturday, 8 September 2012 at 23:18:14 UTC, Timon Gehr wrote:
On 09/09/2012 01:16 AM, Namespace wrote:
Why fail this code?
without const on Name it works fine.
http://dpaste.dzfl.pl/9fa0986a
const fields cannot be written
timotheecour:
I'd like to achieve the following:
import std.stdio,std.range,std.algorithm,std.array;
void main(){
auto dg=a=a*2;
auto a=iota(0,10);
writeln(a.map!dg.array);
}
but this doesn't compile:
Error: variable [...]dg type void is inferred from initializer
delegate
Because in D there is no global inferencer,
On the other hand it's not impossible to invent a syntax for
templated lambdas, etc :-)
Bye,
bearophile
On 09/10/2012 01:55 AM, bearophile wrote:
Your code doesn't look good,
Yes it does.
On Monday, September 10, 2012 01:33:17 timotheecour wrote:
I'd like to have something like:
---
import std.stdio:!writeln,write;
---
which would import all symbols from std.stdio except the ones
listed (writeln,write).
Use case:
The reason is to avoid writing verbose code (specifying all
I had never problems with that in C++.
If I have members which are const because they are assigned only
one time and needs no other assignment, why should I declare this
member not as const?
In the example I know exactly that I assign only one time a name
to this struct, so why I should not
On 09/10/2012 01:20 AM, timotheecour wrote:
I'd like to achieve the following:
import std.stdio,std.range,std.algorithm,std.array;
void main(){
auto dg=a=a*2;
auto a=iota(0,10);
writeln(a.map!dg.array);
}
but this doesn't compile:
Error: variable [...]dg type void is
On Monday, September 10, 2012 01:47:35 timotheecour wrote:
This works:
import std.stdio;
void main(){
writeln(std.conv.to!double(1));
}
This doesn't compile:
import std.stdio;
void main(){
std.stdio.writeln(std.conv.to!double(1));
}
=Error:
On Monday, September 10, 2012 01:52:52 timotheecour wrote:
Can we filter out compiler errors involving _error_ as template
parameter?
Clearly the error is coming from upstream so there's no need to
even show those.
eg:
Error: template mypackage.mymodule.myfunction cannot deduce
template
On 09/10/2012 01:52 AM, timotheecour wrote:
Can we filter out compiler errors involving _error_ as template parameter?
Clearly the error is coming from upstream so there's no need to even
show those.
eg:
Error: template mypackage.mymodule.myfunction cannot deduce template
function from argument
On 09/10/2012 01:47 AM, timotheecour wrote:
This works:
import std.stdio;
void main(){
writeln(std.conv.to!double(1));
}
This doesn't compile:
import std.stdio;
void main(){
std.stdio.writeln(std.conv.to!double(1));
}
=Error: undefined identifier std
So it seems
On 09/10/2012 02:14 AM, Jonathan M Davis wrote:
On Monday, September 10, 2012 01:52:52 timotheecour wrote:
Can we filter out compiler errors involving _error_ as template
parameter?
Clearly the error is coming from upstream so there's no need to
even show those.
eg:
Error: template
On Monday, September 10, 2012 02:05:08 Namespace wrote:
I had never problems with that in C++.
If I have members which are const because they are assigned only
one time and needs no other assignment, why should I declare this
member not as const?
In the example I know exactly that I assign
On Monday, September 10, 2012 02:16:19 Timon Gehr wrote:
Don has expressed the desire to weed those out completely.
If he can do it in a way that leaves in all of the necessary information, then
great, but you need to be able to know what the instantiation chain was.
- Jonathan M Davis
On a related note, it would be much clearer if the error messages
used fullyQualifiedName!T instead of just the type name T, as in
more complex code, there WILL be name clashes.
I would guess this would be easy to fix.
On Monday, 10 September 2012 at 00:30:54 UTC, Jonathan M Davis
wrote:
On
This is a quirk of DMD, not a language feature.
You can file the implicit import behaviour as a bug.
done:
http://d.puremagic.com/issues/show_bug.cgi?id=8636
timotheecour:
What was wrong with it and what would you suggest to improve it?
Nothing serious, I just suggest to give a bit more air to your
code, adding a space around operators, after commas, etc.
Otherwise your code risk looking like Timon's code ;-)
I have also compiled the code with
Samuele Carcagno:
I would like to find the indexes of all the elements of an
array matching a certain value. I could simply loop over all
the elements to do the job, but I was hoping for some ready
made function that also works across different types (ints,
floats etc...).
I have written
On Sunday, September 09, 2012 21:04:58 monarch_dodra wrote:
So I'll rephrase my 1):
Why the difference in behavior regarding the return value? Is it
just historical/no real reason, or is there something for me to
learn here?
Just look at the examples. You're supposed to be able to use enforce
On 09/10/2012 02:05 AM, Namespace wrote:
I had never problems with that in C++.
clang++ sez:
error: cannot define the implicit default assignment operator for 'S',
because non-static const member 'x' can't use default assignment operator
If I have members which are const because they are
Here's a modification to:
1) hide the intermediate struct (as usual in std.algorithm, I
forgot what this trick is called)
2) work with ranges, not just arrays (ie will work with iota, see
unittest)
3) accept input without in attribute;
4) accept arbitrary predicate, not just ==x
Please
When using __traits(allMembers), I'd like to be able to detect if
a given member is an alias (and get the member that is aliased).
Is there a way to do this currently?
On Monday, September 10, 2012 05:01:05 cal wrote:
__traits(allMembers), I'd like to be able to detect if
a given member is an alias (and get the member that is aliased).
Is there a way to do this currently?
No. As far as the compiler is concerned, there is no difference between an
alias and
On Monday, 10 September 2012 at 03:30:25 UTC, Jonathan M Davis
wrote:
On Monday, September 10, 2012 05:01:05 cal wrote:
__traits(allMembers), I'd like to be able to detect if a given
member is an alias (and get the member that is aliased). Is
there a way to do this currently?
No. As far as
On 09/08/2012 09:01 AM, Timon Gehr wrote:
On 09/08/2012 04:11 PM, Ellery Newcomer wrote:
alias enum int e;
It is valid according to the grammar
I don't believe you. Show me the derivation.
On 09-Sep-12 23:04, monarch_dodra wrote:
Given this little program testing regexs, I decided to replace one of
the example's assert with an enforce:
import std.regex;
import std.exception;
void main()
{
auto m = match(hello world, regex(world));
assert(m);
61 matches
Mail list logo