Re: No UFCS with nested functions?

2019-11-04 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 00:34:33 UTC, Nicholas Wilson 
wrote:

https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/

struct S {
ubyte[12] bar;
}

alias I(alias f) = f;

bool foo (ref S s)
{
   static bool prop(const(ubyte)[] f) {
  return f.length > 1;
   }
return s.bar[].I!prop;
}


It's in Phobos:

import std.meta: Alias;

return s.bar[].Alias!prop


Re: No UFCS with nested functions?

2019-11-04 Thread Nicholas Wilson via Digitalmars-d-learn

On Monday, 4 November 2019 at 19:51:26 UTC, Tobias Pankrath wrote:
Why does the following not work? It works, if I move the 'prop' 
out of 'foo'.


---
struct S {
ubyte[12] bar;
}

bool foo (ref S s)
{
   static bool prop(const(ubyte)[] f) {
  return f.length > 1;
   }
return s.bar[].prop;
}
---

Thanks!


https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/

struct S {
ubyte[12] bar;
}

alias I(alias f) = f;

bool foo (ref S s)
{
   static bool prop(const(ubyte)[] f) {
  return f.length > 1;
   }
return s.bar[].I!prop;
}


Re: Using shared memory and thread

2019-11-04 Thread bioinfornatics via Digitalmars-d-learn

On Tuesday, 5 November 2019 at 00:04:05 UTC, bioinfornatics wrote:
On Monday, 4 November 2019 at 22:19:29 UTC, bioinfornatics 
wrote:
On Monday, 4 November 2019 at 21:53:45 UTC, bioinfornatics 
wrote:
On Monday, 4 November 2019 at 19:53:29 UTC, bioinfornatics 
wrote:

[...]


One image reveals more than a thousand words, see my picture 
:-)

   -> http://pix.toile-libre.org/?img=1572906675.png


oups got a problem with the alpha layer:
   -> http://pix.toile-libre.org/?img=1572908302.png


here my (not working) snippet code:
   -> https://run.dlang.io/gist/75429dcb8612e00635f7d53aabc4776f

the example do not meet exactly the spec and he do not compile.


arf the generated link raise a 404, here a gist 
https://gist.github.com/run-dlang/4ffcc0641acef5eedf52a17c4995599b


Re: Using shared memory and thread

2019-11-04 Thread bioinfornatics via Digitalmars-d-learn

On Monday, 4 November 2019 at 22:19:29 UTC, bioinfornatics wrote:
On Monday, 4 November 2019 at 21:53:45 UTC, bioinfornatics 
wrote:
On Monday, 4 November 2019 at 19:53:29 UTC, bioinfornatics 
wrote:

Dear,

I would like to put a buffer `shared(char[])` into a shared 
memory ( L2 cache ) and provide a start and end index to 
multiple thread in order to perform computation on a piece of 
original buffer.


[...]


One image reveals more than a thousand words, see my picture 
:-)

   -> http://pix.toile-libre.org/?img=1572906675.png


oups got a problem with the alpha layer:
   -> http://pix.toile-libre.org/?img=1572908302.png


here my (not working) snippet code:
   -> https://run.dlang.io/gist/75429dcb8612e00635f7d53aabc4776f

the example do not meet exactly the spec and he do not compile.


Re: Using shared memory and thread

2019-11-04 Thread bioinfornatics via Digitalmars-d-learn

On Monday, 4 November 2019 at 21:53:45 UTC, bioinfornatics wrote:
On Monday, 4 November 2019 at 19:53:29 UTC, bioinfornatics 
wrote:

Dear,

I would like to put a buffer `shared(char[])` into a shared 
memory ( L2 cache ) and provide a start and end index to 
multiple thread in order to perform computation on a piece of 
original buffer.


[...]


One image reveals more than a thousand words, see my picture :-)
   -> http://pix.toile-libre.org/?img=1572906675.png


oups got a problem with the alpha layer:
   -> http://pix.toile-libre.org/?img=1572908302.png


Re: Using shared memory and thread

2019-11-04 Thread bioinfornatics via Digitalmars-d-learn

On Monday, 4 November 2019 at 19:53:29 UTC, bioinfornatics wrote:

Dear,

I would like to put a buffer `shared(char[])` into a shared 
memory ( L2 cache ) and provide a start and end index to 
multiple thread in order to perform computation on a piece of 
original buffer.


[...]


One image reveals more than a thousand words, see my picture :-)
   -> http://pix.toile-libre.org/?img=1572906675.png


Re: No UFCS with nested functions?

2019-11-04 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Nov 04, 2019 at 07:51:26PM +, Tobias Pankrath via 
Digitalmars-d-learn wrote:
> Why does the following not work? It works, if I move the 'prop' out of
> 'foo'.

UFCS is only supported for module-level functions, as far as I know.


> ---
> struct S {
>   ubyte[12] bar;
> }
> 
> bool foo (ref S s)
> {
>static bool prop(const(ubyte)[] f) {
>   return f.length > 1;
>}
>   return s.bar[].prop;
> }
> ---
[...]


T

-- 
I am not young enough to know everything. -- Oscar Wilde


Re: Which is the active fork in DFL gui library ?

2019-11-04 Thread Vinod K Chandran via Digitalmars-d-learn

On Sunday, 3 November 2019 at 23:25:40 UTC, Jesse Phillips wrote:
On Sunday, 3 November 2019 at 16:48:52 UTC, Vinod K Chandran 
wrote:

On Sunday, 3 November 2019 at 14:01:03 UTC, Jesse Phillips



https://github.com/Rayerd/dfl


@Jesse Phillips,
Thank you for the reply.  Does DWT is built upon Java's SWT ? 
I heard that SWT is somewhat slower in windows. Anyhow, what 
about the easiness of DWT ? Actually, i just want to make GUI 
for Windows only. I dont need a cross platform GUI.


DTW is a translation of swt, I can speak to speed comparisons 
but I don't think you could apply anything out their related to 
comparing dfl and dwt.


You can write windows only apps in dwt, don't compile for 
Linux, it uses native drawing.


@Jesse Phillips,
Thanks a lot. :)


Re: Which is the active fork in DFL gui library ?

2019-11-04 Thread Vinod K Chandran via Digitalmars-d-learn

On Monday, 4 November 2019 at 19:29:22 UTC, Jacob Carlborg wrote:

On 2019-11-03 17:48, Vinod K Chandran wrote:


[...]


Yes. It's a full translation of the Java code to D. No JNI, JVM 
or Java or remains.



[...]


I don't know if that's the case. Also I don't know if that's 
related to Java/JVM. And I don't know how SWT and DWT compares 
in speed.



[...]


There's no GUI builder for DWT, if you're interested in that. 
In theory you could use one for SWT and translate the Java code 
to D, but that might be more troublesome.



[...]


DWT works on Windows and Linux. But you don't need to compile 
it for Linux if you don't want to.


@Jacob Carlborg,
Thanks for the detailed reply. Let me try it. :)


No UFCS with nested functions?

2019-11-04 Thread Tobias Pankrath via Digitalmars-d-learn
Why does the following not work? It works, if I move the 'prop' 
out of 'foo'.


---
struct S {
ubyte[12] bar;
}

bool foo (ref S s)
{
   static bool prop(const(ubyte)[] f) {
  return f.length > 1;
   }
return s.bar[].prop;
}
---

Thanks!




Using shared memory and thread

2019-11-04 Thread bioinfornatics via Digitalmars-d-learn

Dear,

I would like to put a buffer `shared(char[])` into a shared 
memory ( L2 cache ) and provide a start and end index to multiple 
thread in order to perform computation on a piece of original 
buffer.


I read doc from std.concurrency, std.parallelism, core.thead 
(druntime) and vectorization (simd) .  But I found any example or 
unittest which perform such calculus.


1/ So did you have an example somewhere ?
2/ about shared keyword do we ensure that its size is lower than 
L2 or L3 cache using :


```
core.sys.posix.unistd: sysconf, _SC_LEVEL2_CACHE_SIZE, 
_SC_LEVEL3_CACHE_SIZE;
immutable size_t L2_CACHE_SIZE = cast(size_t) 
sysconf(_SC_LEVEL2_CACHE_SIZE);
immutable size_t L3_CACHE_SIZE = cast(size_t) 
sysconf(_SC_LEVEL3_CACHE_SIZE);


```
3/ variable flagged as `shared` does at mean the variable is put 
into L2 cache ?


thanks for your help

best regards


Re: Which is the active fork in DFL gui library ?

2019-11-04 Thread Jacob Carlborg via Digitalmars-d-learn

On 2019-11-03 17:48, Vinod K Chandran wrote:


@Jesse Phillips,
Thank you for the reply.  Does DWT is built upon Java's SWT ? 


Yes. It's a full translation of the Java code to D. No JNI, JVM or Java 
or remains.



I heard that SWT is somewhat slower in windows.


I don't know if that's the case. Also I don't know if that's related to 
Java/JVM. And I don't know how SWT and DWT compares in speed.


Anyhow, what about the easiness 
of DWT ?


There's no GUI builder for DWT, if you're interested in that. In theory 
you could use one for SWT and translate the Java code to D, but that 
might be more troublesome.


Actually, i just want to make GUI for Windows only. I dont need 
a cross platform GUI.


DWT works on Windows and Linux. But you don't need to compile it for 
Linux if you don't want to.


--
/Jacob Carlborg


Dub and gitsubmodules

2019-11-04 Thread Sebastiaan Koppe via Digitalmars-d-learn
Does anyone know a reliable way of having a dub package that 
contains git submodules and is to be used as a dependency?


I am looking for a way to ensure the submodules are initialised 
before a build.


Re: Hum humm, build latest release with ldc

2019-11-04 Thread Treebeard via Digitalmars-d-learn

On Monday, 4 November 2019 at 09:49:03 UTC, Daniel Kozak wrote:
On Mon, Nov 4, 2019 at 10:45 AM Treebeard via 
Digitalmars-d-learn  wrote:


Hoom, hum, can you tell me some nice instructions to compile 
the latest release of DMD using LDC?


I walk slowly, but I love fast compilers.

---
But I spoke hastily. We must not be hasty. I have become too 
hot. I must cool myself and think; for it is easier to shout 
stop! than to do it - The Two Towers


https://git.archlinux.org/svntogit/community.git/tree/repos/community-x86_64/PKGBUILD?h=packages/dmd=344d0f94265571a55ca8213882151a5910bc4400#n54


Hum humm, accurate instructions, but hidden under a bush really 
out of the way ... you know the secrets of this forest in a 
really excellent way ...


---
Never is too long a word even for me... - The Return of the King


Re: Hum humm, build latest release with ldc

2019-11-04 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Nov 4, 2019 at 10:45 AM Treebeard via Digitalmars-d-learn
 wrote:
>
> Hoom, hum, can you tell me some nice instructions to compile the
> latest release of DMD using LDC?
>
> I walk slowly, but I love fast compilers.
>
> ---
> But I spoke hastily. We must not be hasty. I have become too hot.
> I must cool myself and think; for it is easier to shout stop!
> than to do it - The Two Towers

https://git.archlinux.org/svntogit/community.git/tree/repos/community-x86_64/PKGBUILD?h=packages/dmd=344d0f94265571a55ca8213882151a5910bc4400#n54


Hum humm, build latest release with ldc

2019-11-04 Thread Treebeard via Digitalmars-d-learn
Hoom, hum, can you tell me some nice instructions to compile the 
latest release of DMD using LDC?


I walk slowly, but I love fast compilers.

---
But I spoke hastily. We must not be hasty. I have become too hot. 
I must cool myself and think; for it is easier to shout stop! 
than to do it - The Two Towers