On 3/8/2015 3:55 PM, David Held wrote:
Since DDT (Eclipse plugin) uses Dub, I am trying to convert the DWT
build instructions into Dub. Here is my current attempt:
{
"name" : "foo",
"description" : "foo",
"importPaths" : [
Since DDT (Eclipse plugin) uses Dub, I am trying to convert the DWT
build instructions into Dub. Here is my current attempt:
{
"name" : "foo",
"description" : "foo",
"importPaths" : [ "d:/workspace/dwt/imp" ],
"stringImportPaths" : [
"D:/workspace/dwt/org.eclipse.swt.win32.win3
On 2/8/2015 4:09 PM, David Held wrote:
auto data = appender!(string[]);
...
data.put(someString);
[...]
Never mind. someString is actually the result of stdin.byLine(), which
returns a char[], not a string. I didn't notice this until just now.
.idup fixes this just
auto data = appender!(string[]);
...
data.put(someString);
source\colony.d(360): Error: template
std.array.Appender(string[]).Appender.put does not match any function
template declaration. Candidates are:
D:\D\dmd2\windows\bin\..\..\src\phobos\std\array.d(2251):
std.array.Appender!(st
On 11/29/2014 3:59 PM, Ali Çehreli wrote:
[...]
typeid() is a runtime function. I think it will be costly every time
toHash is called. The function pointer can be initialized once.
// I've "deduced" the type from an error message. ;)
static const ulong delegate(const(void*)) const pure
On 11/26/2014 4:40 PM, Ali Çehreli wrote:
[...]
override
size_t toHash() @trusted pure const nothrow
{
auto func = assumePure(&(typeid(importantStuff).getHash));
return func(&importantStuff);
}
Very helpful, thanks! Am I right in assuming that there is som
I have a class which contains an int[] and some other stuff. I want to
use my class as the key for an AA, so I am overriding toHash(). But the
int[] is the only part which should produce the hash code. I know that
int[].toHash() is defined somehow, because I can put int[] directly into
an AA
On 11/23/2014 3:12 PM, anonymous wrote:
[...]
And even pointer dereferencing is @safe. Invalid ones will fail
with a segfault at run time:
void foo(int* a) @safe {*a = 13;}
Hmm...throwing an exception is a well-defined behavior, but is
segfaulting a well-defined behavior of correct D programs?
On 5/17/2014 9:18 PM, David Held wrote:
How do I get an array from randomSample()?
int[] source = [ ... ];
int[] sample = randomSample(source, 3);
src\main.d(30): Error: cannot implicitly convert expression
(randomSample(source, 3u)) of type RandomSample!(int[], void) to int[]
[...]
Even
How do I get an array from randomSample()?
int[] source = [ ... ];
int[] sample = randomSample(source, 3);
src\main.d(30): Error: cannot implicitly convert expression
(randomSample(source, 3u)) of type RandomSample!(int[], void) to int[]
I get that RandomSample is a struct which implements th
import std.algorithm;
int toInt(char c) { return 1; }
void main()
{
map!(a => toInt(a))("hello");
}
Can someone please explain why I get this:
Bug.d(10): Error: function Bug.toInt (char c) is not callable using
argument types (dchar)
^^
On 4/29/2014 10:01 AM, Meta wrote:
On Tuesday, 29 April 2014 at 16:52:27 UTC, Ali Çehreli wrote:
[...]
int[] foo()
{
int[] a;
a ~= 42;// on memory owned by the GC
return a;
}
I didn't realize this was possible... I figured it was equivalent to
`null ~= 42` which I realize now i
On 4/27/2014 9:32 PM, Ali Çehreli wrote:
fOn 04/27/2014 06:00 PM, David Held wrote:
> I would like to do something like this:
>
> Foo[Bar][Baz] nestedAA;
> auto innerAA = nestedAA[someBaz];
> innerAA[someBar] = someFoo;
> assert(someFoo in nestedAA[someBaz]);
in operat
I would like to do something like this:
Foo[Bar][Baz] nestedAA;
auto innerAA = nestedAA[someBaz];
innerAA[someBar] = someFoo;
assert(someFoo in nestedAA[someBaz]);
Unfortunately, this does not do what I would like, because innerAA
appears to be a copy rather than a reference. Is there a nice w
On 4/19/2014 5:45 PM, Adam D. Ruppe wrote:
On Sunday, 20 April 2014 at 00:35:30 UTC, David Held wrote:
Since all implementations of an interface must derive from Object
That's not true. They can also come from IUnknown or a C++ interface.
Ok, that's a good reason!
cast(O
On 4/19/2014 3:31 PM, Andrej Mitrovic via Digitalmars-d-learn wrote:
[...]
struct S
{
int get() { return 0; }
T get(T)() { return T.init; }
}
void main()
{
S s;
float x = s.get(); // which overload? (currently int get())
}
Isn't this just because concrete methods are bett
On 4/19/2014 5:35 PM, David Held wrote:
interface Foo { }
class Bar : Foo
{
override string toString() pure const { return "Bar"; }
}
void main()
{
Foo foo = new Bar;
foo.toString();
}
To make things more interesting, consider the call to toString() from
inside a cl
interface Foo { }
class Bar : Foo
{
override string toString() pure const { return "Bar"; }
}
void main()
{
Foo foo = new Bar;
foo.toString();
}
src\Bug.d(14): Error: no property 'toString' for type 'Bug.Foo'
Since all implementations of an interface must derive from Object, why
c
On 2/4/2012 12:45 PM, Timon Gehr wrote:
[...]
Pure does not imply const in D.
[...]
I think this is a language defect:
struct Foo
{
int computed() pure { return x * y; }
int wrapper() const { return computed() + 5; }
int x;
int y;
}
void main()
{
}
src\Bug2.d(4): Error: muta
On 2/4/2012 2:04 PM, Era Scarecrow wrote:
[...]
struct X {
int i;
pure int squaredPlus(int x) {
return x*x + i
}
alias squaredPlus sqp;
}
X st(15);
writeln(st.sqp(0)); //15
int i1 = st.sqp(10); st.i++;
int i2 = st.sqp(10); st.i++;
int i3 = st.sqp(10)
On 12/28/2013 2:07 AM, FreeSlave wrote:
[...]
If you want to get result just now, then use 'array' function from
std.array module.
map!fun(range).array;
or
array(map!fun(range));
Syntactically compact and slightly better expression of intent, but much
less efficient than just calling reduce
On 12/28/2013 5:13 AM, Timon Gehr wrote:
[...]
I wouldn't call this an 'eager map'. It's a shallow wrapper around a
foreach loop.
The point being that foreach loops aren't composable.
Dave
On 12/27/2013 7:32 PM, Marco Leise wrote:> [...]
> Side effects and altering the input object itself makes me
> want to pull out my crucifix. You shall not have impurity in
> your functional style code!
Why not? There are many impure functional languages, and most
non-functional languages that
On 12/27/2013 5:46 PM, David Nadlinger wrote:
On Saturday, 28 December 2013 at 01:41:35 UTC, David Held wrote:
Can someone explain to me why map() is not equivalent to foreach in
the code above? From what I can tell, map() doesn't do anything at
all on objs, even though it is a perf
import std.algorithm;
import std.stdio;
import std.conv;
class Trivial
{
int sideEffect() { return n++; }
override string toString() pure { return to!string(n); }
int n;
}
void main()
{
Trivial[] objs = [ new Trivial ];
map!(o => o.sideEffect())(objs);
writeln(objs);
On 12/23/2013 4:12 PM, Charles Hixson wrote:
On 12/23/2013 12:39 PM, David Held wrote:
[...]
int mightUpdate(int& x)
{
...
return x;
}
{
...
a[mightUpdate(i)] = mightUpdate(i);
...
}
Is this also a bug? How would the compiler know whether to emit a
diagnostic for
On 12/21/2013 6:21 AM, bearophile wrote:
aldanor:
So should this considered a bug then and be filed?
I think so. I have a related EnhancementRequest open, but I have to
close it down or modify it...
Bye,
bearophile
int mightUpdate(int& x)
{
...
return x;
}
{
...
a[mightUpd
On 12/22/2013 9:22 PM, David Held wrote:
[...]
D:\workspace\...>dmd bug1.d
D:\D\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(35): Error: module
std.c.stdio import 'FHND_WCHAR' not found
D:\D\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(35): Error: module
std.c.stdio import
D:\workspace\...>dmd -v
DMD32 D Compiler v2.064
Copyright (c) 1999-2013 by Digital Mars written by Walter Bright
...
D:\workspace\...>type bug1.d
import std.stdio;
void main()
{
}
D:\workspace\...>dmd bug1.d
D:\D\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(35): Error: module
std.c.stdio impo
29 matches
Mail list logo