Re: How to correctly generate enums at compile time.

2017-04-30 Thread jkpl via Digitalmars-d-learn

On Sunday, 30 April 2017 at 22:03:02 UTC, Kevin Balbas wrote:

On Sunday, 30 April 2017 at 21:31:22 UTC, jkpl wrote:

On Sunday, 30 April 2017 at 21:13:07 UTC, Kevin Balbas wrote:

On Sunday, 30 April 2017 at 20:58:36 UTC, jkpl wrote:

On Sunday, 30 April 2017 at 20:05:59 UTC, Kevin Balbas wrote:

Strangely enough, it does work fine in the test snippet,

[...]
My actual project uses dub/visuald for building, so I don't 
really tinker with file ordering.  Is this a thing that's 
supposed to happen?


Hell no !


Re: How to correctly generate enums at compile time.

2017-04-30 Thread jkpl via Digitalmars-d-learn

On Sunday, 30 April 2017 at 21:13:07 UTC, Kevin Balbas wrote:

On Sunday, 30 April 2017 at 20:58:36 UTC, jkpl wrote:

On Sunday, 30 April 2017 at 20:05:59 UTC, Kevin Balbas wrote:

Strangely enough, it does work fine in the test snippet,


As well if you import the snippet in another module. That's what 
i tried to tell.

try to reduce step by step; The problem cant be the stuff you mix.




Re: How to correctly generate enums at compile time.

2017-04-30 Thread jkpl via Digitalmars-d-learn

On Sunday, 30 April 2017 at 20:05:59 UTC, Kevin Balbas wrote:
I've got the following code snippet, which almost does what I 
want.


struct TaggedType {}

@TaggedType
struct Foo {}

@TaggedType
struct Bar {}

string GenerateTypeEnum()
{
string enumString = "enum TypeEnum {";
foreach (name; __traits(allMembers, mixin(__MODULE__)))
{
import std.traits;
static if (hasUDA!(mixin(name), TaggedType))
{
enumString ~= name;
enumString ~= "Type,";
}
}
enumString ~= "}";
return enumString;
}

// generates enum TypeEnum {FooType,BarType,}
mixin(GenerateTypeEnum());

This works great, except that TypeEnum isn't accessible from 
other modules (undefined identifier 'TypeEnum'), which is kind 
of the point of doing this (I'm using the enum as a system-wide 
tag for inter-thread communication).  I can imagine why this 
would be the case, but it's a pretty serious problem.  Is there 
a way to do this?


if i put your sniped in b.d and import in a.d b then i'm able to 
access TypeEnum.
You r problem must be something stupid that's not related to 
UDA/mixins.


That leads to this question (sorry) but at least do you import 
the module that contains TypeEnum ?


Re: Factory using an alias template parameter to set a member of the new tool ?

2017-02-09 Thread jkpl via Digitalmars-d-learn

On Thursday, 9 February 2017 at 15:00:21 UTC, angel wrote:

On Thursday, 9 February 2017 at 14:39:41 UTC, angel wrote:

On Thursday, 9 February 2017 at 13:30:07 UTC, jkpl wrote:

I'm looking for a better way to do this, if possible:


Or actually, maybe this will suite your case better:
```
template namedTool(T, alias Variable)
{
enum namedTool = T.stringof ~ " " ~ Variable ~ " = new " ~ 
T.stringof ~ ";" ~

 Variable ~ ".name = \"" ~ Variable ~ "\";";
}

void main()
{
mixin(namedTool!(Tool, "grep"));
assert(grep.name == "grep");
}
```


Thanks for trying. I know that it doesn't make much sense but it 
would have been a cool sugar for the tool class.


Mixins are not good for me because of completion in the IDE.


Factory using an alias template parameter to set a member of the new tool ?

2017-02-09 Thread jkpl via Digitalmars-d-learn

I'm looking for a better way to do this, if possible:

```
class Tool
{
string name;
}

T namedTool(alias Variable, T)()
{
T result = new T;
result.name = Variable.stringof;
return result;
}

void main()
{
Tool grep;
grep = namedTool!(grep,Tool);
assert(grep.name == "grep");
}
```

Ideally this would work like this:

```
Tool grep = namedTool!Tool;
assert(grep.name == "grep");
```

Possible ?


Re: Static array size?

2017-02-09 Thread jkpl via Digitalmars-d-learn

On Thursday, 9 February 2017 at 12:16:26 UTC, jkpl wrote:

On Thursday, 9 February 2017 at 11:22:28 UTC, Suliman wrote:

Docs says that:
"The total size of a static array cannot exceed 16Mb."
But when I am creation array of:
int [1000_000] x; // 1000_000 is equal ~ 0,95MB
app crush on start.

Should it's reserve this memory with guaranty? I mean that 
after app start it should take +0.95MB of RAM in task manager.


multiply by 4


Also static array is not on the heap so take care to which column 
of the task manager you monitor.


Re: Static array size?

2017-02-09 Thread jkpl via Digitalmars-d-learn

On Thursday, 9 February 2017 at 11:22:28 UTC, Suliman wrote:

Docs says that:
"The total size of a static array cannot exceed 16Mb."
But when I am creation array of:
int [1000_000] x; // 1000_000 is equal ~ 0,95MB
app crush on start.

Should it's reserve this memory with guaranty? I mean that 
after app start it should take +0.95MB of RAM in task manager.


multiply by 4


Re: Seemingly patternless optlink premature termination

2017-01-08 Thread jkpl via Digitalmars-d

On Sunday, 8 January 2017 at 19:15:49 UTC, Jerry wrote:

On Sunday, 8 January 2017 at 18:49:50 UTC, Walter Bright wrote:
P.S. Isn't it maddening that Windows doesn't allow copying the 
data from a message window?


A bit more maddening that D is still trying to support optlink, 
a linker that hasn't seen a commit in 2 years when it is hardly 
bug free.


Your comment is not pertinent. The object format doesn't change 
so the linker doesn't need to be updated. The problem here seems 
to be a bug. Until someone finds it, it can't be fixed.


Re: Seemingly patternless optlink premature termination

2017-01-08 Thread jkpl via Digitalmars-d

On Sunday, 8 January 2017 at 18:49:50 UTC, Walter Bright wrote:
P.S. Isn't it maddening that Windows doesn't allow copying the 
data from a message window?


Not really, because you can, Ctrl+C...


Re: Project Highlight: Voxelman

2016-12-31 Thread jkpl via Digitalmars-d-announce

On Saturday, 31 December 2016 at 13:27:13 UTC, MrSmith wrote:

On Saturday, 31 December 2016 at 11:48:34 UTC, jkpl wrote:
I don't blame your personally but the last time a blog post 
presented a game (it was the one made by the author of dlib) 
there was also a similar problem. Were you aware that 
something gonna be posted and that necessarily people would 
try to build it ?


I haven't really got to building the whole thing on linux. For 
full functionality it needs LMDB, LZ4, GLFW3, Enet and IMGUI 
libs. Ideally there should be a linux build with all 
dependencies in releases.


No, I don't think the deps are necessary. That's a bit what's 
cool with linux OSes.

What I mean is that there's a compilation error related to dlib:

dub build --build=release
Performing "release" build using dmd for x86_64.
cbor-d 0.5.4: target for configuration "library" is up to date.
derelict-util 2.0.6: target for configuration "library" is up to 
date.
derelict-enet 2.0.0: target for configuration "library" is up to 
date.
derelict-gl3 1.0.18: target for configuration "library" is up to 
date.
derelict-glfw3 2.0.0: target for configuration 
"derelict-glfw3-dynamic" is up to date.

dlib ~master: building configuration "library"...
deps/dlib/dlib/filesystem/delegaterange.d(62,18): Error: function 
dlib.filesystem.delegaterange.DelegateInputRange!(DirEntry).DelegateInputRange.opApply does not override any function, did you mean to override 'std.range.interfaces.InputRange!(DirEntry).InputRange.opApply'?
deps/dlib/dlib/filesystem/delegaterange.d(75,18): Error: function 
dlib.filesystem.delegaterange.DelegateInputRange!(DirEntry).DelegateInputRange.opApply does not override any function, did you mean to override 'std.range.interfaces.InputRange!(DirEntry).InputRange.opApply'?
deps/dlib/dlib/filesystem/dirrange.d(35,7): Error: template 
instance 
dlib.filesystem.delegaterange.DelegateInputRange!(DirEntry) error 
instantiating
dlib.container.aarray is deprecated, use dlib.container.dict 
instead

dmd failed with exit code 1.

Just an advice to Mike Parker. If it's possible, next time a 
project is highlighted you could try to contact the person before 
publishing the post so that people are not disappointed when they 
try to build the stuff.


Re: Project Highlight: Voxelman

2016-12-31 Thread jkpl via Digitalmars-d-announce

On Friday, 30 December 2016 at 13:42:10 UTC, MrSmith wrote:

On Friday, 30 December 2016 at 13:28:12 UTC, Mike Parker wrote:
Voxelman is a plugin-driven voxel game engine that is built 
around a client-server architecture and sports multi-threaded 
world & mesh generation.


I stumbled across a post on /r/VoxelGameDev a few weeks back 
and recognized the handle of MrSmith33 from these forums. That 
prompted me to click through and I was DlighteD to discover it 
was created with that language I can't seem to stop writing 
about.


The post:
http://dlang.org/blog/2016/12/30/project-highlight-voxelman/

Reddit:
https://www.reddit.com/r/programming/comments/5l3eej/introducing_voxelman_a_plugindriven_voxel_game/


Thanks for doing this blog post, Mike!


It doesn't build under linux. Problem with dlib.

I don't blame your personally but the last time a blog post 
presented a game (it was the one made by the author of dlib) 
there was also a similar problem. Were you aware that something 
gonna be posted and that necessarily people would try to build it 
?


Re: D future ...

2016-12-31 Thread jkpl via Digitalmars-d

On Friday, 30 December 2016 at 13:56:30 UTC, Getald wrote:

On Thursday, 29 December 2016 at 21:41:45 UTC, aberba wrote:

Styling is similar to CSS but different. Wished someone would 
just go for a full blown CSS parser. CSS has proven its more 
capable and loved for client side styling/decoration.


Isn't this what GTK is essentially doing already where widget 
rendering is primarily defined by CSS.


Yes but it's gtk, there's year of work behind the library. For a 
homemade GUI library CSS or not CSS is really just bikeshedding 
around the format. The real stuff is to write the rendering 
engine. It becomes particularly tricky when the engine also 
supports transformations. If something is not well done you see 
it directly after rotation and translation.


Re: Bitfields?

2016-12-31 Thread jkpl via Digitalmars-d

On Friday, 30 December 2016 at 13:45:23 UTC, Martin wrote:

Are there any C-like bitfields in D?

Yes - How can I use them?
No - What could be used in their stead?


If you're okay with dependencies and if you use DUB there's this 
very decent wrapper called EnumSet:


- https://code.dlang.org/packages/iz
- 
https://github.com/BBasile/iz/blob/master/import/iz/enumset.d#L226


Re: How to detect free/unfree memory segments?

2016-12-23 Thread jkpl via Digitalmars-d-learn

On Friday, 23 December 2016 at 06:18:02 UTC, Suliman wrote:
I would like to visualize how GC works and display free/not 
free memory segments.

How I can understand which of them are used and which not?

Could anybody explain what dangerous of memory fragmentation in 
languages without GC? Am I right understand that there is stay 
some small memory chunks that very hard to reuse?


You start with a wrong assumption. The C malloc functions is not 
just a nasty and mean memory provider. Several implementations 
uses internally freelists. Which means that the gaps created by a 
free() may be filled again.


For example
- TCMallocator use free lists
- GCC C malloc use free lists (as stated here 
http://www.gnu.org/software/libc/manual/html_node/Freeing-after-Malloc.html)

- for snn.lib malloc (used by DMD win32) I can't say.


Re: D support for the Meson build system

2016-08-22 Thread jkpl via Digitalmars-d-announce

On Monday, 22 August 2016 at 11:45:37 UTC, Matthias Klumpp wrote:

On Monday, 22 August 2016 at 01:34:36 UTC, jkpl wrote:
On Sunday, 21 August 2016 at 19:08:59 UTC, Matthias Klumpp 
wrote:
for a project like Terminix, dub with LDC builds in 8.6s, 
while Meson and ninja take only 6s here.


Did you try to build with DUB but with WIFI or ethernet 
interface toggled off ?
I ran these a few times, and the results were comparable, 
although I think if I would perform proper statistics the 
variance would be relatively high. Compiler was LDC 1.0.0 (on a 
Xeon E3-1231 v3).


Sorry I was thinking to something, that could have slowed down 
the DUB build, but this was obviouslt wrong.






Re: Float values are wrong in union

2016-08-21 Thread jkpl via Digitalmars-d-learn

On Monday, 22 August 2016 at 04:52:40 UTC, Cauterite wrote:

On Monday, 22 August 2016 at 04:37:50 UTC, stunaep wrote:
I made a union to convert between int bits and floats, but the 
values are coming out wrong sometimes.


I can already tell what this is going to be...
The problem is almost certainly nothing to do with your union, 
it's this line:

float t2 = t.f;
This will load 0x7fb0 into ST(0), which instantly converts 
it to 7FF0 because it's a signalling NaN, then store ST(0) 
in your float `t2`.


Signalling NaNs are an ongoing problem in D's codegen. See 
Don's remarks at this page: 
https://issues.dlang.org/show_bug.cgi?id=16105#c2


The reason it works in other languages is because they don't 
place floats in the floating point registers for non-arithmetic 
operations. I've been trying to patch DMD's backend to behave 
this way too, but it's much harder than I expected (difficult 
codebase to understand/navigate).


That's a 32 bit codegen issue then because DMD64 's disasm shows 
that SSE regs are used:



void foo()
{
union test { int i; float f; }
test t = { i : 0x7fb0};
float t2 = t.f;
test t3 = { f : t2 };
}
===

yields to

===
004586D0h  push rbp
004586D1h  mov rbp, rsp
004586D4h  sub rsp, 10h
004586D8h  mov dword ptr [rbp-10h], 7FB0h
004586DFh  movss xmm0, dword ptr [rbp-10h]
004586E4h  movss dword ptr [rbp-0Ch], xmm0
004586E9h  movss xmm1, dword ptr [rbp-0Ch]
004586EEh  movss dword ptr [rbp-08h], xmm1
004586F3h  leave
004586F4h  ret
===


Re: Float values are wrong in union

2016-08-21 Thread jkpl via Digitalmars-d-learn

On Monday, 22 August 2016 at 04:37:50 UTC, stunaep wrote:
I made a union to convert between int bits and floats, but the 
values are coming out wrong sometimes. This is working without 
issue in other languages so I'm really stumped. Here's an 
example:



union test { int i; float f; }
test t = { i : 0x7fb0};
float t2 = t.f;//int bits 0x7fb0 as float
test t3 = { f : t2 };
writefln("%x", t3.i);//prints 7ff0 NOT 0x7fb0


Ok on linux, 0x7fb0 is written, I tested under linux x86_64 
with latest dmd beta, ldc and also gdc.


Which compiler and version do you use ?
Which OS and archi ?


Re: D support for the Meson build system

2016-08-21 Thread jkpl via Digitalmars-d-announce

On Sunday, 21 August 2016 at 19:08:59 UTC, Matthias Klumpp wrote:
for a project like Terminix, dub with LDC builds in 8.6s, while 
Meson and ninja take only 6s here.


Did you try to build with DUB but with WIFI or ethernet interface 
toggled off ?




Re: Please consider r/d_language for announcements

2016-08-21 Thread jkpl via Digitalmars-d

On Sunday, 21 August 2016 at 13:58:18 UTC, bachmeier wrote:
Many users judge programming languages by activity on their 
subreddits. Ours is https://www.reddit.com/r/d_language/


One purpose of the subreddit is to market the language to 
non-users. I want to provide those new to the language with:


- Evidence that D is a serious, actively used language
- Information about everything that is available

For instance, I just posted about the new ggplotd release. This 
is a really nice tool, but if we only make announcements of 
these projects in the announce forum, we're losing the 
marketing points we could be getting from them. Therefore, 
please consider announcing there.


The sub could be branded a bit too. Afaik this requires admin 
privileges.


Re: Does a Interpretation-Engine fit in phobos ?

2016-06-30 Thread jkpl via Digitalmars-d

On Thursday, 30 June 2016 at 10:28:03 UTC, Stefan Koch wrote:

Hi,

I recently had a breakthrough in my CTFE work.

Though because habits die hard.
I am writing the bytecode-engine in a CTFEable style.
Therefore I can be used as a quite comfortable IR for CTFE 
things as well.


It should be fairly easy to generate a inline-asm-string from 
the byteCode  at compiletime.
And thereby creating the possibility of generating optimized 
code at compile-time.


I was wondering if such a thing would fit in phobos.

Please share your opinions with me :)

Regards,
Stefan


No platform limitation is the rule of thumb.


Re: Some questions on latest work

2016-04-27 Thread jkpl via Digitalmars-d

On Wednesday, 27 April 2016 at 16:45:44 UTC, Bienlein wrote:

On Tuesday, 26 April 2016 at 21:49:33 UTC, Bill Hicks wrote:


Quitting a well paying job at Facebook to peruse a hobby (...)


This is why I thought that those issues with the GC and things 
like RefCounted could have been fixed meanwhile. I would like 
to encourage the D people to put priority on fixing everything 
that is vital for surprise-free development in D. Because those 
surprises seem to me really being what drives people away from 
D, which is a pitty as it is really the best thought out 
language I have seen so far. For people not being C or C++ 
developers from ground up fixing those issues that pop up in D 
here and there themselves is simply too effortful ;-).


It's because of the second concept.


Re: __traits(compiles) and template instantiation

2016-04-07 Thread jkpl via Digitalmars-d-learn

On Thursday, 7 April 2016 at 21:36:37 UTC, Alex Parrill wrote:

On Thursday, 7 April 2016 at 20:31:12 UTC, jmh530 wrote:
I've been playing around with __traits and I find myself 
confused on one aspect. In the code below, I was testing 
whether some templates would compile given types. For the most 
part it works as I would expect.

[...]

Neither the third nor sixth lines should be true.

alias wrongfoo = foo!int; /* Error: template instance 
foo!int does not match template declaration foo(T, U)(T x, U y) 
if (isNumeric!T && isNumeric!U) */

alias rightfoo = foo!(int, int); /* ok */

File a DMD bug.

(Also, you can use static assert here to check the assertions 
at build-time instead of run-time)


is(typeof()) gives the expected results:

import std.traits : isNumeric;
import std.range : isInputRange;

void foo(T, U)(T x, U y) if (isNumeric!T && isNumeric!U) { }

void bar(T, U)(T x, U y) if (isNumeric!T && isInputRange!U) { }

unittest
{
static assert(is(typeof(foo!(int, int;  //I get this
static assert(!is(typeof(foo!(bool, bool;   //I get this
static assert(!is(typeof(foo!(int;  //I think I get this
static assert(is(typeof(bar!(int, int[];//I get this
static assert(!is(typeof(bar!(int, int; //I get this
static assert(!is(typeof(bar!(int;  //I don't get this
}

(note well I have changed the assertion 3 and 6).

There must be a subtle difference between __traits(compile,...) 
and is(typeof()).
Does "compiles" mean that you've get something but that this 
thing is not always of a valid type ?


Re: Problem using shared D library from C shared library

2016-04-06 Thread jkpl via Digitalmars-d-learn

On Thursday, 7 April 2016 at 05:23:47 UTC, Yuxuan Shui wrote:

On Thursday, 7 April 2016 at 04:36:02 UTC, Yuxuan Shui wrote:

On Thursday, 7 April 2016 at 04:24:48 UTC, Yuxuan Shui wrote:

[...]


Looks like _d_arrayappendcTX asked for a enormous amount of 
memory and it fails, can't figure out why


Just find out it's my own fault.

BTW, memory block allocated by core.stdc.stdlib.malloc will not 
be scanned by collector, right?


right, that's why it's annotated @nogc ;)


Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread jkpl via Digitalmars-d-learn
On Saturday, 2 April 2016 at 18:32:03 UTC, Steven Schveighoffer 
wrote:
I honestly think you are better off just generating random 
arrays, even if it results in some overlap (unlikely to be 
relevant).


-Steve


Yes I know, I've realized how it's silly. just foreach(xn; 0 .. 
range) foreach(xn; 0 .. range) foreach(xn; 0 .. range) 
foreach(xn; 0 .. range) is enough. But still silly in term of 
complexity. I have to go for a heuristic approach. UNtil that I 
still use a prng.


Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread jkpl via Digitalmars-d-learn
gives: core.exception.OutOfMemoryError@src/core/exception.d(693): 
Memory allocation failed






Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread jkpl via Digitalmars-d-learn

On Saturday, 2 April 2016 at 09:11:34 UTC, jkpl wrote:
On Saturday, 2 April 2016 at 08:48:10 UTC, rikki cattermole 
wrote:

On 02/04/2016 9:36 PM, jkpl wrote:
On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole 
wrote:

Okay that is a problem then.


Yes clearly!

Maybe this, a bit better:


foreach (b0; randomCover(iota(0,256)))
foreach (b1; randomCover(iota(0,256)))
...
foreach (b255; randomCover(iota(0,256)))
{
...
}


Still not the right approach,


import std.stdio;
import std.random;
import std.range;

void testRunner(bool function(ubyte[128]) test)
{
uint[32] arr;

foreach (v0;  randomCover(iota(0U,uint.max)))
foreach (v1;  randomCover(iota(0U,uint.max)))
foreach (v2;  randomCover(iota(0U,uint.max)))
foreach (v3;  randomCover(iota(0U,uint.max)))
foreach (v4;  randomCover(iota(0U,uint.max)))
foreach (v5;  randomCover(iota(0U,uint.max)))
foreach (v6;  randomCover(iota(0U,uint.max)))
foreach (v7;  randomCover(iota(0U,uint.max)))
foreach (v8;  randomCover(iota(0U,uint.max)))
foreach (v9;  randomCover(iota(0U,uint.max)))
foreach (v10; randomCover(iota(0U,uint.max)))
foreach (v11; randomCover(iota(0U,uint.max)))
foreach (v12; randomCover(iota(0U,uint.max)))
foreach (v13; randomCover(iota(0U,uint.max)))
foreach (v14; randomCover(iota(0U,uint.max)))
foreach (v15; randomCover(iota(0U,uint.max)))
foreach (v16; randomCover(iota(0U,uint.max)))
foreach (v17; randomCover(iota(0U,uint.max)))
foreach (v18; randomCover(iota(0U,uint.max)))
foreach (v19; randomCover(iota(0U,uint.max)))
foreach (v20; randomCover(iota(0U,uint.max)))
foreach (v21; randomCover(iota(0U,uint.max)))
foreach (v22; randomCover(iota(0U,uint.max)))
foreach (v23; randomCover(iota(0U,uint.max)))
foreach (v24; randomCover(iota(0U,uint.max)))
foreach (v25; randomCover(iota(0U,uint.max)))
foreach (v26; randomCover(iota(0U,uint.max)))
foreach (v27; randomCover(iota(0U,uint.max)))
foreach (v28; randomCover(iota(0U,uint.max)))
foreach (v29; randomCover(iota(0U,uint.max)))
foreach (v30; randomCover(iota(0U,uint.max)))
foreach (v31; randomCover(iota(0U,uint.max)))
{
arr = [v0,v1,v2,v3,v4,v5,v6,v7,v8,v9,
   v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,
   v20,v21,v22,v23,v24,v25,v26,v27,v28,v29,
   v30, v31
];

writeln(arr);

//if (test(cast(ubyte[128]) arr))
return;
}
}

bool test(ubyte[128] arr)
{
if (arr[0] == 0U)
return true;
else
return false;
}

void main()
{
testRunner();
}


Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread jkpl via Digitalmars-d-learn

On Saturday, 2 April 2016 at 08:48:10 UTC, rikki cattermole wrote:

On 02/04/2016 9:36 PM, jkpl wrote:
On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole 
wrote:

Okay that is a problem then.


Yes clearly!

Maybe this, a bit better:


foreach (b0; randomCover(iota(0,256)))
foreach (b1; randomCover(iota(0,256)))
...
foreach (b255; randomCover(iota(0,256)))
{
...
}


Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread jkpl via Digitalmars-d-learn

On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote:

On 02/04/2016 9:20 PM, jkpl wrote:
Let's say I have a ubyte[256]. I want to test all the possible 
values

this array can have on a function.


Actually I'd use a hex string.

So:
static ubyte[256] DATA = cast(ubyte[256])x"00 01 02 03";
I'm sure you get the idea. That can be created easily enough.


No I don't get the idea. I think that I haven't well explained. 
By static array I meant "not dynamic". The 256^256 combinations 
must be generated on the same ubyte[256], which is a variable, 
during the program execution.


Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread jkpl via Digitalmars-d-learn
Let's say I have a ubyte[256]. I want to test all the possible 
values this array can have on a function.


Currently I fill it for each new test with std.random.uniform but 
I'm sure that I loose some time with randomizing and with the 
tests that are repeated. Is there a simple way to do this ? 
Without thinking much, it seems that the loops to generate this 
would be seriously awefull.


By thinking a bit more maybe with a fixed-size big integer it 
would work, since the value could be casted as the right array 
type (as long as its length is power of 2) ?


Re: Obtaining argument names in (variadic) functions

2016-03-19 Thread jkpl via Digitalmars-d-learn
On Wednesday, 16 March 2016 at 20:24:38 UTC, data pulverizer 
wrote:

Hi D gurus,

is there a way to obtain parameter names within the function 
body? I am particularly interested in variadic functions. 
Something like:


void myfun(T...)(T x){
foreach(i, arg; x)
writeln(i, " : ", arg);
}

void main(){
myfun(a = 2, b = "two", c = 2.0);
}

// should print
a : 2
b : two
c : 2.0

Thanks in advance

Loving the mixins and tuples


I try to anticipate the reason why you want this. As said in a 
previous answer you can access to an individual element by using 
the array syntax but also _param_, with X the index of the 
parameter:


void myfun(T...)(T x)
{
import std.traits; import std.stdio;
writeln(ParameterIdentifierTuple!(myfun!T));
writeln(_param_0);
writeln(_param_1);
writeln(_param_2);
}

void main()
{
int a=1,b=2,c=3;
myfun(a,b,c);
}


Re: nanosecond time

2016-02-13 Thread jkpl via Digitalmars-d-learn

On Saturday, 13 February 2016 at 19:24:44 UTC, ishwar wrote:
I am stumped on need finding interval between two events in a 
program execution  in nanoseconds. Any sample code will be 
appreciated (along with imports needed to make it work):

- time in nanoseconds-now
- do-some processing
- time in nano-second-now

Thanks


use a StopWatch:

http://dlang.org/phobos/std_datetime.html#.StopWatch


Re: DMD Issue with Asm Generation?

2016-02-13 Thread jkpl via Digitalmars-d

On Saturday, 13 February 2016 at 20:50:22 UTC, user001 wrote:
Disregard all that above, looks like someone used a "double" 
which uses 0x7FF0 to check if infinite. Not sure why the code 
runs fine on x86 though, different library maybe?


https://github.com/D-Programming-Language/phobos/blob/master/std/format.d#L1709


yes the line you highlight is for DMD64 (windows of course), 
which explains well why x86 is OK since it uses the C runtime 
library by DigitalMars (aka snn.lib). Now I'm not quite sure if 
it should be


T tval = val;

because of the comment just after:


convert early to get "inf" in case of overflow


Re: D popularity clearly on the rise in early 2016?!

2016-02-06 Thread jkpl via Digitalmars-d-announce

On Saturday, 6 February 2016 at 12:26:28 UTC, Rom wrote:

Hi guys.
I watch this index each month, and D moved 20 places up between 
January and February. it's now in the supposedly "top 20 most 
popular programming languages". I don't know yet whether this 
is due to some artefacts or if it reflects something true about 
D popularity.


Link -> 
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html



Hope you enjoy

Rom


already discussed here:

https://forum.dlang.org/thread/xovaxpfwvmgdxfzgd...@forum.dlang.org


Re: Using C++ everywhere D is makes things worst

2016-02-03 Thread jkpl via Digitalmars-d

On Wednesday, 3 February 2016 at 13:27:45 UTC, karabuta wrote:
I understand many D programmers were formally(or still is or 
in-between) C++ but most explanations for certain things tells 
me either D is a C++ clone or I need to learn C++ first before 
I really understand D (kind of like C++ is a subset of D). I 
must say that I never coded C++ beyond "hello, world!" and I 
don't plan to.


This is not about me and what I want, it is about improving the 
D learning resources available. Explaining D code by using 
C/C++ code and or theory confuses me as a learner. D alone is 
too much to learn.


You neither need a C nor a CPP background to learn D.
Before starting to learn D I was only (and barely) reading C, 
just because of the few times I had to deal with C headers file 
when using bindings in another lang.


You can start D from scratch. This is not because there are 
comparisons (such as the wiki sections: comming from...) that 
it's mandatory.


For example with

http://ddili.org/ders/d.en/index.html

you can start from scratch, at least the book is advertised so.


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost at 2 
meters from my screen, with zoom, so I can't read the code...


I work more or less lying on a futon. Desks are so cheesy...


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost 
at 2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on the 
pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


https://www.youtube.com/watch?v=g7qx5oYdOEA

tous fashos: juif, chrétien, musulmans,...

Il n'y a bien que les communistes qui ont compris que les 
religions c'est de la merde.


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost at 
2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on the 
pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 18:33:16 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost 
at 2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on 
the pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


https://www.youtube.com/watch?v=g7qx5oYdOEA

tous fashos: juif, chrétien, musulmans,...

Il n'y a bien que les communistes qui ont compris que les 
religions c'est de la merde.


Also, european people should ask themselves why they stick on 
the US culture since 60 years, while actually Russians freed 
Berlin.


One last thing. Tough guy ?

https://www.youtube.com/watch?v=1igvrZ0KosA


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost 
at 2 meters from my screen, with zoom, so I can't read the 
code...


I work more or less lying on a futon. Desks are so cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on 
the pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


https://www.youtube.com/watch?v=g7qx5oYdOEA

tous fashos: juif, chrétien, musulmans,...

Il n'y a bien que les communistes qui ont compris que les 
religions c'est de la merde.


Also, european people should ask themselves why they stick on the 
US culture since 60 years, while actually Russians freed Berlin.


Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn

On Monday, 28 December 2015 at 19:22:00 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:33:16 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote:

On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote:

On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote:

On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote:

On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote:
On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy 
wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always 
almost at 2 meters from my screen, with zoom, so I can't 
read the code...


I work more or less lying on a futon. Desks are so 
cheesy...


Anarchism is comfy...


when I'm tired with the conformism I just let my head go on 
the pillow and I sleep...

(snoring)

Even if I dont't think that you have won:
https://youtu.be/Uj_7kTwRMKE?t=2m35s


https://www.youtube.com/watch?v=g7qx5oYdOEA

tous fashos: juif, chrétien, musulmans,...

Il n'y a bien que les communistes qui ont compris que les 
religions c'est de la merde.


Also, european people should ask themselves why they stick on 
the US culture since 60 years, while actually Russians freed 
Berlin.


One last thing. Tough guy ?

https://www.youtube.com/watch?v=1igvrZ0KosA


I always try to find a link to the scene, in south america:

"And finally I've done what I always done...".

I never find it. It's probably because judgment defaits us:

https://www.youtube.com/watch?v=xNRBajLM8_4

We want to show something, but we're always near, no so far, not 
close to our idea.
It exists but we cant find a reference to the perfect 
representation of the idea...




Re: Variable below zero but if statement doesn't grab?

2015-12-27 Thread jkpl via Digitalmars-d-learn

On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Any idea what i am doing wrong?
https://www.youtube.com/watch?v=j_VCa-5VeP8


You could post the code also, personnaly I'm always almost at 2 
meters from my screen, with zoom, so I can't read the code...


Re: Coedit 1 - update 1

2015-06-25 Thread jkpl via Digitalmars-d-announce

On Thursday, 25 June 2015 at 11:34:17 UTC, tired_eyes wrote:

On Thursday, 25 June 2015 at 04:10:15 UTC, Basile Burg wrote:

This is the first update for Coedit 1, and probably the only.


Errr... why so pessimistic?


It's not pessimistic, it's the opposite. This explained by the 
software versioning system: the updates for the version 1 are on 
a dedicated branch; the changes made to the master branch are 
actually for the second version hence no more updates means that 
the software is stable. It's not like semver that continues after 
1.0 to 1.1 then 1.2 and so on...


Re: fast way to insert element at index 0

2015-06-22 Thread jkpl via Digitalmars-d-learn

On Tuesday, 23 June 2015 at 05:16:23 UTC, Assembly wrote:
What's a fast way to insert an element at index 0 of array? now 
that the code is working I want to clean this:


void push(T val)
{
T[] t = new T[buffer.length + 1];
t[0] = val;
t[1 .. $] = buffer;
buffer = t;
}

I did this because I didn't find any suble built-in data 
structure that let me insert an item into a specific index at 
first search. Slist does have insertFron(), exactly what I'm 
looking for it's a linked list.


* Option 1/

if most of the time you have to insert at the beginning, then 
start reading from the end and append to the end, so that the 
existing block has not to be moved. You just have to add val at 
the end.


* Option 2/

better way to move the whole block (this can be done with memmove 
too).


---
void push(T val)
{
buffer.length += 1;
buffer[1..$] = buffer[0..$-1];
// or memmove(buffer.ptr + T.sizeof, buffer.ptr, 
(buffer.length - 1) * T.sizeof);

buffer[0] = val;
}
---

* Option 3/

linked lists are better to insert/move.



Re: Download DDMD?

2015-04-22 Thread jkpl via Digitalmars-d-learn

On Wednesday, 22 April 2015 at 09:26:37 UTC, jkpl wrote:
On Wednesday, 22 April 2015 at 07:57:40 UTC, Jeremiah DeHaan 
wrote:
Just curious, but I was wondering if there was a 2.067 DDMD 
available for download somewhere for Windows. If not, then are 
there any special build instructions I need to build it? I 
kind of just want to try a couple of things, so I would rather 
I not have to build it if I can avoid it.


the 2.067 ddmd is available as a static library. For the moment 
it only includes the lexer and the parser:


https://github.com/yebblies/ddmd

it does not require anything specific to build: pass the 
sources, set the -lib switch, maybe set the 
warnings/depreciations to off because there are some small 
syntax issues (C-stle array or switch case fallthrough).


I've put it metad btw

https://github.com/BBasile/metad/blob/master/projects/ddmd.coedit



Re: Download DDMD?

2015-04-22 Thread jkpl via Digitalmars-d-learn
On Wednesday, 22 April 2015 at 15:06:17 UTC, Jeremiah DeHaan 
wrote:

On Wednesday, 22 April 2015 at 09:26:37 UTC, jkpl wrote:
On Wednesday, 22 April 2015 at 07:57:40 UTC, Jeremiah DeHaan 
wrote:
Just curious, but I was wondering if there was a 2.067 DDMD 
available for download somewhere for Windows. If not, then 
are there any special build instructions I need to build it? 
I kind of just want to try a couple of things, so I would 
rather I not have to build it if I can avoid it.


the 2.067 ddmd is available as a static library. For the 
moment it only includes the lexer and the parser:


https://github.com/yebblies/ddmd

it does not require anything specific to build: pass the 
sources, set the -lib switch, maybe set the 
warnings/depreciations to off because there are some small 
syntax issues (C-stle array or switch case fallthrough).


Yes, I was aware of this, but I actually want it as a compiler.


oops, i was not sure of you being a noob even if i saw your 
avatar many times here. Sorry. Just ask to someone of the core...


Re: SDC needs you -- redux

2015-04-22 Thread jkpl via Digitalmars-d
On Saturday, 18 April 2015 at 17:21:28 UTC, Shammah Chancellor 
wrote:
...Even just having people in the channel to have discourse 
with would be helpful!


Cheers,
-Shammah


Hey. Is the win32 build fixed now (libd) ?
Since, i don't know, maybe 2 monthes, it looks like there is a 
mess with the 32/64 bit types.




Re: Download DDMD?

2015-04-22 Thread jkpl via Digitalmars-d-learn
On Wednesday, 22 April 2015 at 07:57:40 UTC, Jeremiah DeHaan 
wrote:
Just curious, but I was wondering if there was a 2.067 DDMD 
available for download somewhere for Windows. If not, then are 
there any special build instructions I need to build it? I kind 
of just want to try a couple of things, so I would rather I not 
have to build it if I can avoid it.


the 2.067 ddmd is available as a static library. For the moment 
it only includes the lexer and the parser:


https://github.com/yebblies/ddmd

it does not require anything specific to build: pass the sources, 
set the -lib switch, maybe set the warnings/depreciations to off 
because there are some small syntax issues (C-stle array or 
switch case fallthrough).




Re: Context Sensitive Gui Library

2015-04-11 Thread jkpl via Digitalmars-d
On Saturday, 11 April 2015 at 07:28:50 UTC, Rikki Cattermole 
wrote:

On 11/04/2015 7:24 p.m., jkpl wrote:
On Saturday, 11 April 2015 at 05:45:10 UTC, Rikki Cattermole 
wrote:

On 11/04/2015 5:43 p.m., Rashad Vinshy wrote:

CSGL:

I would like to announce the release of my beta library for 
D!


What is the best plan of action at this point to contribute 
it to the D
community? (the library still needs debugging and 
optimization support,

I've only tested it on my machine)

For those interested the library hast he following features 
currently

supported:


1. CSGL exists on a series of overlays over the workspace - 
by simply

design one can simulate traditional gui's.

2. CSGL has context sensitive capabilities - Allows one to 
change the

gui depending on what actions have previously taken place.

3. CSGL is intelligent and can find optimal patterns in your 
work flow.
You are presented with what you need at that point. The self 
modifying
gui can adapt not only visual elements but also context 
sensitive
hotkeys, mouse interact, and even things such as MIDI, OSC, 
COM, etc.


4. CSGL has a built in fully capable scripting editor. One 
can not only
write their on wrappers around the gui elements but also 
design commonly
used macros to reduce complex gui interaction tasks. One can 
even do

such things as animation using the scripting language

5. CSGL has pluggable modules that can be freely used by any 
gui that

recognizes them. One can also access them through scripting.

6. The visual template of the gui can be easily changed 
through the gui
template library. (your apps can be reskinned by a few 
clicks)


7. Full multi-monitor support, including automatically 
tracking usage

patterns to present the user with the best possible scenario.

8. Full User-Edit mode. By a special hotkey the user can go 
into edit
mode and configure and edit the different gui elements. The 
same editor

is used to the design the gui.


Features to come: Full GUI editor(not done yet). Something 
like Blend.



--

Next week I will be able to upload a working demo that shows 
off some of
the capabilities; Some of the graphics treats such as alpha 
channel

tricks, along with how context sensitive gui's work.

The demo is a graphics program that essentially changes the 
gui as you
change your working actions. If you use the paintbrush tool, 
not only do
the other tools reorder themselves, they also can(but not 
necessarily)
configure themselves to present to you similar choices that 
were used
before in similar contexts. In this case(of a new user) a 
circular
swatch is present to the user that surrounds the canvas for 
easy color
access that is on it's own overlay along with the right 
mouse button
becoming a different function(from a secondary drawing tool 
function to
an eraser. This was done by scripting side to show how it 
can be used).


Also, If anyone is interested in helping with this project 
please let me

know.

Thanks,

RV


Thats nice. Now where is the source code?


Same here...quite amused. I think that now he's gone in 
nothern Yukkon

to kill the bear whose skin just been sold.

Though i might be wrong.


I umm, not sure I understand you.


it's based on this french idiom:
(vendre la peau de l'ours avant de l'avoir tué)

in a nutshell: I suspect this announce to be spam because:
1/ googlelize the OP name: nothing, except this post. For such a 
framework, the guy cannot land from nowhere.

2/ he has posted in te wrong fourm section.
3/ no screenshot, no links.
4/ the concept is quite abstruse, not self-explanatory, no tech 
details (e.g open-gl for this, xml for that...

5/ it's too providential.

Though i might be wrong.



Re: Context Sensitive Gui Library

2015-04-11 Thread jkpl via Digitalmars-d
On Saturday, 11 April 2015 at 05:45:10 UTC, Rikki Cattermole 
wrote:

On 11/04/2015 5:43 p.m., Rashad Vinshy wrote:

CSGL:

I would like to announce the release of my beta library for D!

What is the best plan of action at this point to contribute it 
to the D
community? (the library still needs debugging and optimization 
support,

I've only tested it on my machine)

For those interested the library hast he following features 
currently

supported:


1. CSGL exists on a series of overlays over the workspace - by 
simply

design one can simulate traditional gui's.

2. CSGL has context sensitive capabilities - Allows one to 
change the

gui depending on what actions have previously taken place.

3. CSGL is intelligent and can find optimal patterns in your 
work flow.
You are presented with what you need at that point. The self 
modifying
gui can adapt not only visual elements but also context 
sensitive
hotkeys, mouse interact, and even things such as MIDI, OSC, 
COM, etc.


4. CSGL has a built in fully capable scripting editor. One can 
not only
write their on wrappers around the gui elements but also 
design commonly
used macros to reduce complex gui interaction tasks. One can 
even do

such things as animation using the scripting language

5. CSGL has pluggable modules that can be freely used by any 
gui that

recognizes them. One can also access them through scripting.

6. The visual template of the gui can be easily changed 
through the gui

template library. (your apps can be reskinned by a few clicks)

7. Full multi-monitor support, including automatically 
tracking usage

patterns to present the user with the best possible scenario.

8. Full User-Edit mode. By a special hotkey the user can go 
into edit
mode and configure and edit the different gui elements. The 
same editor

is used to the design the gui.


Features to come: Full GUI editor(not done yet). Something 
like Blend.



--

Next week I will be able to upload a working demo that shows 
off some of
the capabilities; Some of the graphics treats such as alpha 
channel

tricks, along with how context sensitive gui's work.

The demo is a graphics program that essentially changes the 
gui as you
change your working actions. If you use the paintbrush tool, 
not only do
the other tools reorder themselves, they also can(but not 
necessarily)
configure themselves to present to you similar choices that 
were used
before in similar contexts. In this case(of a new user) a 
circular
swatch is present to the user that surrounds the canvas for 
easy color
access that is on it's own overlay along with the right mouse 
button
becoming a different function(from a secondary drawing tool 
function to
an eraser. This was done by scripting side to show how it can 
be used).


Also, If anyone is interested in helping with this project 
please let me

know.

Thanks,

RV


Thats nice. Now where is the source code?


Same here...quite amused. I think that now he's gone in nothern 
Yukkon to kill the bear whose skin just been sold.


Though i might be wrong.



Re: Context Sensitive Gui Library

2015-04-11 Thread jkpl via Digitalmars-d
On Saturday, 11 April 2015 at 09:11:35 UTC, Rikki Cattermole 
wrote:

On 11/04/2015 8:34 p.m., jkpl wrote:
On Saturday, 11 April 2015 at 07:28:50 UTC, Rikki Cattermole 
wrote:

On 11/04/2015 7:24 p.m., jkpl wrote:
On Saturday, 11 April 2015 at 05:45:10 UTC, Rikki Cattermole 
wrote:

On 11/04/2015 5:43 p.m., Rashad Vinshy wrote:

CSGL:

I would like to announce the release of my beta library 
for D!


What is the best plan of action at this point to 
contribute it to

the D
community? (the library still needs debugging and 
optimization

support,
I've only tested it on my machine)

For those interested the library hast he following 
features currently

supported:


1. CSGL exists on a series of overlays over the workspace 
- by simply

design one can simulate traditional gui's.

2. CSGL has context sensitive capabilities - Allows one to 
change the

gui depending on what actions have previously taken place.

3. CSGL is intelligent and can find optimal patterns in 
your work

flow.
You are presented with what you need at that point. The 
self modifying
gui can adapt not only visual elements but also context 
sensitive
hotkeys, mouse interact, and even things such as MIDI, 
OSC, COM, etc.


4. CSGL has a built in fully capable scripting editor. One 
can not

only
write their on wrappers around the gui elements but also 
design

commonly
used macros to reduce complex gui interaction tasks. One 
can even do

such things as animation using the scripting language

5. CSGL has pluggable modules that can be freely used by 
any gui that
recognizes them. One can also access them through 
scripting.


6. The visual template of the gui can be easily changed 
through the

gui
template library. (your apps can be reskinned by a few 
clicks)


7. Full multi-monitor support, including automatically 
tracking usage
patterns to present the user with the best possible 
scenario.


8. Full User-Edit mode. By a special hotkey the user can 
go into edit
mode and configure and edit the different gui elements. 
The same

editor
is used to the design the gui.


Features to come: Full GUI editor(not done yet). Something 
like Blend.



--

Next week I will be able to upload a working demo that 
shows off

some of
the capabilities; Some of the graphics treats such as 
alpha channel

tricks, along with how context sensitive gui's work.

The demo is a graphics program that essentially changes 
the gui as you
change your working actions. If you use the paintbrush 
tool, not

only do
the other tools reorder themselves, they also can(but not 
necessarily)
configure themselves to present to you similar choices 
that were used
before in similar contexts. In this case(of a new user) a 
circular
swatch is present to the user that surrounds the canvas 
for easy color
access that is on it's own overlay along with the right 
mouse button

becoming a different function(from a secondary drawing tool
function to
an eraser. This was done by scripting side to show how it 
can be

used).

Also, If anyone is interested in helping with this project 
please

let me
know.

Thanks,

RV


Thats nice. Now where is the source code?


Same here...quite amused. I think that now he's gone in 
nothern Yukkon

to kill the bear whose skin just been sold.

Though i might be wrong.


I umm, not sure I understand you.


it's based on this french idiom:
(vendre la peau de l'ours avant de l'avoir tué)

in a nutshell: I suspect this announce to be spam because:
1/ googlelize the OP name: nothing, except this post. For such 
a

framework, the guy cannot land from nowhere.
2/ he has posted in te wrong fourm section.
3/ no screenshot, no links.
4/ the concept is quite abstruse, not self-explanatory, no 
tech details

(e.g open-gl for this, xml for that...
5/ it's too providential.

Though i might be wrong.


Ohhh that.

Yeah I understand your pov on this.
I just don't like risking alienating somebody who could become 
part of the D community.


I think that if the guy is serious he won't give up because his 
product is about to be released and he would probably be clever 
enough to get that my suspicion doesn't matter since i'm just a 
casual user (casual poster here as well).


By the way, after a few investigations and thanks to my 
hypermnesia, i think that i've spotted him, and if it's the case, 
the pre-announce is honnest. He might be the author of this other 
topic:


http://forum.dlang.org/thread/yfdaeaduvbqyrjqsq...@forum.dlang.org#post-mailman.3008.1418200191.9932.digitalmars-d:40puremagic.com

it was a survey to estimate if it's worth to release a commercial 
D library.




Re: UDAs and no complaints about need 'this'

2015-04-09 Thread jkpl via Digitalmars-d

On Thursday, 9 April 2015 at 09:53:15 UTC, John Colvin wrote:

struct BigLongStructName
{
int evenLongerMemberName;
}

struct QN{}

unittest
{
BigLongStructName bigLongStructName;

@(bigLongStructName.evenLongerMemberName)
QN quickName;

__traits(getAttributes, quickName)[0]++;
}

Is it just me or is it weird that this works? Once you pull the 
UDA out from being a storage class and attempt to alias it, you 
get the usual need 'this' for 'evenLongerMemberName' of type 
'int' error messages on use.


Why are UDAs so special? I don't believe there's any other way 
to achieve this sort of effective renaming.


I think it's an error. When the attribute is a struct, it looks 
like the member is processed as a static variable. But the 
equivalent with a class raises an AV:


---
class BigLongStructName
{
int evenLongerMemberName;
}

struct QN{}

unittest
{
import std.stdio;

BigLongStructName bigLongStructName;

@(bigLongStructName.evenLongerMemberName)
QN quickName;

__traits(getAttributes, quickName)[0]++;
}
---

which is a totally expected behaviour.



Re: A few notes on choosing between Go and D for a quick project

2015-03-18 Thread jkpl via Digitalmars-d

On Wednesday, 18 March 2015 at 23:41:41 UTC, Walter Bright wrote:

On 3/18/2015 5:45 AM, CraigDillabaugh wrote:
You said that Unfortunately this thinking is going out of 
style for good
reasons.   I am confused (sorry, I am at work, and didn't 
have time to watch

the 1+ hour video you linked to - maybe some clues were there)!


Consider this C code:

#include stdbool.h
#include stdio.h

typedef long T;
bool find(T *array, size_t dim, T t) {
 int i;
 for (i = 0; i = dim; i++);
 {
int v = array[i];
if (v == t)
return true;
 }
}

There are several bugs in it. I've showed this to probably over 
1000 programmers, and nobody found all the bugs in it (they are 
obvious once pointed out). It is not easy to write bug free 
loop code, and find() is a trivial function.


just for fun:

1/ '=' instead of ''
2/ array should be tested against null before entering the loop
3/ 'int v' instead of 'T v'

Got them all ?



Re: Defining a single opCast disables explicit cast to base interfaces

2015-03-17 Thread jkpl via Digitalmars-d

On Tuesday, 17 March 2015 at 05:27:38 UTC, Ali Çehreli wrote:

The following program compiles fine:

interface I
{}

class B : I
{}

class C : B
{
int i;
}

void main()
{
auto c = new C;

auto i = cast(I)c;// compiles
auto b = cast(B)c;// compiles
}

Let's add an unrelated opCast to C:

class C : B
{
int i;

int opCast(T : int)()
{
return i;
}
}

Now the last two lines of main fail to compile:

Error: template instance opCast!(I) does not match template 
declaration opCast(T : int)()
Error: template instance opCast!(B) does not match template 
declaration opCast(T : int)()


Is this per spec? (Actually, where is the spec? (Trick 
question. ;) )


There is a workaround: Add a catch-all opCast that forwards to 
the all-powerful std.conv.to:


T opCast(T)()
{
import std.conv;
return this.to!T;
}

Now it compiles and works as expected.

However, the question remains...

Thank you,
Ali


There is also another trick: generally when something cannot be 
cast then it's often possible to cast it as a pointer to the cast 
type that is directly derefered. And it work...

---
T opCast(T)()
{
static if(is(T==int))
return i;
else
return *cast(T*) this;
}
---

...ed until version 2.067 (now it's deprecated because of this 
since this is already a ptr).


Re: static alias this

2015-02-07 Thread jkpl via Digitalmars-d-learn

Another try

E)---
struct StaticRegister {
static private uint _value;
@property static uint value() { return _value; }
@property static void value(uint v) { _value = v; }
static uint opCall(){return _value;}
alias _value this;
}

void main(string[] s) {
StaticRegister = 1;
assert(StaticRegister()==1);
}

Yes you're right, it's a bit strange that the writer works...does 
the expression 'static this' make sense ?!




Re: D, windows developement, frustration and fish

2015-02-01 Thread jkpl via Digitalmars-d
On Sunday, 1 February 2015 at 11:37:46 UTC, Vladimir Panteleev 
wrote:

On Sunday, 1 February 2015 at 11:28:51 UTC, jkpl wrote:

Shouldn't you compile with the following cmds ?

dmd.exe test.d wininet.lib wininet.di -Ipath_to_di_file


wininet.lib is unnecessary because wininet.d has `pragma(lib, 
wininet);`.


wininet.di is unnecessary because it does not contain any code, 
only declarations - an import inside test.d is sufficient. 
(This may not be true if you pull in .init of struct types, for 
example)


okay but the -Ipath is still missing, wouldn't be a bit the 
reason why dmd complains about undefined symbols ?




Re: D, windows developement, frustration and fish

2015-02-01 Thread jkpl via Digitalmars-d

On Sunday, 1 February 2015 at 09:42:49 UTC, ketmar wrote:
today i was in need of a little utility that must download the 
file using
wininet.dll. nothing fancy, just send a request and receive 
the
contents. no, curl was not a choice. and -- oh, well, wininet 
is a dll
which any windows box has, right? at least any windows box with 
XP and

higher, which is ok.

allright, i know that winapi bindings is a separate project, 
and it's ok
for me: i fired my git and cloned the repo. surely, wininet.d 
was there.


then i used my shiny fresh DMD build (i just did that to check 
my fix for

read after free patch) to compile a simple test program.

aaah! there is no wininet.lib! ok, installing msvc is a time 
and space
consuming thing, and i know that dmc has that cool implib 
utility,
which i can use to make the corresponding .lib file (ah, i love 
windows

developement!).

so i ran implib.exe /s wininet.lib 
c:\windows\system32\wininet.dll,
copied the resulting wininet.lib to lib directory of dmd 
and tried to

compile my sample:

dmd.exe test.d ... /L+wininet.lib



Shouldn't you compile with the following cmds ?

dmd.exe test.d wininet.lib wininet.di -Ipath_to_di_file

?


Re: D, windows developement, frustration and fish

2015-02-01 Thread jkpl via Digitalmars-d

On Sunday, 1 February 2015 at 11:46:06 UTC, ketmar wrote:
it's not missing, it's in sc.ini, along with other minor 
tweaks that

aren't interesting in the context of the story itself.


Ok, you should add this precision in the initial post.


Re: D in my trashbin

2014-10-25 Thread Jkpl via Digitalmars-d

On Friday, 24 October 2014 at 02:42:13 UTC, frustrated wrote:

Two days later and I still cant get a 'Hello World' to compile.
It is far beyond me how a project can exist for so many years
and still not have a straightforward installation that works out
of the box. Yes.. read the forums and search google for 
solutions

that may or may not work depending on the phases of the moon,
I have to ask you:
Why bother ?
Why would anybody trust a compiler written by people
who regard making it run out of the box an after-thought ?


Sorry, actually it was a joke from me and I laught a lot while 
reading your answers during 3 days. The setup is just fine, 
although if you've started a nice think-tank about the problem...

Sorry. My bad.



Re: D in my trashbin

2014-10-25 Thread Jkpl via Digitalmars-d

On Saturday, 25 October 2014 at 21:24:14 UTC, Kyoji Klyden wrote:

On Saturday, 25 October 2014 at 19:33:45 UTC, Jkpl wrote:

On Friday, 24 October 2014 at 02:42:13 UTC, frustrated wrote:
Two days later and I still cant get a 'Hello World' to 
compile.

It is far beyond me how a project can exist for so many years
and still not have a straightforward installation that works 
out
of the box. Yes.. read the forums and search google for 
solutions

that may or may not work depending on the phases of the moon,
I have to ask you:
Why bother ?
Why would anybody trust a compiler written by people
who regard making it run out of the box an after-thought ?


Sorry, actually it was a joke from me and I laught a lot while 
reading your answers during 3 days. The setup is just fine, 
although if you've started a nice think-tank about the 
problem...

Sorry. My bad.


Regardless of me believing you or not, by what means was it a
joke? OP complains about technical difficulties, several people
offer assistance, then you arrive claim you laughed about the
whole thing and apologize.
I find it hard to believe there was any humor amongst any of
that, aside from the few jokes a couple people made.


Just ask to Vlad. He seems to be the forum maintainer. He'll 
check the IP.
Even if I'm not the OP, the message is clear: why the hell do you 
care about this ? DMD setup is fine. It works. dot.


Re: D in my trashbin

2014-10-25 Thread Jkpl via Digitalmars-d

On Saturday, 25 October 2014 at 22:41:59 UTC, Kyoji Klyden wrote:

On Saturday, 25 October 2014 at 22:17:35 UTC, Jkpl wrote:


Just ask to Vlad. He seems to be the forum maintainer. He'll 
check the IP.
Even if I'm not the OP, the message is clear: why the hell do 
you care about this ? DMD setup is fine. It works. dot.


Haha, why would anyone go check your IP?
Should we tell everyone who has trouble with DMD: the setup is
fine. It works. dot.? It has a very reassuring ring to it. 
Melts

my troubles away. :P

Once you're ready to take on Hello World or to show us your
next great skit, feel free to post in D.Learn.


Initially i was just trying to solve the thing by saying:
dont bother it 's a joke, you can setup dmd and compile a simple 
hello world.
But...it seems that's some people cant accept the perfect 
explanation.
I mean: stop being stuck on this, the OP has made an error. He 
won't reply.
Even if now he has compiled his hello world, do you really 
think, in your own soul, that he will come saying it's ok now, I 
get it, it works fine.

Seriously.



Does it make sense to add attribute to operator overload functions ?

2014-10-25 Thread Jkpl via Digitalmars-d-learn
Everything is in the Q. I ask this because those functions are 
hidden behind symbols and keywords (+=, ~, in, etc.). It's not 
that obvious for a user who would write a custom type.


e.g:
---
struct myType
{
@safe nothrow opIndexAssign(t1 paramValue,t2 paramIndex){}
}
---

are the attributes necessary ? Are opXXX functions handled just 
like any other functs ? (traversal compat. of the attribs)


Re: Does it make sense to add attribute to operator overload functions ?

2014-10-25 Thread Jkpl via Digitalmars-d-learn

On Saturday, 25 October 2014 at 18:38:12 UTC, John Colvin wrote:

On Saturday, 25 October 2014 at 17:14:51 UTC, Jkpl wrote:
Everything is in the Q. I ask this because those functions are 
hidden behind symbols and keywords (+=, ~, in, etc.). It's not 
that obvious for a user who would write a custom type.


e.g:
---
struct myType
{
   @safe nothrow opIndexAssign(t1 paramValue,t2 paramIndex){}
}
---

are the attributes necessary ? Are opXXX functions handled 
just like any other functs ? (traversal compat. of the attribs)


In every aspect they are ordinary functions, except they each 
have an additional unique way of being called (the relevant 
operator syntax).


In short, yes.


Thx, A bit less confused by them now.