Now I am trying to learn how to build GUI apps in D. But I have
some troubles.
http://code.dlang.org/packages/tkd
1. I can't understand how to set window size in example on page
above. I looked at docs and found only how to create new window.
But here I do not see any procedure that create
Yeah, the docs navigation sucks
http://htmlpreview.github.io/?https://github.com/nomad-software/tkd/master/docs/tkd/tkdapplication.html
Rikki Cattermole:
Foo*[string] bar;
Foo v = *bar.grab(mykey);
Is this the setdefault of Python dicts? If this need is strong a
new function could be added to Phobos (or even druntime if you
want to reduce the number of hash computations).
Bye,
bearophile
// Assume bar is some associative array of type Foo[string]
Foo* value = key in bar;
if (!value) {
bar[key] = Foo.init;
value = bar[key];
}
This seems sub-optimal, given that in involves three hashes (two lookups
and one insertion). Is there a more efficient or cleaner way to do so?
For my regret I need example to understand how to work with шею
Could you show me at last passing fileToOpen to another instance?
On Wednesday, 18 February 2015 at 08:55:51 UTC, Tofu Ninja wrote:
When I compile my project in release dmd suddenly starts
complains about missing symbols that look like they are from
phobos.
Symbol Undefined
When I compile my project in release dmd suddenly starts
complains about missing symbols that look like they are from
phobos.
Symbol Undefined
_D3std9exception134__T12errnoEnforceTbVAyaa50_433a5c445c646d64325c77696e646f77735c62696e5c2e2e5cA7E6C89DF0A958C3336C905AF5DE
Any idea what is
On 02/17/2015 11:23 PM, Muahmmad Adel wrote:
I have searched online and I found no way for dividing D Module
between multiple files.
As always, documentation can be better. :) There is the relatively new
package module:
http://dlang.org/module.html#package-module
I'm developing an embedded DSL using CTFE. The DSL code is
translated into D code and mixin-ed into the D code of user's
application. In order to provide meaningful error messages the
DSL compiler always intercepts all errors in the DSL code and
reports them at compile-time using pragma(msg,
On 2/18/15 12:43 PM, Dmitri Makarov wrote:
I'm developing an embedded DSL using CTFE. The DSL code is translated
into D code and mixin-ed into the D code of user's application. In
order to provide meaningful error messages the DSL compiler always
intercepts all errors in the DSL code and
On Wed, 18 Feb 2015 18:13:58 +, ketmar wrote:
it doesn't really cost *that* much (especially if you'll
remember that DMD optimiser is far from... well, optimal ;-)
i mean that there are alot of other code that isn't optimal for speed, so
delegate call is rarely an issue.
signature.asc
ketmar wrote:
On Wed, 18 Feb 2015 19:09:50 +0300, Ivan Timokhin wrote:
Is there any way to pass a delegate that:
1. avoids indirect calls (like alias);
2. does not allocate (like scope delegate);
3. captures local variables?
i don't think that you can do it. but what is wrong with
On 2/18/15 11:09 AM, Ivan Timokhin wrote:
With dmd 2.066.1, this compiles:
void bar(scope int delegate() a) @nogc {}
void foo(int x) @nogc
{
bar(() = x);
}
but this doesn't:
void bar(alias a)() {}
void foo(int x) @nogc
{
bar!(() = x)();
}
Fails with
Error: function test.foo @nogc
I have a medium size daemon application that uses several
threads, libasync, and daemonize. On windows it runs correctly
with GC enabled, but on linux the GC causes a deadlock while
allocating memory.
Adding core.memory.GC.disable; to main causes the application to
work correctly (and quickly
On Wednesday, 18 February 2015 at 21:05:10 UTC, Byron Heads wrote:
On Wednesday, 18 February 2015 at 20:55:56 UTC, ketmar wrote:
On Wed, 18 Feb 2015 20:35:44 +, Byron Heads wrote:
On Wednesday, 18 February 2015 at 20:33:40 UTC, ketmar wrote:
On Wed, 18 Feb 2015 20:27:07 +, Byron
On Wednesday, 18 February 2015 at 21:21:11 UTC, Byron Heads wrote:
On Wednesday, 18 February 2015 at 21:05:10 UTC, Byron Heads
wrote:
On Wednesday, 18 February 2015 at 20:55:56 UTC, ketmar wrote:
On Wed, 18 Feb 2015 20:35:44 +, Byron Heads wrote:
On Wednesday, 18 February 2015 at
On Wednesday, 18 February 2015 at 20:33:40 UTC, ketmar wrote:
On Wed, 18 Feb 2015 20:27:07 +, Byron Heads wrote:
are you forking? ;-)
I am in the daemonize library
https://github.com/NCrashed/daemonize
On Wednesday, 18 February 2015 at 20:41:12 UTC, Dicebot wrote:
Any chance you are using gdm-3.12.x?
I was so mad when I have encountered this:
https://issues.dlang.org/show_bug.cgi?id=4890
Dont think so
$dpkg --get-selections | grep gdm doesn't return anything
also running via ssh
On Wed, 18 Feb 2015 20:27:07 +, Byron Heads wrote:
are you forking? ;-)
signature.asc
Description: PGP signature
Any chance you are using gdm-3.12.x?
I was so mad when I have encountered this:
https://issues.dlang.org/show_bug.cgi?id=4890
On Wed, 18 Feb 2015 20:35:44 +, Byron Heads wrote:
On Wednesday, 18 February 2015 at 20:33:40 UTC, ketmar wrote:
On Wed, 18 Feb 2015 20:27:07 +, Byron Heads wrote:
are you forking? ;-)
I am in the daemonize library
https://github.com/NCrashed/daemonize
can you drop that and
On Wednesday, 18 February 2015 at 07:34:13 UTC, Daniel Kozák
wrote:
On Wed, 18 Feb 2015 07:23:24 +
Muahmmad Adel via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
I have searched online and I found no way for dividing D
Module between multiple files.
You are not force
On Wed, 18 Feb 2015 20:35:44 +, Byron Heads wrote:
On Wednesday, 18 February 2015 at 20:33:40 UTC, ketmar wrote:
On Wed, 18 Feb 2015 20:27:07 +, Byron Heads wrote:
are you forking? ;-)
I am in the daemonize library
https://github.com/NCrashed/daemonize
p.s. and check if you
On Wednesday, 18 February 2015 at 20:55:56 UTC, ketmar wrote:
On Wed, 18 Feb 2015 20:35:44 +, Byron Heads wrote:
On Wednesday, 18 February 2015 at 20:33:40 UTC, ketmar wrote:
On Wed, 18 Feb 2015 20:27:07 +, Byron Heads wrote:
are you forking? ;-)
I am in the daemonize library
On 02/18/2015 10:39 PM, stewarth wrote:
This works under dmd 2066.1 but fails under dmd 2.067-b2.
I don't know whether it is a bug.
struct B {
A* a;
In any case, that must be immutable(A)*.
}
static immutable B[] someB = [{a:someA[0]}, {a:someA[1]}];
I want it to initialize at
Hi All,
This works under dmd 2066.1 but fails under dmd 2.067-b2.
---
struct A {
int val;
}
static immutable A[] someA = [{val:1}, {val:2}];
struct B {
A* a;
}
static immutable B[] someB = [{a:someA[0]}, {a:someA[1]}];
void main()
{
writefln(a:%s, someA);
writefln(b:%s,
With dmd 2.066.1, this compiles:
void bar(scope int delegate() a) @nogc {}
void foo(int x) @nogc
{
bar(() = x);
}
but this doesn't:
void bar(alias a)() {}
void foo(int x) @nogc
{
bar!(() = x)();
}
Fails with
Error: function test.foo @nogc function allocates a closure with the GC
Is
On Tuesday, 17 February 2015 at 19:46:09 UTC, Nordlöw wrote:
Superb! I'd like to see this getting into std.typecons.
Having this in the language will attract (more) Ada programmers
to D.
Should I do PR for std.typecons.[iI]ndexedBy?
I'm not familiar with Ada, and I don't immediately see
On Wednesday, 18 February 2015 at 13:59:43 UTC, Nordlöw wrote:
On Wednesday, 18 February 2015 at 13:53:17 UTC, Tobias Pankrath
wrote:
All the data members except distMap have reference semantics.
I thought AAs had reference semantics.
Me too, but the indeed have value semantics. See for
On Wednesday, 18 February 2015 at 14:07:01 UTC, Steven
Schveighoffer wrote:
But once initialized, it DOES have reference semantics:
string[int] x;
x[0] = zero;
auto y = x;
x[1] = one;
assert(x == y);
Ok, great! I always initialize distMap with firstNd in the
DijkstraWalk.this so that avoids
On Wednesday, 18 February 2015 at 14:07:01 UTC, Steven
Schveighoffer wrote:
An UNINITIALIZED AA has not yet been allocated, and so it's
reference is null.
What's reason for uninitialized AA not behaving in the same way
as arrays do?
On Wednesday, 18 February 2015 at 12:44:22 UTC, anonymous wrote:
Should I do PR for std.typecons.[iI]ndexedBy?
I'm not familiar with Ada, and I don't immediately see what
indexedBy is good for. So maybe gather some examples where it's
beneficial, before going for Phobos.
Ok, I have a use
On Wednesday, 18 February 2015 at 13:37:57 UTC, Nordlöw wrote:
I've written a Dijkstra-style graph traversal range at
https://github.com/nordlow/justd/blob/master/knet/traversal.d#L105
that needs to internally store the AA distance map in member
variable distMap.
1.
All the data members
On Wednesday, 18 February 2015 at 13:53:17 UTC, Tobias Pankrath
wrote:
All the data members except distMap have reference semantics.
I thought AAs had reference semantics.
Me too, but the indeed have value semantics. See for example:
unittest
{
string[int] x;
auto y = x;
x[0] =
On 2/18/15 8:59 AM, Nordlöw wrote:
On Wednesday, 18 February 2015 at 13:53:17 UTC, Tobias Pankrath wrote:
All the data members except distMap have reference semantics.
I thought AAs had reference semantics.
Me too, but the indeed have value semantics. See for example:
unittest
{
Having this in the language will attract (more) Ada programmers
to D.
“Having this or that will attract (XY)-programmers / magically
make D successful in niche Z” is an argument too weak for phobos
inclusion, IMO.
I've written a Dijkstra-style graph traversal range at
https://github.com/nordlow/justd/blob/master/knet/traversal.d#L105
that needs to internally store the AA distance map in member
variable distMap.
1.
All the data members except distMap have reference semantics.
Therefore I've made my
On Wednesday, 18 February 2015 at 15:22:47 UTC, John Colvin wrote:
doOtherStuff must be called before doStuff.
That'll never happen; B is still valid until after A is
destroyed, if they weren't on the heap you'd see doStuff goes
first too.
You should probably make a method to clean B up
On Wednesday, 18 February 2015 at 08:19:25 UTC, Suliman wrote:
Now I am trying to learn how to build GUI apps in D. But I have
some troubles.
Read the README file in the repository. Then fully read the
documentation inside the `docs` folder. Then there is an example
application in
On Wednesday, 18 February 2015 at 14:55:58 UTC, Tobias Pankrath
wrote:
It's the same with arrays.
Ahh, you're right. Thanks.
On Wednesday, 18 February 2015 at 14:38:24 UTC, Nordlöw wrote:
On Wednesday, 18 February 2015 at 14:07:01 UTC, Steven
Schveighoffer wrote:
An UNINITIALIZED AA has not yet been allocated, and so it's
reference is null.
What's reason for uninitialized AA not behaving in the same way
as arrays
On Wed, 18 Feb 2015 21:21:10 +, Byron Heads wrote:
My guess is this is going to be related to forking, going to see if I
can make a test case.
it's better to avoid forking at all. it's *very* hard to do forking
right, it's almost impossible to do it right even in single-threaded app,
and
At
https://github.com/nordlow/justd/blob/master/knet/association.d#L59
I'm constructing an array of ranges that are used further down in
the function contextOf.
The expression
nds.map!(nd = gr.dijkstraWalker(nd, ...)).array;
however triggers postblits for the range DijkstraWalker
On Wed, 18 Feb 2015 21:21:10 +, Byron Heads wrote:
p.s. if you really-really-really need to avoid shell scripts, you can
`exec` your program with STDIN, STDOUT and STDERR redirected to /dev/
null, passing some special argument to it. i.e. it shouldn't fork, just
exec itself again with added
On Wed, 18 Feb 2015 22:51:17 +, Nordlöw wrote:
Can this be avoided somehow?
i don't think so. you can use heap-allocated structs, of course, or maybe
`RefCounted!` can do the trick, but i not tried it.
signature.asc
Description: PGP signature
Does anyone know a good way to support versioned function
parameters? Say, in one version I want a variable to be a global
and in another I want it to be a parameter.
version(GlobalVersion)
{
int x;
void foo()
{
// A huge function that uses x
}
} else {
void
I'd write a foo_impl which always takes a parameter. Then do the
versioned foo() functions which just forward to it:
void foo_impl(int x) { long function using x here }
version(globals) {
int x;
void foo() {
foo_impl(x);
}
} else {
void foo(int x) { foo_impl(x); }
}
Minimal
On Wednesday, 18 February 2015 at 23:49:26 UTC, Adam D. Ruppe
wrote:
I'd write a foo_impl which always takes a parameter. Then do
the versioned foo() functions which just forward to it:
void foo_impl(int x) { long function using x here }
version(globals) {
int x;
void foo() {
On 02/18/2015 02:51 PM, Nordlöw wrote:
I'm guessing that move construction plays a key role here.
move() does avoid the post-blit but you get many destructions in return:
import std.stdio;
import std.algorithm;
import core.memory;
struct Graph
{}
struct DW
{
int i;
this(int i)
On Wednesday, 18 February 2015 at 10:47:50 UTC, John Colvin wrote:
On Wednesday, 18 February 2015 at 08:55:51 UTC, Tofu Ninja
wrote:
When I compile my project in release dmd suddenly starts
complains about missing symbols that look like they are from
phobos.
Symbol Undefined
50 matches
Mail list logo