On Saturday 19 September 2015 19:09, WhatMeWorry wrote:
> And a more open ended question. Is there a more elegant solution
> for the
> below function? Maybe a one-liner? I have a knack for making
> simple solutions
> complex :)
>
>
>
> // Calculate the number of components for openGL
On Saturday, 19 September 2015 at 10:33:12 UTC, tchaloupka wrote:
This bites me again:
import std.stdio;
interface ITest
{
void test();
void test2()
in { writeln("itest2"); }
void test3()
in { writeln("itest3"); }
void test4()
in { writeln("itest4");
On Sunday 20 September 2015 00:09, Random D user wrote:
> class Gui
> {
> enum MouseButton { Left = 0, Right };
>
> private:
>
> struct ClickPair
> {
> MouseButton button = MouseButton.Left;
> };
>
> struct ClickPair // Second struct ClickPair with the enum
What is simple way to wrap a string into strings?
Eg from:
I went for a walk and fell down a hole.
To (6 max width):
I went
for a
walk
and
fell
down a
hole.
On Sunday, 20 September 2015 at 00:22:17 UTC, Joel wrote:
What is simple way to wrap a string into strings?
Eg from:
I went for a walk and fell down a hole.
To (6 max width):
I went
for a
walk
and
fell
down a
hole.
http://dlang.org/phobos/std_string.html#.wrap
On Saturday, 19 September 2015 at 19:54:45 UTC, Adam D. Ruppe
wrote:
On Saturday, 19 September 2015 at 19:52:56 UTC, WhatMeWorry
wrote:
So I've got type and value of each member, but I want their
actual names?
http://dlang.org/phobos/std_traits.html#FieldNameTuple
You can also do something
On 09/19/2015 02:33 AM, OlaOst wrote:
> Here is a class with a templated opIndex method, and an attempt to
use it:
>
> class Test
> {
> int[] numbers = [1, 2, 3];
> string[] texts = ["a", "b", "c"];
>
> Type opIndex(Type)(int index)
> {
> static if (is(Type == int))
On Sun, Sep 20, 2015 at 05:21:03AM +, WhatMeWorry via Digitalmars-d-learn
wrote:
[...]
> Thanks. But now I have an even more fundamental problem. I keep
> getting a FieldNameTuple is not defined. But I've clearly got the
> import statement. I even copied the example from Phobos verbatim:
On 09/19/2015 10:21 PM, WhatMeWorry wrote:
On Saturday, 19 September 2015 at 19:54:45 UTC, Adam D. Ruppe wrote:
On Saturday, 19 September 2015 at 19:52:56 UTC, WhatMeWorry wrote:
So I've got type and value of each member, but I want their actual
names?
On 09/19/2015 10:30 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Sun, Sep 20, 2015 at 05:21:03AM +, WhatMeWorry via Digitalmars-d-learn
wrote:
[...]
Thanks. But now I have an even more fundamental problem. I keep
getting a FieldNameTuple is not defined. But I've clearly got the
I went through these two links and found that this behaviour is
undefined , but the only issue which I have is that in one sense
we say that since local variables live on stack , hence they
cannot be located on read only memory region but if this is so
then if I try to alter the value of the
On Saturday, 19 September 2015 at 17:42:50 UTC, uNknow123 wrote:
On Saturday, 19 September 2015 at 15:09:38 UTC, WhatMeWorry
wrote:
On Saturday, 19 September 2015 at 13:41:03 UTC, uNknow123
wrote:
Hi! I'll like to learn D Lang. I knew some Pawn, it is pretty
similar, but not so similar, if you
On Saturday, 19 September 2015 at 19:52:56 UTC, WhatMeWorry wrote:
So I've got type and value of each member, but I want their
actual names?
http://dlang.org/phobos/std_traits.html#FieldNameTuple
You can also do something like `foo.tupleof[idx]["foo.".length ..
$]` for an individual thing
given some struct:
writeln("face.glyph.bitmap = ", face.glyph.bitmap);
which displays the following:
face.glyph.bitmap = FT_Bitmap(30, 25, 25, 4105948, 256, 2, 0,
null)
Is there a way for D to display the variable names within the
FT_Bitmap?
For instance, the following code snippet
On Saturday, 19 September 2015 at 07:25:58 UTC, ponce wrote:
On Friday, 18 September 2015 at 22:54:43 UTC, Random D user
wrote:
So I tried to build my project in release for the first time
in a long while. It takes like 25x longer to compile and
finally the compiler crashes. It seems to go
On Sunday, 20 September 2015 at 00:22:17 UTC, Joel wrote:
What is simple way to wrap a string into strings?
Eg from:
I went for a walk and fell down a hole.
To (6 max width):
I went
for a
walk
and
fell
down a
hole.
a common method works as follows. first you split your string
into chunks
On Sunday, 20 September 2015 at 00:22:17 UTC, Joel wrote:
What is simple way to wrap a string into strings?
Eg from:
I went for a walk and fell down a hole.
To (6 max width):
I went
for a
walk
and
fell
down a
hole.
Actually, I did a search and found this. import std.string.wrap;
Here's my code:
https://drive.google.com/file/d/0B3LYxKGJ4ZI_MV91SkxPVVlSOW8/view?usp=sharing
I don't have access to a debugger.
Run the code for a few minutes and it tends to crash with a core
OutOfMemoryError.
Any suggestions welcome including regularly cleaning up memory
used.
Thanks.
On Sunday, 20 September 2015 at 00:28:23 UTC, Doxin wrote:
I'll get to work on some example code.
here you go: http://dpaste.dzfl.pl/e6e715c54c1b
do mind that this code has a couple issues, for example handing
it a word longer than the break width will make it loop
infinitely.
word wrap
On Saturday, 19 September 2015 at 21:48:25 UTC, Random D user
wrote:
Assertion failure: 'type->ty != Tstruct || ((TypeStruct
*)type)->sym == this' on line 957 in file 'struct.c'
Ok managed to reduce this one to my own copy paste bug. This is
invalid code, but compiler shouldn't crash...
I'm
On Sunday, 20 September 2015 at 00:09:52 UTC, RADHA GOGIA wrote:
I went through these two links and found that this behaviour is
undefined , but the only issue which I have is that in one
sense we say that since local variables live on stack , hence
they cannot be located on read only memory
On Saturday, 19 September 2015 at 17:18:23 UTC, Daniel Kozak
wrote:
WhatMeWorry píše v So 19. 09. 2015 v 17:09 +:
[...]
http://dlang.org/expression.html#IsExpression
3. is ( Type == TypeSpecialization )
import std.stdio;
struct S
{
}
class C
{
}
void f(T)(T someStruct) if (is (T ==
On Saturday, 19 September 2015 at 15:01:06 UTC, WhatMeWorry wrote:
Sorry, meant to get back but got busy. Yes, works great!
Thanks!
Not sure why I had so much trouble finding a freetype.dll
library. Had no problems with OpenAL and FreeImage.
I'm curious how you compiled the DLL that
On Saturday, 19 September 2015 at 12:50:51 UTC, Pierre wrote:
Hi everybody,
I would like to extract key and value type from AA.
You can also do it with built-in syntax:
template AATypes(AA : K[V], K, V)
{
alias Key = K;
alias Value = V;
}
On Saturday, 19 September 2015 at 17:41:39 UTC, Laeeth Isharc
wrote:
On Saturday, 19 September 2015 at 10:45:22 UTC, Russel Winder
wrote:
Calling D from Python. I have two functions in D, compiled to
a shared object on Linux using LDC (but I get same problem
using DMD).
The sequential code:
On Friday, 18 September 2015 at 22:54:43 UTC, Random D user wrote:
So I tried to build my project in release for the first time in
a long while. It takes like 25x longer to compile and finally
the compiler crashes. It seems to go away if I disable the
optimizer.
I get:
tym = x1d
Internal
On Friday, 18 September 2015 at 22:54:43 UTC, Random D user wrote:
So I tried to build my project in release for the first time in
a long while. It takes like 25x longer to compile and finally
the compiler crashes. It seems to go away if I disable the
optimizer.
I get:
tym = x1d
Internal
On Saturday, 19 September 2015 at 03:53:12 UTC, Enjoys Math wrote:
I know there's fmax for floats, but what about ints?
Thanks.
http://p0nce.github.io/d-idioms/#Minimum-or-maximum-of-numbers
On Saturday, 19 September 2015 at 01:54:08 UTC, Joel wrote:
I accidentally wiped off a small source file. I've been trying
to put it back together. Now I get unrelated errors. I've tried
resetting dub.
To reset DUB state completely:
- remove .dub/ directory in the project directory
-
On Saturday, 19 September 2015 at 07:24:01 UTC, ponce wrote:
On Saturday, 19 September 2015 at 01:54:08 UTC, Joel wrote:
I accidentally wiped off a small source file. I've been trying
to put it back together. Now I get unrelated errors. I've
tried resetting dub.
To reset DUB state
On 2015-09-18 17:45, Jakob Ovrum wrote:
That's `export`.
Right, my bad. D has too many attributes :)
--
/Jacob Carlborg
On Saturday, 19 September 2015 at 08:33:05 UTC, Joel wrote:
On Saturday, 19 September 2015 at 07:24:01 UTC, ponce wrote:
On Saturday, 19 September 2015 at 01:54:08 UTC, Joel wrote:
I accidentally wiped off a small source file. I've been
trying to put it back together. Now I get unrelated
Calling D from Python. I have two functions in D, compiled to a shared
object on Linux using LDC (but I get same problem using DMD).
The sequential code:
extern(C)
double sequential(const int n, const double delta) {
Runtime.initialize();
const pi = 4.0 * delta * reduce!(
On Saturday, 19 September 2015 at 10:45:22 UTC, Russel Winder
wrote:
Calling D from Python. I have two functions in D, compiled to a
shared object on Linux using LDC (but I get same problem using
DMD).
[...]
I heard it crashed during the talk. Bummer. I should really be
there, seeing as I
On Saturday, 19 September 2015 at 09:33:02 UTC, OlaOst wrote:
Here is a class with a templated opIndex method, and an attempt
to use it:
class Test
{
int[] numbers = [1, 2, 3];
string[] texts = ["a", "b", "c"];
Type opIndex(Type)(int index)
{
On Saturday, 19 September 2015 at 12:50:51 UTC, Pierre wrote:
So how can I get types without instance ?
Thanks for help.
-->8-
template AATypes(T)
{
// todo: static assert if T is no AA type here
alias ArrayElementType!(typeof(T.init.keys)) key;
alias
Here is a class with a templated opIndex method, and an attempt
to use it:
class Test
{
int[] numbers = [1, 2, 3];
string[] texts = ["a", "b", "c"];
Type opIndex(Type)(int index)
{
static if (is(Type == int))
This bites me again:
import std.stdio;
interface ITest
{
void test();
void test2()
in { writeln("itest2"); }
void test3()
in { writeln("itest3"); }
void test4()
in { writeln("itest4"); assert(false); }
}
class Test: ITest
{
void test()
in {
On Saturday, 19 September 2015 at 10:45:22 UTC, Russel Winder
wrote:
Calling D from Python. I have two functions in D, compiled to a
shared object on Linux using LDC (but I get same problem using
DMD).
The sequential code:
extern(C)
double sequential(const int n, const double delta)
Hi everybody,
I would like to extract key and value type from AA.
I found this answer on forum :
template AATypes(T)
{
// todo: static assert if T is no AA type here
alias ArrayElementType!(typeof(T.keys)) key;
alias ArrayElementType!(typeof(T.values)) value;
}
But compiler failed,I
Hi! I'll like to learn D Lang. I knew some Pawn, it is pretty
similar, but not so similar, if you understan me. In Pawn we have
to write just some words, and the Plugin is done, why Plugin,
'cuse Pawn = Scripting for Cs 1.6 and Sa:Mp. So, I am a rookie,
can you help me please?
On Saturday, 19 September 2015 at 10:16:58 UTC, John Colvin wrote:
On Saturday, 19 September 2015 at 09:33:02 UTC, OlaOst wrote:
[...]
2 approaches:
1) use a function instead. E.g. test.get!int(0); isn't too bad
2) If you really want to use [], do something like this:
[...]
Thanks, option
And this:
class TestInt: Test {
alias opIndex = super.opIndex!int;
}
class TestString: Test {
alias opIndex = super.opIndex!string;
}
And this?
auto ref qua(T)(Test t){
struct wrap {
Test t;
T opIndex(int i){ return t.opIndex!T(i); }
}
return wrap(t);
}
void main()
{
auto test = new Test();
writeln(test.qua!string[0], test.qua!int[0]);
}
On Friday, 18 September 2015 at 16:34:16 UTC, BBasile wrote:
On Friday, 18 September 2015 at 00:13:41 UTC, BBasile wrote:
On Thursday, 17 September 2015 at 22:22:22 UTC, WhatMeWorry
wrote:
[...]
After hours of reading existing freetype/derelict documents,
I'm stuck again.
Any suggestions.
On Saturday, 19 September 2015 at 13:41:03 UTC, uNknow123 wrote:
Hi! I'll like to learn D Lang. I knew some Pawn, it is pretty
similar, but not so similar, if you understan me. In Pawn we
have to write just some words, and the Plugin is done, why
Plugin, 'cuse Pawn = Scripting for Cs 1.6 and
On Saturday, 19 September 2015 at 12:52:19 UTC, ponce wrote:
On Saturday, 19 September 2015 at 12:50:51 UTC, Pierre wrote:
So how can I get types without instance ?
Thanks for help.
-->8-
template AATypes(T)
{
// todo: static assert if T is no AA type here
alias
WhatMeWorry píše v So 19. 09. 2015 v 17:09 +:
> Does D provide complete template constraint granularity?
>
> In other words, I want to only accept structs in the template
> below.
> I've find the isAggregateType which is close but no cigar. Am I
> missing
> some other filters?
>
> And a
On Saturday, 19 September 2015 at 02:45:54 UTC, Adam D. Ruppe
wrote:
On Saturday, 19 September 2015 at 02:30:39 UTC, Chris wrote:
bmove.addOnClicked (delegate void (Button aux) {
What's the context of this call? If it is inside a struct and
you are accessing local
Update:
If I add *also* a auto vec2 = vec; now the code works. So it
looks like this now:
voxel_vec [string] move_buttons = [
"button_xp" : voxel_vec ([ 1, 0, 0 ]),
"button_xm" : voxel_vec ([ -1, 0, 0 ]),
On Saturday, 19 September 2015 at 15:09:38 UTC, WhatMeWorry wrote:
On Saturday, 19 September 2015 at 13:41:03 UTC, uNknow123 wrote:
Hi! I'll like to learn D Lang. I knew some Pawn, it is pretty
similar, but not so similar, if you understan me. In Pawn we
have to write just some words, and the
On Saturday, 19 September 2015 at 10:45:22 UTC, Russel Winder
wrote:
Calling D from Python. I have two functions in D, compiled to a
shared object on Linux using LDC (but I get same problem using
DMD).
The sequential code:
extern(C)
double sequential(const int n, const double delta)
On Sunday, 20 September 2015 at 00:48:39 UTC, Doxin wrote:
On Sunday, 20 September 2015 at 00:28:23 UTC, Doxin wrote:
I'll get to work on some example code.
here you go: http://dpaste.dzfl.pl/e6e715c54c1b
do mind that this code has a couple issues, for example handing
it a word longer than
On Sat, 2015-09-19 at 12:21 +, ponce via Digitalmars-d-learn wrote:
> […]
>
> Try using an explicit TaskPool and destroying it with scope(exit).
>
>
> Also if using LDC, you can use global ctor/dtor to deal with the
> runtime.
>
>
> --->8-
>
>
On Sat, 2015-09-19 at 15:58 +, ponce via Digitalmars-d-learn wrote:
> On Saturday, 19 September 2015 at 15:42:15 UTC, Russel Winder
> wrote:
> >
> > Hummm… I now do not get a segfault, and the code runs as
> > expected :
> > -) but the program never terminates. :-(
>
> Where is it
On Sat, 2015-09-19 at 11:07 +, John Colvin via Digitalmars-d-learn
wrote:
>
[…]
> I heard it crashed during the talk. Bummer. I should really be
> there, seeing as I live about 15 mins away. If you get a chance
> to talk to Alex Bishop, don't be too harsh on D to him, I'm
> trying to
On Saturday, 19 September 2015 at 16:25:28 UTC, Laeeth Isharc
wrote:
On Saturday, 19 September 2015 at 12:21:02 UTC, ponce wrote:
[...]
What is the difference between shared static this and the
global constructor ? Russell, if you use shared static this
for dmd does it work ? Laeeth.
On Sat, 2015-09-19 at 17:15 +0100, Russel Winder wrote:
>
[…]
> Sadly the:
>
> pragma(LDC_global_crt_ctor, 0)
> void initRuntime() {
> import core.runtime: Runtime;
> Runtime.initialize();
>}
>
> will not compile under DMD :-(
On the otherhand using a:
version(LDC) {
On Saturday, 19 September 2015 at 16:15:45 UTC, Russel Winder
wrote:
Sadly the:
pragma(LDC_global_crt_ctor, 0)
void initRuntime() {
import core.runtime: Runtime;
Runtime.initialize();
}
will not compile under DMD :-(
version(LDC){ /* ... */ }
not that it helps make
On Sat, 2015-09-19 at 16:33 +, John Colvin via Digitalmars-d-learn
wrote:
> On Saturday, 19 September 2015 at 16:15:45 UTC, Russel Winder
> wrote:
> > Sadly the:
> >
> > pragma(LDC_global_crt_ctor, 0)
> > void initRuntime() {
> > import core.runtime: Runtime;
> >
On Saturday, 19 September 2015 at 16:32:18 UTC, Russel Winder
wrote:
(*) ponce is arguably not the most positive or constructive
name to go
by.
Friend call me like this IRL since forever.
It seems to be a swear word in english?
On Saturday, 19 September 2015 at 16:34:05 UTC, John Colvin wrote:
On Saturday, 19 September 2015 at 16:25:28 UTC, Laeeth Isharc
wrote:
On Saturday, 19 September 2015 at 12:21:02 UTC, ponce wrote:
[...]
What is the difference between shared static this and the
global constructor ? Russell,
On Saturday, 19 September 2015 at 15:42:15 UTC, Russel Winder
wrote:
Hummm… I now do not get a segfault, and the code runs as
expected :
-) but the program never terminates. :-(
Where is it stuck?
Also, what would I need to cover the DMD and the GDC situations?
I don't know. :(
On Saturday, 19 September 2015 at 12:21:02 UTC, ponce wrote:
On Saturday, 19 September 2015 at 10:45:22 UTC, Russel Winder
wrote:
Calling D from Python. I have two functions in D, compiled to
a shared object on Linux using LDC (but I get same problem
using DMD).
The sequential code:
On Saturday, 19 September 2015 at 16:25:28 UTC, Laeeth Isharc
wrote:
What is the difference between shared static this and the
global constructor ? Russell, if you use shared static this
for dmd does it work ? Laeeth.
Would like to know too. On OSX I've found that shared static
this()
On Sat, 2015-09-19 at 16:25 +, Laeeth Isharc via Digitalmars-d
-learn wrote:
>
[…]
> What is the difference between shared static this and the global
> constructor ? Russell, if you use shared static this for dmd
> does it work ? Laeeth.
I had no idea what to put in a:
shared static
On Sat, 2015-09-19 at 16:41 +, ponce via Digitalmars-d-learn wrote:
>
[…]
> Friend call me like this IRL since forever.
>
> It seems to be a swear word in english?
English and Spanish meanings of the word are very different. In UK (not
sure about Canada, USA, Australia, New Zealand, South
Does D provide complete template constraint granularity?
In other words, I want to only accept structs in the template
below.
I've find the isAggregateType which is close but no cigar. Am I
missing
some other filters?
And a more open ended question. Is there a more elegant solution
for
68 matches
Mail list logo