Jonathan M Davis:
> They're both based on C++ (though C# is also heavily based on Java which is
> based on C++). D probably does take some features from C# (such as
> delegates),
> but D has taken features from a number of different languages. I doubt that
> anything in C# is based on anything
On 12/13/10, Matthias Walter wrote:
> On 12/12/2010 08:43 PM, Andrej M. wrote:
>> I can't seem to find an easy remove method in std.algorithm that takes an
>> object and a range (an array in this case) and removes any matches from
>> the range. I'm using this snippet for now:
>>
>> private Drawing
On 12/12/2010 08:43 PM, Andrej M. wrote:
> I can't seem to find an easy remove method in std.algorithm that takes an
> object and a range (an array in this case) and removes any matches from the
> range. I'm using this snippet for now:
>
> private DrawingElement[] elements;
>
> public override vo
On Sunday 12 December 2010 18:35:38 Andrej Mitrovic wrote:
> On a side note I have to admit I've never programmed in C# before, but
> I don't seem to have much trouble understanding it. From the looks of
> it, the two languages borrow a lot from each other, and have very
> similar syntax.
They're
On a side note I have to admit I've never programmed in C# before, but
I don't seem to have much trouble understanding it. From the looks of
it, the two languages borrow a lot from each other, and have very
similar syntax.
On 12/13/10, Andrej Mitrovic wrote:
> On 12/13/10, Jonathan M Davis wrote
On 12/13/10, Jonathan M Davis wrote:
> I created an enhancement request for it: http://is.gd/iDSqj
>
> - Jonathan M Davis
>
Thanks!
On Sunday 12 December 2010 17:43:12 Andrej M. wrote:
> I can't seem to find an easy remove method in std.algorithm that takes an
> object and a range (an array in this case) and removes any matches from
> the range. I'm using this snippet for now:
>
> private DrawingElement[] elements;
>
> public
I can't seem to find an easy remove method in std.algorithm that takes an
object and a range (an array in this case) and removes any matches from the
range. I'm using this snippet for now:
private DrawingElement[] elements;
public override void Remove(DrawingElement d)
{
foreach (i, child;
spir wrote:
(1) In my case, I do not want to modify the range (actually the private
collection), because the type is not only about beeing a range (~
provide iteration). So that I defined the range methods, using a private
'rangeIndex slot', as (the type also maintains a 'length' slot):
On Sun, 12 Dec 2010 21:15:00 +0100
"Simen kjaeraas" wrote:
> The trick to ranges is that they modify themselves. For a simple array
> wrapper
> range this may be a way:
>
> struct wrapper( T ) {
> T[] data;
> void popFront( ) {
> data = data[1..$];
> }
> ref T fron
On Sunday 12 December 2010 12:15:00 Simen kjaeraas wrote:
> spir wrote:
> > Hello,
> >
> > Had a nice time figuring out how to let opApply allow index iteration
> >
> > like:
> > foreach (i, x ; collection) {}
> >
> > Finally managed to do it adding 'i' everywhere:
> >
> > struct S1 {
> >
On Sun, 12 Dec 2010 22:36:03 +0300, Nick Voronin wrote:
pointsTo() tries to check every member of anonymous union inside struct.
alias this makes a passable workaround though. (I hope) :)
union U
{
int i;
string s;
}
struct S3
{
int type;
U u;
alias
spir wrote:
Hello,
Had a nice time figuring out how to let opApply allow index iteration
like:
foreach (i, x ; collection) {}
Finally managed to do it adding 'i' everywhere:
struct S1 {
private int[] elements = [];
int opApply (int delegate (ref uint, ref int) block) {
spir wrote:
PS: Also tried to make iteration work by defining slice "with no
argument" (coll[]) only, like indicated in TDPL p.381. But could not
manage to do it.
The point of coll[] is that a collection may not want to define the
range primitives itself, but rather expose a special range
On Sun, 12 Dec 2010 20:47:04 +0100
spir wrote:
> Hello,
>
> Had a nice time figuring out how to let opApply allow index iteration like:
> foreach (i, x ; collection) {}
> Finally managed to do it adding 'i' everywhere:
>
> struct S1 {
> private int[] elements = [];
> int opApply (in
Hello,
Had a nice time figuring out how to let opApply allow index iteration like:
foreach (i, x ; collection) {}
Finally managed to do it adding 'i' everywhere:
struct S1 {
private int[] elements = [];
int opApply (int delegate (ref uint, ref int) block) {
foreach (uint i, in
pointsTo() tries to check every member of anonymous union inside struct.
import std.exception;
union U
{
int i;
string s;
}
struct S1
{
int type;
U u;
}
struct S2
{
int type;
union {
int i;
string s;
}
}
v
On Sunday 12 December 2010 08:03:57 Simen kjaeraas wrote:
> Eyyub wrote:
> > I recently upgraded to the D 2, and i would like understand for which
> > reason they are the immutable keyword !
>
> immutable means 'this data cannot change'. It is different from const in
> that the latter means 'I ca
On Sunday 12 December 2010 05:55:11 Johannes Pfau wrote:
> Hmm, next problem with safe D.
>
> unittest
> {
> @safe int tf(int i){return i;}
> bool a = isSafe!(tf);
> assert(a == true);
> static assert(isSafe!(tf));
> static assert(isSafe!(typeof(&tf)));
> }
>
> All three
I think this might have been reported:
http://d.puremagic.com/issues/show_bug.cgi?id=3474
On 12/12/10, spir wrote:
> Hello,
>
> Test case:
>
> struct S {
> int[] ints;
> int opDollar () {return this.ints.length;}
> int opIndex (int i) {return this.ints[i];}
> int[] opSlice (int i
Hello,
Test case:
struct S {
int[] ints;
int opDollar () {return this.ints.length;}
int opIndex (int i) {return this.ints[i];}
int[] opSlice (int i, int j) {return this.ints[i..j];}
}
unittest {
S s = S([3,2,1]);
// _link_ error on each line:
// Error: undefined ident
But that idea would not work in APIs like JDBC for example (something
i was trying to immitate partly). PreparedStatement has method
setInt(int, int) while CallableStatement has method
setInt(string,int).
It is not possible to compile CallableStatement.setInt(int,int)
without casting or putting in
Tom Wrote:
> Does D2 have something to check XML against XSD schemas?
No.
Eyyub wrote:
I recently upgraded to the D 2, and i would like understand for which
reason they are the immutable keyword !
immutable means 'this data cannot change'. It is different from const in
that the latter means 'I cannot change this data (but someone else may
change it from under my f
I recently upgraded to the D 2, and i would like understand for which reason
they are the immutable keyword !
Thx
Hmm, next problem with safe D.
unittest
{
@safe int tf(int i){return i;}
bool a = isSafe!(tf);
assert(a == true);
static assert(isSafe!(tf));
static assert(isSafe!(typeof(&tf)));
}
All three asserts fail! Even the example from std.traits doesn't work for
me, isSafe always r
Am 11.12.2010, 19:33 Uhr, schrieb bearophile :
Johannes Pfau:
Is there something like Unqual that can remove the safety attributes
from
a type?
In such cases we have to ask what's your use case/purpose. Isn't
@trusted enough?
Bye,
bearophile
Well, for my signal implementation (Latest
Mandeep Singh Brar wrote:
> I just posted a bug on the bugs list about problems in compiling the
> following code using dmd, but realized that there might be some
> inheritance feature that i might now be aware of. Can you please let me
> know if i am missing something in the below code.
>
> impo
"Christopher Nicholson-Sauls" wrote in message
news:ie28aa$18b...@digitalmars.com...
> This
> surprises me, and certainly has to be a bug.
>
http://d.puremagic.com/issues/show_bug.cgi?id=3797
I just posted a bug on the bugs list about problems in compiling the following
code using dmd, but realized
that there might be some inheritance feature that i might now be aware of. Can
you please let me know if i
am missing something in the below code.
import std.stdio;
interface A {
p
On 12/12/10 03:54, Nrgyzer wrote:
> Hey guys,
>
> I've used D1 in the past and D1 seems to check for correct function
> pointers. In D2 I can pass any function pointer to an function, for
> example:
>
> ...
> void example(void function(int, int) fp) {
> ...
> }
>
> ...
> void callback1(int x, in
Hey guys,
I've used D1 in the past and D1 seems to check for correct function
pointers. In D2 I can pass any function pointer to an function, for
example:
...
void example(void function(int, int) fp) {
...
}
...
void callback1(int x, int y) {
}
void callback2() {
}
...
example(&callback1); // W
32 matches
Mail list logo