Re: [semi-OT] forum.dlang.org performance mentioned on Hacker News

2015-08-02 Thread Joakim via Digitalmars-d

On Sunday, 2 August 2015 at 15:46:40 UTC, dereck009 wrote:

On Sunday, 2 August 2015 at 15:33:42 UTC, David Nadlinger wrote:
Somebody just mentioned Vladimir's great work in a discussion 
on the Hacker News front page: 
https://news.ycombinator.com/item?id=9990763


 — David


Can we read about how the architecture of this site?

Where are the servers located?
Does it use any CDN?
Are all the pages cached static HTML or dynamic?


Seriously impressive performance.


Vlad, you have a blog: do you have the time to write this up?  We 
could put your post on Reddit/HN and get some attention on D.


Re: Rant after trying Rust a bit

2015-08-02 Thread via Digitalmars-d

On Sunday, 2 August 2015 at 21:17:10 UTC, Jonathan M Davis wrote:
types you're dealing with, and it allows user-defined code to 
have both an addition operator and a concatenation operator on 
the same type.


I assume you mean vectors, though I would prefer binary ++ for 
that.


Where distinguishing between + and ~ would likely make a big 
difference though is dynamic languages that aren't strict with 
types and allow nonsense like 5 + 2. And in that case, I 
expect that Walter is completely right. It's just error-prone 
to use + for concatenation in cases like that, and providing a 
separate concatenation operator would reduce bugs.


I've never run into such bugs, have you? The ambigious case
would be result: + 3 + 8 , but you can solve this by giving 
numeric plus higher precedence or avoid implicit conversion. 
Though, these days it is more common to support something like 
result: {{3+8}}.


Regardless, I definitely like the fact that we have ~ and ~= 
instead of reusing + and += for that. It's a small improvement, 
but it is an improvement.


It's a weird thing to do for a C-decendant as I would expect ~= 
to do binary negation.






Re: D for project in computational chemistry

2015-08-02 Thread Rikki Cattermole via Digitalmars-d

On 3/08/2015 4:25 a.m., Yura wrote:

Dear D coders/developers,

I am just thinking on one project in computational chemistry, and it is
sort of difficult for me to pick up the right language this project to
be written. The project is going to deal with the generation of the
molecular structures and will resemble to some extent some
bio-informatic stuff. Personally I code in two languages - Python, and a
little bit in C (just started to learn this language).

While it is easy to code in Python there are two things I do not like:

1) Python is slow for nested loops (much slower comparing to C)
2) Python is not compiled. However, I want to work with a code which can
be compiled and distributed as binaries (at least at the beginning).

When it comes to C, it is very difficult to code (I am a chemist rather
than computer scientist). The pointers, memory allocation, absence of
the truly dynamically allocated arrays, etc, etc make the coding very
long. C is too low level I believe.

I just wander how D would be suitable for my purpose? Please, correct me
if I am wrong, but in D the need of pointers is minimal, there is a
garbage collector, the arrays can be dynamically allocated, the arrays
can be sliced, ~=, etc which makes it similar to python at some extent.
I tried to write a little code in D and it was very much intuitive and
similar to what I did both in Python and C.

Any hints/thoughts/advises?

With kind regards,
Yury


Everyone else seems to be focusing on the technical aspects of why 
choose/not D.


To put it simply, just have a go!
Write a small prototype.
- Did you enjoy it?
- Did it reflect what you were thinking well?
- Can others understand it?

If you need help, feel free to jump on and post on D.learn.
If you need more interactive help, come on IRC. We have a channel on 
FreeNode and even OFTC.




Re: D for Game Development

2015-08-02 Thread Rikki Cattermole via Digitalmars-d

On 3/08/2015 1:35 p.m., Sebastiaan Koppe wrote:

On Sunday, 2 August 2015 at 14:03:50 UTC, Rikki Cattermole wrote:

Some of things that goes on in the modding world is truely amazing.

For every item/block with a recipe and vanilla items/blocks hardcoded.
It'll calculate at the start of runtime an EMC value in EE3. It does
it ridiculously fast.


I understand absolutely nothing about it.


I'll try my best to explain it.

- An item/block may or may not have a crafting recipe, it may have many 
or uses a non crafting mechanism to create

- There could be 200k-400k+ blocks and items per modded instance
- Each item/block may have an EMC value which is 1 .. int.max
- The EMC value is calculated based upon the crafting recipes and all 
items/blocks that makes it up EMC values

- Vanilla blocks/items have hard coded EMC values
- Optionally other mods items/blocks may be required to have their 
values hard coded so the calculation can work

- Back in EE2 it was all hard coded
- In EE3 very few are hard coded

The usage of the EMC value doesn't really matter. What does matter is 
that these calculations occur at the start of runtime. If this was 
poorly written this would have massive performance problems.


!in operator

2015-08-02 Thread Ali Çehreli via Digitalmars-d-learn

Is my understanding below correct? Does any documentation need updating?

Operator precedence table lists !in as an operator:

  http://wiki.dlang.org/Operator_precedence

Operator overloading documentation does not mention it:

  http://dlang.org/operatoroverloading.html#binary

However, 'a !in b' seems to be lowered to '!(a in b)'. It is possible to 
define !in but it is never called:


struct S
{
bool opBinaryRight(string op)(int i) const
if (op == in)
{
import std.stdio;
writeln(in);
return true;
}

bool opBinaryRight(string op)(int i) const
if (op == !in)
{
// Never called
assert(false);
return false;
}
}

void main()
{
auto s = S();
assert(42 in s);
assert(!(42 !in s));
}

The in overload gets called twice:

in
in

Ali


Error in std.stdio.d

2015-08-02 Thread MGW via Digitalmars-d

Error in std.stdio.d
This example doesn't work!

// dmd 2.067.1 Win 32
import std.stdio;

void main(string[] args) {
File fw = File(panic.csv, w);
for(int i; i != 5000; i++) {
fw.writeln(i, ;, Иванов;Пётр;Иванович);
}
fw.close();
// Test read
File fr = File(panic.csv, r);
int nom; string fam, nam, ot;
// Error format read
while(!fr.eof) fr.readf(%s;%s;%s;%s\n, nom, fam, nam, ot);
}

This mistake, is result of wrong algorithm with reading from the 
ring buffer of the file and return of the read symbols there in 
stdio function ungetc().


Re: Trouble with template parameter matching

2015-08-02 Thread Fusxfaranto via Digitalmars-d-learn

On Sunday, 2 August 2015 at 08:08:05 UTC, tcak wrote:

[code]
void func1(N)( const N name )
if( is(N: string) || is(N: char[]) )
{
func2( name );
}

[...]


This seems like the reasonable behavior to me.  Perhaps you 
should use Unqual?

http://dlang.org/phobos/std_traits.html#Unqual



Re: D for Game Development

2015-08-02 Thread thedeemon via Digitalmars-d

On Sunday, 2 August 2015 at 05:03:34 UTC, rsw0x wrote:
Furthermore, more often than not allocations in D on the heap 
contain no pointers/references at all (60% of all allocated 
memory in nearly every D program I tested that wasn't optimized 
to not use the GC contained no pointers/references.) and AFAIK 
the current GC makes no use of this fact.


Of course it does: memory allocated for data without pointers is 
not scanned (see core.memory.BlkAttr.NO_SCAN). It has been this 
way for ages.


Re: Arrays and struct assignment, pt. 2

2015-08-02 Thread Jonathan M Davis via Digitalmars-d

On Sunday, 2 August 2015 at 03:18:59 UTC, Etienne Cimon wrote:
On Sunday, 2 August 2015 at 02:49:03 UTC, Jonathan M Davis 
wrote:
On Sunday, 2 August 2015 at 01:50:50 UTC, David Nadlinger 
wrote:
Again, am I missing something obvious here? I can't quite 
believe that struct lifetime would have been quite as broken 
for so long.


I suspect that what it comes down to is that opAssign doesn't 
get used all that frequently. Most structs simply don't need 
it, so code which would hit the bug probably isn't all that 
common. Obviously, such code exists, but it requires using 
both opAssign and then putting those structs in arrays - and 
then catching the resulting bug (which you would hope would 
happen, but if the difference is subtle enough, it wouldn't 
necessarily be caught). And if structs with opAssign normally 
also define a postblit, then it's that much less likely that 
the problem would be hit.


- Jonathan M Davis


I couldn't get reference counted types to work as struct 
members, for some hard-to-track reason, and am actively 
avoiding it right now as a result. Maybe we've found a cause 
here? The might be a lot of people like me that gave up trying 
to track it, and are simply avoiding error-prone uses of 
structs.


Well, another thing to consider is that until very recently, 
structs that were on the heap didn't have their destructors run. 
So, there have been way too many holes with regards to this sort 
of thing and structs. I don't know how many people have stayed 
away from using structs in error-prone cases like this as opposed 
to simply had buggy code and not noticed it, but there very well 
may be quite a few folks out there who have hit this sort of 
thing and then been very confused about the subtle bugs that 
resulted, and it's just that no one who noticed figured it out 
well enough to report it.


- Jonathan M Davis


Re: Beta D 2.068.0-b2

2015-08-02 Thread Rainer Schuetze via Digitalmars-d-announce



On 31.07.2015 02:41, Joseph Cassman wrote:

Not sure if it ties in with DMD or not but a libucrt.lib missing error
was one of the several errors I got when trying to use VS2015 with DMD +
Win64. I do not get the error with VS2013u5 (the file exists with both
installations but is only recognized for the later for some reason).
Posting in case it helps isolate the issue for VisualD as well.

Joseph


I just updated my VS2015 installation and can confirm the error message 
regarding libucrt.lib.


I found the library in the folder c:\Program Files (x86)\Windows 
Kits\10\Lib\10.0.10150.0\ucrt\x64. You can add it to the library search 
paths in Tools-Options-Projects and Solutions-Visual D-DMD 
Directories-x64.


Unfortunately, that does not help a lot because Microsoft changed their 
C runtime quite a bit to make it more compliant to C99. This causes 
unresolved symbols when linking phobos.


Randomisation of array order

2015-08-02 Thread Matt via Digitalmars-d-learn
I was planning to use a dynamic array of indices to represent a 
deck of cards, and was wondering if there was any easy way to 
shuffle the arrays contents? I checked the library docs, but 
came to the conclusion that sorting arrays is a much more common 
operation :)


If anyone has a suggestion on a good way to implement this, I'd 
appreciate it. I don't need you to code it for me ( although I 
wouldn't turn it down if you've already done it), just a 
suggestion of what to do would be appreciated


[Issue 14861] New: Error in stdio.d in LockingTextReader.readFront()

2015-08-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14861

  Issue ID: 14861
   Summary: Error in stdio.d in LockingTextReader.readFront()
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: critical
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: m...@yandex.ru

This mistake, is result of wrong algorithm with reading from the ring buffer of
the file and return of the read symbols there in stdio function ungetc().

This example doesn't work!

// dmd 2.067.1 Win 32
import std.stdio;

void main(string[] args) {
File fw = File(panic.csv, w);
for(int i; i != 5000; i++) fw.writeln(i, ;, Иванов;Пётр;Петрович);
fw.close();
// Test read
File fr = File(panic.csv, r);
int nom; string fam, nam, ot;
// Error format read
while(!fr.eof) fr.readf(%s;%s;%s;%s\n, nom, fam, nam, ot);
}

--


Re: Error in std.stdio.d

2015-08-02 Thread Jonathan M Davis via Digitalmars-d

On Sunday, 2 August 2015 at 06:01:01 UTC, MGW wrote:

Error in std.stdio.d
This example doesn't work!

// dmd 2.067.1 Win 32
import std.stdio;

void main(string[] args) {
File fw = File(panic.csv, w);
for(int i; i != 5000; i++) {
fw.writeln(i, ;, Иванов;Пётр;Иванович);
}
fw.close();
// Test read
File fr = File(panic.csv, r);
int nom; string fam, nam, ot;
// Error format read
	while(!fr.eof) fr.readf(%s;%s;%s;%s\n, nom, fam, nam, 
ot);

}

This mistake, is result of wrong algorithm with reading from 
the ring buffer of the file and return of the read symbols 
there in stdio function ungetc().


Please report the issue at https://issues.dlang.org if you have 
not already.


- Jonathan M Davis


Re: D for Game Development

2015-08-02 Thread rsw0x via Digitalmars-d

On Sunday, 2 August 2015 at 06:25:34 UTC, thedeemon wrote:

On Sunday, 2 August 2015 at 05:03:34 UTC, rsw0x wrote:
Furthermore, more often than not allocations in D on the heap 
contain no pointers/references at all (60% of all allocated 
memory in nearly every D program I tested that wasn't 
optimized to not use the GC contained no pointers/references.) 
and AFAIK the current GC makes no use of this fact.


Of course it does: memory allocated for data without pointers 
is not scanned (see core.memory.BlkAttr.NO_SCAN). It has been 
this way for ages.


Partially correct.

If you compare the amount of memory allocated by the GC that is 
marked NO_SCAN compared to passing precise type information with 
the allocation many, many allocations that are without 
pointers/references are not marked NO_SCAN.


[Issue 14862] New: Constructor of overlapped struct does not initialize correctly global variables

2015-08-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14862

  Issue ID: 14862
   Summary: Constructor of overlapped struct does not initialize
correctly global variables
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: blocker
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: ru...@rumbu.ro

struct S
{
union
{
struct { uint hi, lo; }
ulong data;
}

this(ulong data)
{
this.data = data;
}
}

immutable S sglobal = S(123UL); //not run
enum S senum = S(123UL);

void main()
{
   S slocal = S(123UL);
   assert(slocal.data == 123UL);
   assert(senum.data == 123UL);
   assert(sglobal.data == 123UL); //fail, in fact it's 0
}

BUT by inversing the overlapped fields, the struct it's initialized properly:

struct S
{
union
{
ulong data; 
struct { uint hi, lo; }
}
}

--


Trouble with template parameter matching

2015-08-02 Thread tcak via Digitalmars-d-learn

[code]
void func1(N)( const N name )
if( is(N: string) || is(N: char[]) )
{
func2( name );
}

void func2(N)( const N name )
if( is(N: string) || is(N: char[]) )
{}

void main(){
char[] blah = ['b', 'l', 'a', 'h'];

func1( blah );
//func1( blah );// this works
}
[/code]

[result]
test.d(4): Error: template test.func2 cannot deduce function from 
argument types !()(const(char[])), candidates are:
test.d(7):test.func2(N)(const N name) if (is(N : string) 
|| is(N : char[]))

[/result]

When func1 is called with blah variable, I assume that N is 
char[].


From there, when func2 is called by func1, name should be 
const(char[]).


But since func2 defined name parameter with const, shouldn't the 
compiler accept const part of const(char[]) as func2's const, and 
accept N as char[] still?


Otherwise, it is being weirdly recursive, and requires casting.


Re: Randomisation of array order

2015-08-02 Thread Matt via Digitalmars-d-learn

...And then I realised that I hadn't looked inside std.random.

Question solved, because I am a dumbass.


Re: Randomisation of array order

2015-08-02 Thread cym13 via Digitalmars-d-learn

On Sunday, 2 August 2015 at 09:24:12 UTC, Matt wrote:
I was planning to use a dynamic array of indices to represent a 
deck of cards, and was wondering if there was any easy way to 
shuffle the arrays contents? I checked the library docs, but 
came to the conclusion that sorting arrays is a much more 
common operation :)


If anyone has a suggestion on a good way to implement this, I'd 
appreciate it. I don't need you to code it for me ( although I 
wouldn't turn it down if you've already done it), just a 
suggestion of what to do would be appreciated


Have you checked std.random ?

import std.random, std.stdio;

void main() {
auto arr = [1, 2, 3, 4, 5];
arr.randomShuffle;
arr.writeln;
}


Re: Beta D 2.068.0-b2

2015-08-02 Thread Rainer Schuetze via Digitalmars-d-announce



On 02.08.2015 11:38, Martin Nowak wrote:

On Thursday, 30 July 2015 at 09:24:09 UTC, John Colvin wrote:

https://www.microsoft.com/en-us/download/details.aspx?id=46886


Does it include the C++ compiler and linker?


No, the VS shell does not include any specific language support and 
libraries.


Re: store template value

2015-08-02 Thread maarten van damme via Digitalmars-d-learn
Oh, neat. This saves the day :)

2015-08-01 23:22 GMT+02:00 Ali Çehreli digitalmars-d-learn@puremagic.com:

 On 08/01/2015 08:37 AM, maarten van damme via Digitalmars-d-learn wrote:

 I have a class that creates a task in it's constructor. How do I store
 this
 created task as one of it's value members and later on call .yieldForce()?


 Tasks can be created with a function pointer 'function parameter' as well.
 (This has already been added to Programming in D but it is not available
 on the web site yet.)

 I learned the exact type by the help of pragma(msg) below and used it to
 create MyTask and myTasks:

 import std.parallelism;

 double foo(int i)
 {
 return i * 1.5;
 }

 double bar(int i)
 {
 return i * 2.5;
 }

 void main()
 {
 auto tasks = [ task(foo, 1),
task(bar, 2) ];// ← compiles

 pragma(msg, typeof(tasks[0]));

 alias MyTask = Task!(run, double function(int), int)*;

 MyTask[] myTasks;
 myTasks ~= task(foo, 1);
 myTasks ~= task(bar, 2);
 }

 Ali




Re: Russian-speaking community

2015-08-02 Thread Majestio via Digitalmars-d-announce

On Tuesday, 30 June 2015 at 20:39:38 UTC, lomereiter wrote:

(whose domain is much easier to remember, btw)


We have already moved to http://dlanguage.ru




Re: D for Game Development

2015-08-02 Thread Sebastiaan Koppe via Digitalmars-d

On Friday, 31 July 2015 at 03:29:59 UTC, Brandon Ragland wrote:
People see minecraft as terrible graphics, pixellated but 
each block represents 16 triangles


I really hope they don't render a block with 16 triangles.

and there could be thousands of blocks on screen. You're easily 
looking at 200,000 triangles on far render mode.


Look up triangles/sec on modern video cards, you'll be surprised.

Then you have folks who use 512x512 mapped images per block, so 
now you have a HUGE textel density.


People need to get their facts straight. I don't like 
Minecraft, but by no means in Minecraft some amateur game from 
1990s running terribly on a computer.


Compared to real games, it is.


Re: Beta D 2.068.0-b2

2015-08-02 Thread John Colvin via Digitalmars-d-announce

On Sunday, 2 August 2015 at 09:38:23 UTC, Martin Nowak wrote:

On Thursday, 30 July 2015 at 09:24:09 UTC, John Colvin wrote:

https://www.microsoft.com/en-us/download/details.aspx?id=46886


Does it include the C++ compiler and linker?


I think it contains a linker, but I'm not 100% sure. See 
https://msdn.microsoft.com/en-us/library/bb129445.aspx for some 
info


Re: How disruptive is the GC?

2015-08-02 Thread Temtaime via Digitalmars-d-learn
I'm writing a game engine in D. Try to minimize allocations and 
that's will be OK.
I'm using delegates and all the phobos stuff. I allocate only in 
few places at every frame.

So i can reach 1K fps on a complicated scene.

GC is not a problem. DMD optimizes so ugly that all the math is 
very, very slow.

DMD gives me about 200 fps, when with LDC i can reach 1k.


Re: Struct that destroys its original handle on copy-by-value

2015-08-02 Thread Joseph Rushton Wakeling via Digitalmars-d-learn

On 02/08/15 03:38, Dicebot via Digitalmars-d-learn wrote:

On Saturday, 1 August 2015 at 17:50:28 UTC, John Colvin wrote:

I'm not sure how good an idea it is to totally enforce a range to be
non-copyable, even if you could deal with the function call chain problem.
Even in totally save-aware code, there can still be valid assignment of a
range type. I'm pretty sure a lot of phobos ranges/algorithms would be unusable.


This is exactly why I proposed to Joe design with destructive copy originally -
that would work with any algorithms expecting implicit pass by value but prevent
from actual double usage.

Sadly, this does not seem to be implementable in D in any reasonable way.


Yup.  This work is follow-up on a really creative bunch of suggestions Dicebot 
made to me on our flight back from DConf, and which we followed up on at the 
recent Berlin meetup.


The design principle of destructive copy is great -- it really cuts through a 
bunch of potential nastinesses around random number generation -- but it really 
doesn't look like it's straightforwardly possible :-(




Re: D for Game Development

2015-08-02 Thread rcorre via Digitalmars-d

On Thursday, 30 July 2015 at 13:43:35 UTC, karabuta wrote:
D is really cool and makes a good candidate for developing a 
game. Are there any guys out there using D for indie games?


I hack away at little games in D whenever I can find some free 
time.

My previous project was a strategy game:
https://github.com/rcorre/terra-arcana

I've abandoned it for now to move on to a less complex project 
that I can hopefully finish, but it did get to a playable state.


As far as the GC stuff, I haven't run into issues like I used to 
with C#+XNA, but I also haven't been pushing the limits on 
allocations (my last two projects were turn-based-strategy).


For now, D just seems to make me more productive than any other 
language I've tried. I'm hoping that if I do run into memory 
issues, std.allocator may be able to help.


[Issue 14858] spurious Error: overload alias 'foo' is not a variable when overloading template and non-template via aliases

2015-08-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14858

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||pull
   Hardware|x86_64  |All
 OS|Linux   |All

--- Comment #1 from Kenji Hara k.hara...@gmail.com ---
https://github.com/D-Programming-Language/dmd/pull/4857

--


[semi-OT] forum.dlang.org performance mentioned on Hacker News

2015-08-02 Thread David Nadlinger via Digitalmars-d
Somebody just mentioned Vladimir's great work in a discussion on 
the Hacker News front page: 
https://news.ycombinator.com/item?id=9990763


 — David


Dynamic bindings to global variables

2015-08-02 Thread remi thebault via Digitalmars-d-learn

Hello

I wrote static bindings to a C library. I want to also offer a 
version(Dynamic) of the bindings.
I follow and use derelict-util to get the address of function 
pointers.


In the library I bind, there is also global variables. here's one 
example in the static bindings:


extern __gshared wl_interface wl_display_interface;

(wl_interface is a struct, not a pointer alias)

How would one make dynamic binding of this?
Is it possible to retrieve the address of the symbol and use 
std.conv.emplace?


thank you


Re: D for Game Development

2015-08-02 Thread Rikki Cattermole via Digitalmars-d

On 3/08/2015 1:51 a.m., Sebastiaan Koppe wrote:

On Friday, 31 July 2015 at 03:29:59 UTC, Brandon Ragland wrote:


snip


People need to get their facts straight. I don't like Minecraft, but
by no means in Minecraft some amateur game from 1990s running terribly
on a computer.


Compared to real games, it is.


Some of things that goes on in the modding world is truely amazing.
I can't find the tweets about it from @pahimar. But:
For every item/block with a recipe and vanilla items/blocks hardcoded. 
It'll calculate at the start of runtime an EMC value in EE3. It does it 
ridiculously fast.


He did an amazing job of optimizing it. I generally believe that we 
probably couldn't even match it in D.


Unfortunately Vanilla Minecraft is quite a dog still, but getting better 
slowly. Even with the mass breakages of mods in the mean time.


[Issue 14863] New: CLOCK_BOOTTIME should be optional to support 2.6.39 kernels

2015-08-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14863

  Issue ID: 14863
   Summary: CLOCK_BOOTTIME should be optional to support 2.6.39
kernels
   Product: D
   Version: D2
  Hardware: Other
OS: Linux
Status: NEW
  Severity: regression
  Priority: P1
 Component: druntime
  Assignee: issues.dl...@jmdavisprog.com
  Reporter: c...@dawg.eu
CC: schvei...@yahoo.com

Currently crashes every D binary on an older kernel.
We might reconsider to lazily initialize the resolutions.

http://forum.dlang.org/post/yfaddcwesfupysxda...@forum.dlang.org

MonoTime is the replacement for TickDuration and it's initialized from the
runtime initialization function (rt_init). This is because the GC and others
may need time functionality.

Unfortunately, it looks like MonoTime does not currently support your kernel
version. It needs at least Linux 2.6.39. The reason being is that it has the
CLOCK_BOOTTIME clock which was implemented in Linux 2.6.39. Without this clock,
the minimum version would be Linux 2.6.32.

--


Re: Beta D 2.068.0-b2

2015-08-02 Thread Martin Nowak via Digitalmars-d-announce

On Friday, 31 July 2015 at 17:56:23 UTC, Kelet wrote:

Hi Gerald,

MonoTime is the replacement for TickDuration and it's 
initialized from the runtime initialization function (rt_init). 
This is because the GC and others may need time functionality.


Thanks, filed as https://issues.dlang.org/show_bug.cgi?id=14863.


[Issue 14860] Destructor is not called for block assignment

2015-08-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14860

--- Comment #3 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/fd8af3a98e1deb370aecf940c939f8a7794a850e
fix Issue 14860 - Destructor is not called for block assignment

https://github.com/D-Programming-Language/dmd/commit/286906ba8ffe9e75905998fd99a6349b7a0f6b4e
Merge pull request #4856 from 9rnsr/fix14860

Issue 14860 - Destructor is not called for block assignment

--


Re: Dynamic bindings to global variables

2015-08-02 Thread Mike Parker via Digitalmars-d-learn

On Sunday, 2 August 2015 at 15:31:48 UTC, remi thebault wrote:

Hello

I wrote static bindings to a C library. I want to also offer a 
version(Dynamic) of the bindings.
I follow and use derelict-util to get the address of function 
pointers.


In the library I bind, there is also global variables. here's 
one example in the static bindings:


extern __gshared wl_interface wl_display_interface;

(wl_interface is a struct, not a pointer alias)

How would one make dynamic binding of this?
Is it possible to retrieve the address of the symbol and use 
std.conv.emplace?


You have to declare it as a pointer, then retrieve the pointer in 
the same way you do the function pointers, via the system loader 
(GetProcAddress/dlsym).


Re: Beta D 2.068.0-b2

2015-08-02 Thread Rainer Schuetze via Digitalmars-d-announce



On 31.07.2015 09:54, Kagamin wrote:

On Thursday, 30 July 2015 at 18:54:03 UTC, Rainer Schuetze wrote:

That was fast. Thanks!


README in github repo still has some outdated links to dsource. Also
bugzilla address is https://issues.dlang.org/


I removed most dsource links (also from the documentation), but some are 
still valid and not available elsewhere (e.g. download links of files 
only found there).


I didn't immediately get what you meant with the bugzilla address 
because it worked due to redirection. I'll update that later...


Re: Beta D 2.068.0-b1

2015-08-02 Thread Martin Nowak via Digitalmars-d-announce

On Sunday, 26 July 2015 at 12:00:09 UTC, Martin Nowak wrote:
Could someone please try the fix 
https://issues.dlang.org/show_bug.cgi?id=14801#c2.


Please try again, we updated the fix.
https://issues.dlang.org/show_bug.cgi?id=14801#c11


[Issue 14860] Destructor is not called for block assignment

2015-08-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14860

--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/35f1f6226aa523305e41f3dee68fbb0ce8fafdf4
Supplemental fix for issue 14860

`task[] = RTask.init;` has two bugs:

1. `RTask` is a nested struct, so `RTask.init` contains null context pointer.
2. That is a block assignment, so there is a possibility to call
   `RTask.~this()` on garbage objects (stack allocated `buf` is initialized by
`void`).

Fixed to use `emplaceRef` on each elements.

https://github.com/D-Programming-Language/phobos/commit/deeab6c867fbed479fe57604a52f25e360f0b410
Merge pull request #3522 from 9rnsr/fix14860

Supplemental fix for issue 14860

--


Re: Trouble with template parameter matching

2015-08-02 Thread anonymous via Digitalmars-d-learn

On Sunday, 2 August 2015 at 08:08:05 UTC, tcak wrote:

[code]
void func1(N)( const N name )
if( is(N: string) || is(N: char[]) )
{
func2( name );
}

void func2(N)( const N name )
if( is(N: string) || is(N: char[]) )
{}

void main(){
char[] blah = ['b', 'l', 'a', 'h'];

func1( blah );
//func1( blah );// this works
}
[/code]

[result]
test.d(4): Error: template test.func2 cannot deduce function 
from argument types !()(const(char[])), candidates are:
test.d(7):test.func2(N)(const N name) if (is(N : 
string) || is(N : char[]))

[/result]

When func1 is called with blah variable, I assume that N is 
char[].


Yup.

From there, when func2 is called by func1, name should be 
const(char[]).


Yup.

But since func2 defined name parameter with const, shouldn't 
the compiler accept const part of const(char[]) as func2's 
const, and accept N as char[] still?


Nope. When removing the top level const of `const(char[])`, it 
becomes `const(char)[]`. Test for that in your template 
constraint and it works.




Re: SDLang-D v0.9.2

2015-08-02 Thread David Gileadi via Digitalmars-d-announce

On 8/1/15 1:20 PM, Nick Sabalausky wrote:

On Saturday, 1 August 2015 at 20:14:52 UTC, Nick Sabalausky wrote:

On Saturday, 1 August 2015 at 17:57:30 UTC, John Colvin wrote:


Haven't looked at this at all really, just a quick question:

Are there straightforward library calls or command line utilities for
converting between the shared subset of json and SDL?


No, but there definitely should be. I'll post a ticket so I don't forget.


https://github.com/Abscissa/SDLang-D/issues/30


Without having looked at the library, perhaps this util would make some 
good sample code.


Re: Interpreting the D grammar

2015-08-02 Thread Xinok via Digitalmars-d

On Sunday, 2 August 2015 at 14:50:35 UTC, Jacob Carlborg wrote:
I'm trying to read the D grammar [1] to enhance the D TextMate 
bundle. If we take the add expression as an example. It's 
defined like this in the grammar:


AddExpression:
MulExpression
AddExpression + MulExpression
AddExpression - MulExpression
CatExpression

And like this in the grammar made by Brian [2]:

addExpression:
  mulExpression
| addExpression ('+' | '-' | '~') mulExpression
;

I'm not so familiar with grammars but this looks like it's 
recursive. Is it possible to translate this piece of grammar to 
a regular expression? TextMate uses regular expressions and a 
couple of enhancements/extensions to define a grammar for a 
language.


[1] http://dlang.org/grammar.html
[2] https://rawgit.com/Hackerpilot/DGrammar/master/grammar.html


I guess you're not familiar with the theoretical aspect of 
formal languages. The D grammar is a context-free grammar which 
cannot be reduced to a regular expression. As cym13 stated, there 
are some simple context-free grammars which can be rewritten as 
regular expressions, but the D grammar cannot be. Take a look at 
the Chomsky Hierarchy [1] for a better understanding.


The classic example of a context-free language is the set of 
balanced parenthesis, i.e. (()) is balanced and () is not. 
This language is not regular meaning you cannot write a regular 
expression for it, but you can write a context-free grammar for 
it.


[1] https://en.wikipedia.org/wiki/Chomsky_hierarchy#The_hierarchy


Re: Interpreting the D grammar

2015-08-02 Thread Jacob Carlborg via Digitalmars-d

On 02/08/15 18:08, cym13 wrote:


You can't build a regular expression for any grammar. You can for some
grammars but those are only a simple subset. For example, checking
parens balance is impossible with common (not recursive) regular
expressions only, and even with recursion it soon reaches its limitations.


TextMate grammars support recursion, it's possible to define a grammar 
with balanced parentheses [1].


[1] https://manual.macromates.com/en/language_grammars

--
/Jacob Carlborg


Re: Interpreting the D grammar

2015-08-02 Thread cym13 via Digitalmars-d

On Sunday, 2 August 2015 at 17:29:57 UTC, Jacob Carlborg wrote:

On 02/08/15 18:08, cym13 wrote:

You can't build a regular expression for any grammar. You can 
for some
grammars but those are only a simple subset. For example, 
checking
parens balance is impossible with common (not recursive) 
regular
expressions only, and even with recursion it soon reaches its 
limitations.


TextMate grammars support recursion, it's possible to define a 
grammar with balanced parentheses [1].


[1] https://manual.macromates.com/en/language_grammars


Yes, that will work for this simple example, but what of 
interleaved parentheses ? Say you want (), [] and  to match, 
how can you do ?


[[(](), ])(, )]]

There are constructs that aren't possibly doable using even 
extend regular expressions. That's why grammars were invented 
after all.


Reading your documentation, it seems that you are not expected to 
reduce the grammar to a regular expression, rather it uses many 
regular expressions to describes parts of the language grammar, 
so that should work.


Re: Dynamic bindings to global variables

2015-08-02 Thread remi thebault via Digitalmars-d-learn

On Sunday, 2 August 2015 at 16:20:29 UTC, remi thebault wrote:

On Sunday, 2 August 2015 at 15:38:34 UTC, Mike Parker wrote:
You have to declare it as a pointer, then retrieve the pointer 
in the same way you do the function pointers, via the system 
loader (GetProcAddress/dlsym).


and how would you make this source compatible with the static 
binding version?

I guess it is not possible

extern(C):
version(Dynamic) {
__gshared wl_interface *wl_display_interface;
}
else {
extern __gshared wl_interface wl_display_interface;
}


// use case: some_func expects a pointer to wl_interface
// the C version is using addressof operator, (as do the static 
D bindings)

some_func(wl_display_interface);


I'll manage this through static @property-ies

thanks for your help

Rémi


Re: [semi-OT] forum.dlang.org performance mentioned on Hacker News

2015-08-02 Thread dereck009 via Digitalmars-d

On Sunday, 2 August 2015 at 15:33:42 UTC, David Nadlinger wrote:
Somebody just mentioned Vladimir's great work in a discussion 
on the Hacker News front page: 
https://news.ycombinator.com/item?id=9990763


 — David


Can we read about how the architecture of this site?

Where are the servers located?
Does it use any CDN?
Are all the pages cached static HTML or dynamic?


Seriously impressive performance.



Re: std.data.json formal review

2015-08-02 Thread Dmitry Olshansky via Digitalmars-d

On Wednesday, 29 July 2015 at 15:22:06 UTC, Don wrote:

On Tuesday, 28 July 2015 at 22:29:01 UTC, Walter Bright wrote:

[snip]

Related to this: it should not be importing std.bigint. Note 
that if std.bigint were fully implemented, it would be very 
heavyweight (optimal multiplication of enormous integers 
involves fast fourier transforms and all kinds of odd stuff, 
that's really bizarre to pull in if you're just parsing a 
trivial little JSON config file).


Although it is possible for JSON to contain numbers which are 
larger than can fit into long or ulong, it's an abnormal case. 
Many apps (probably, almost all) will want to reject such 
numbers immediately. BigInt should be opt-in.


And, it is also possible to have floating point numbers that 
are not representable in double or real. BigInt doesn't solve 
that case.


It might be adequate to simply present it as a raw number (an 
unconverted string) if it isn't a built-in type. Parse it for 
validity, but don't actually convert it.


Actually JSON is defined as subset of EMCASCript-262 spec hence 
it may not ciontain anything other 64-bit5 IEEE-754 numbers 
period.

See:
http://www.ecma-international.org/ecma-262/6.0/index.html#sec-terms-and-definitions-number-value
http://www.ecma-international.org/ecma-262/6.0/index.html#sec-ecmascript-language-types-number-type

Anything else is e-hm an extension (or simply put - violation 
of spec), I've certainly seen 64-bit integers in the wild - how 
often true big ints are found out there?


If no one can present some run of the mill REST JSON API breaking 
the rules I'd suggest demoting BigInt handling to optional 
feature.





Re: Interpreting the D grammar

2015-08-02 Thread Xinok via Digitalmars-d

On Sunday, 2 August 2015 at 17:33:35 UTC, Jacob Carlborg wrote:

On 02/08/15 18:37, MakersF wrote:

Of course it's recursive! Do you want the grammar to be able 
to only

define a finite number of programs?


I don't know how this work, that's why I'm asking. But I read 
something about left recursion needs to be removed to be able 
to parse a grammar, at least for some parsers.


There's lots of videos online that show you how to do this. I 
suppose some parsers are smart enough to rewrite the grammar to 
remove left recursion. Otherwise, for a simple parser which does 
nothing more than a breadth-first search, it may require 
exponential time to parse a string.


Re: Interpreting the D grammar

2015-08-02 Thread Jacob Carlborg via Digitalmars-d

On 02/08/15 19:15, Xinok wrote:


I guess you're not familiar with the theoretical aspect of formal
languages. The D grammar is a context-free grammar which cannot be
reduced to a regular expression. As cym13 stated, there are some simple
context-free grammars which can be rewritten as regular expressions, but
the D grammar cannot be. Take a look at the Chomsky Hierarchy [1] for a
better understanding.

The classic example of a context-free language is the set of balanced
parenthesis, i.e. (()) is balanced and () is not. This language is
not regular meaning you cannot write a regular expression for it, but
you can write a context-free grammar for it.


TextMate grammars are not _just_ regular expressions. They can define 
balanced parentheses [1].


The point of a language grammar in a text editor is not to have a 100% 
correct implementation of the grammar. Rather it should syntax highlight 
the code in a way that is useful for the user.


[1] https://manual.macromates.com/en/language_grammars

--
/Jacob Carlborg


[Issue 14861] Error in stdio.d in LockingTextReader.readFront()

2015-08-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14861

--- Comment #1 from MGW m...@yandex.ru ---
Size ring buffer = 16384 bytes in struct _iobuf*. If Utf-8 sequence is broken
off on buffer boundary, it is impossible to return earlier read characters, as
in the buffer absolutely other data.

--


Re: Interpreting the D grammar

2015-08-02 Thread MakersF via Digitalmars-d

On Sunday, 2 August 2015 at 14:50:35 UTC, Jacob Carlborg wrote:
I'm trying to read the D grammar [1] to enhance the D TextMate 
bundle. If we take the add expression as an example. It's 
defined like this in the grammar:


AddExpression:
MulExpression
AddExpression + MulExpression
AddExpression - MulExpression
CatExpression

And like this in the grammar made by Brian [2]:

addExpression:
  mulExpression
| addExpression ('+' | '-' | '~') mulExpression
;

I'm not so familiar with grammars but this looks like it's 
recursive. Is it possible to translate this piece of grammar to 
a regular expression? TextMate uses regular expressions and a 
couple of enhancements/extensions to define a grammar for a 
language.


[1] http://dlang.org/grammar.html
[2] https://rawgit.com/Hackerpilot/DGrammar/master/grammar.html


Of course it's recursive! Do you want the grammar to be able to 
only define a finite number of programs?


But in this case you could write the original grammar rule as
mul |
cat |
(mul|cat)((+|-) (mul|cat))* (+|-) (mul|cat)

but you lose the precedence of the operation as it is a flat list 
and not a tree


Re: Interpreting the D grammar

2015-08-02 Thread Jacob Carlborg via Digitalmars-d

On 02/08/15 18:37, MakersF wrote:


Of course it's recursive! Do you want the grammar to be able to only
define a finite number of programs?


I don't know how this work, that's why I'm asking. But I read something 
about left recursion needs to be removed to be able to parse a grammar, 
at least for some parsers.



But in this case you could write the original grammar rule as
mul |
cat |
(mul|cat)((+|-) (mul|cat))* (+|-) (mul|cat)

but you lose the precedence of the operation as it is a flat list and
not a tree


I don't think that's important for syntax highlighting.

--
/Jacob Carlborg


Re: D for project in computational chemistry

2015-08-02 Thread ZombineDev via Digitalmars-d

On Sunday, 2 August 2015 at 16:25:18 UTC, Yura wrote:

Dear D coders/developers,

I am just thinking on one project in computational chemistry, 
and it is sort of difficult for me to pick up the right 
language this project to be written. The project is going to 
deal with the generation of the molecular structures and will 
resemble to some extent some bio-informatic stuff. Personally I 
code in two languages - Python, and a little bit in C (just 
started to learn this language).


While it is easy to code in Python there are two things I do 
not like:


1) Python is slow for nested loops (much slower comparing to C)
2) Python is not compiled. However, I want to work with a code 
which can be compiled and distributed as binaries (at least at 
the beginning).


When it comes to C, it is very difficult to code (I am a 
chemist rather than computer scientist). The pointers, memory 
allocation, absence of the truly dynamically allocated arrays, 
etc, etc make the coding very long. C is too low level I 
believe.


I just wander how D would be suitable for my purpose? Please, 
correct me if I am wrong, but in D the need of pointers is 
minimal, there is a garbage collector, the arrays can be 
dynamically allocated, the arrays can be sliced, ~=, etc which 
makes it similar to python at some extent. I tried to write a 
little code in D and it was very much intuitive and similar to 
what I did both in Python and C.


Any hints/thoughts/advises?

With kind regards,
Yury


I'd say go for it. My experience with D is that you can use it 
both for fast (to write and execute) scripts and for large 
enterprise applications. You can certainly view it as a easier 
version of C, though it can offer a lot more if you need it. 90% 
of the syntax is the same as C, so there shouldn't be gotchas in 
the basic stuff.


Recently at DConf [1] John Colvin gave a talk [2] about using D 
for science which will probably be interesting for you.


Good luck :)

[1]: http://dconf.org/2015/schedule/index.html
[2]: https://www.youtube.com/watch?v=edjrSDjkfko D Is For Science


Is Key Type?

2015-08-02 Thread Xinok via Digitalmars-d-learn
is there a trait in D or Phobos which will tell you if a type can 
be used as a key for an associative array? For example, where T 
is some type:


static assert(isKeyType!T)
int[T] hashTable = ...


Re: D for project in computational chemistry

2015-08-02 Thread Daniel N via Digitalmars-d

On Sunday, 2 August 2015 at 16:25:18 UTC, Yura wrote:


Any hints/thoughts/advises?

With kind regards,
Yury


Dear Yura,

D is a perfect fit.

For performance reasons, when releasing your binary make sure to 
use one of these compilers:

GDC - GCC  D Compiler (comparable performance to gcc)
LDC - LLVM D Compiler (comparable performance to clang)

Usually D is on par with C, if performance is less than expected 
it probably means you forgot one optimization switch, especially 
singleobj is non-intuitive for ldc2, but can have a dramatic 
impact.


ex
ldc2 -O5 -inline -release -singleobj -boundscheck=off

Best Regards,
Daniel N



Re: Interpreting the D grammar

2015-08-02 Thread cym13 via Digitalmars-d

On Sunday, 2 August 2015 at 14:50:35 UTC, Jacob Carlborg wrote:
I'm trying to read the D grammar [1] to enhance the D TextMate 
bundle. If we take the add expression as an example. It's 
defined like this in the grammar:


AddExpression:
MulExpression
AddExpression + MulExpression
AddExpression - MulExpression
CatExpression

And like this in the grammar made by Brian [2]:

addExpression:
  mulExpression
| addExpression ('+' | '-' | '~') mulExpression
;

I'm not so familiar with grammars but this looks like it's 
recursive. Is it possible to translate this piece of grammar to 
a regular expression? TextMate uses regular expressions and a 
couple of enhancements/extensions to define a grammar for a 
language.


[1] http://dlang.org/grammar.html
[2] https://rawgit.com/Hackerpilot/DGrammar/master/grammar.html


You can't build a regular expression for any grammar. You can for 
some grammars but those are only a simple subset. For example, 
checking parens balance is impossible with common (not recursive) 
regular expressions only, and even with recursion it soon reaches 
its limitations.


Re: Dynamic bindings to global variables

2015-08-02 Thread remi thebault via Digitalmars-d-learn

On Sunday, 2 August 2015 at 15:38:34 UTC, Mike Parker wrote:
You have to declare it as a pointer, then retrieve the pointer 
in the same way you do the function pointers, via the system 
loader (GetProcAddress/dlsym).


and how would you make this source compatible with the static 
binding version?

I guess it is not possible

extern(C):
version(Dynamic) {
__gshared wl_interface *wl_display_interface;
}
else {
extern __gshared wl_interface wl_display_interface;
}


// use case: some_func expects a pointer to wl_interface
// the C version is using addressof operator, (as do the static D 
bindings)

some_func(wl_display_interface);


D for project in computational chemistry

2015-08-02 Thread Yura via Digitalmars-d

Dear D coders/developers,

I am just thinking on one project in computational chemistry, and 
it is sort of difficult for me to pick up the right language this 
project to be written. The project is going to deal with the 
generation of the molecular structures and will resemble to some 
extent some bio-informatic stuff. Personally I code in two 
languages - Python, and a little bit in C (just started to learn 
this language).


While it is easy to code in Python there are two things I do not 
like:


1) Python is slow for nested loops (much slower comparing to C)
2) Python is not compiled. However, I want to work with a code 
which can be compiled and distributed as binaries (at least at 
the beginning).


When it comes to C, it is very difficult to code (I am a chemist 
rather than computer scientist). The pointers, memory allocation, 
absence of the truly dynamically allocated arrays, etc, etc make 
the coding very long. C is too low level I believe.


I just wander how D would be suitable for my purpose? Please, 
correct me if I am wrong, but in D the need of pointers is 
minimal, there is a garbage collector, the arrays can be 
dynamically allocated, the arrays can be sliced, ~=, etc which 
makes it similar to python at some extent. I tried to write a 
little code in D and it was very much intuitive and similar to 
what I did both in Python and C.


Any hints/thoughts/advises?

With kind regards,
Yury



Re: DMD on WIndows 10

2015-08-02 Thread Timon Gehr via Digitalmars-d

On 08/01/2015 12:02 AM, Paul D Anderson wrote:

p.s. Please don't tell me how much better your favorite operating system
is than Windows. Thank you. :)


There are plenty operating systems that are not my favourite, yet still 
much better than Windows.


Re: Russian-speaking community

2015-08-02 Thread Suliman via Digitalmars-d-announce

On Sunday, 2 August 2015 at 12:11:03 UTC, Majestio wrote:

On Tuesday, 30 June 2015 at 20:39:38 UTC, lomereiter wrote:

(whose domain is much easier to remember, btw)


We have already moved to http://dlanguage.ru


Sorry for long reviving of http://dlang.ru but we almost end work 
at it's engine. Now you may see, that it's become very fast. I 
hope that it will will be open on next week. All *major* bugs are 
fixed. There is only minors, about most of them I know.


Please do not start using it until I get approve from CMS 
developer.


Also I have plan to revive dsource.org on our CMS. It's very 
powerful, and can be used as collective forum and blog. So When 
we will test it, I will try to contact with dsource admins and 
suggest them to move site to our CMS.


Also if anybody want to help, you may help with site design.


Re: Is Key Type?

2015-08-02 Thread Gary Willoughby via Digitalmars-d-learn

On Sunday, 2 August 2015 at 17:55:16 UTC, Xinok wrote:
is there a trait in D or Phobos which will tell you if a type 
can be used as a key for an associative array? For example, 
where T is some type:


static assert(isKeyType!T)
int[T] hashTable = ...


import std.stdio;

enum isKeyType(T) = __traits(compiles, int[T]);

class Foo {}
struct Bar {}

void main(string[] args)
{
// Success
assert(isKeyType!(int));
assert(isKeyType!(string));
assert(isKeyType!(Foo));
assert(isKeyType!(Bar));

// Fail
assert(isKeyType!(void));
assert(isKeyType!(delegate(){}));
assert(isKeyType!(function(){}));
}


Re: Rant after trying Rust a bit

2015-08-02 Thread Max Samukha via Digitalmars-d

On Sunday, 26 July 2015 at 23:29:18 UTC, Walter Bright wrote:

For example, the '+' operator. Rust traits sez gee, there's a 
+ operator, it's good to go. Ship it! Meanwhile, you thought 
the function was summing some data, when it actually is 
creating a giant string, or whatever idiot thing someone 
decided to use '+' for.


Number addition and string concatenation are monoid operations. 
In this light, '+' for both makes perfect sense.


Using rdmd to create shared object files

2015-08-02 Thread via Digitalmars-d-learn

Hello,

I am trying to use rdmd to create shared object files.
The command that I am using is

rdmd --build-only -shared -fPIC -defaultlib= foo.d

This creates a file called foo - wich is not exactly what I 
expectd.

However

dmd -shared -fPIC -defaultlib= foo.d 

creates a file called foo.so - that is what i expect and need.
The command ill be actually using will be similar to this:

find ../script -name *.d -exec dmd -I../../deps/ -I../../source/ 
-fPIC -shared -debug -g -defaultlib= {} \;


The amount of files that will be compiled by this are really 
likely going to increase over time, so using rdmd here would be 
nice in terms of compile time.


The issues i have is that rdmd dosnt create .so files but (at 
least on my linux) creates them without a file exenstion. I could 
rename them with -of but that would increase this ugly 
find-command even more. The second thing (wich isnt such a big 
issue): I have to use --build-only for rdmd because it will try 
to run the newly created shared object.


Also, not so on-topic to be asked here: Is there a nicer solution 
for the all .d files in this directory and the ones below?

I remeber its possible to do something like

dmd ./**/*.d

but I cant get that to work...

Thanks
Malte


London D meetups ...

2015-08-02 Thread Andy Smith via Digitalmars-d-announce

Hi All,

   I've just been in touch with Kingsley Hendrickse who's
unfortunately not going to have time to organise the London D
Programmer meetups in the future. Which is a real shame - I only
attended one of the two meetups but I was quite impressed with the
calibre of people that turned up, and Kinglsey did a great job of
organising it :-)

   I'd really hate for this initiative to die off just as it was
getting going. So I thought I'd just ping the London community 
and see

if there was any appetite for anyone to pick up the baton, so to
speak. Normally I'd just say I'll do it but I'm on the verge of
beginning a new job (literally starting tomorrow!), so I need to 
wait
until I'm achieved some sort of equilibrium there before I commit 
to

anything else.

   One thought I had was maybe a 'rolling' organiser would make 
sense?
Committing to organising one meetup is a far less onerous 
commitment

than becoming a full fledged card-carrying organiser so maybe that
would make sense?! I'd quite happily commit to organising one 
meetup

if there was a rotating quorum of organisers willing to step up. (
Probably wouldn't do any harm to the old linked-in profile :-) ).

   Anyway lets know your thoughts. The meetup group 'dies' on 17th
August unless someone else steps up - hopefully that won't happen 
:-)


Cheers,

Andy.




Re: How disruptive is the GC?

2015-08-02 Thread via Digitalmars-d-learn

On Wednesday, 29 July 2015 at 09:25:50 UTC, Snape wrote:
I'm in the early stages of building a little game with OpenGL 
(in D) and I just want to know the facts about the GC before I 
decide to either use it or work around it. Lots of people have 
said lots of things about it, but some of that information is 
old, so as of today, what effect does the GC have on the smooth 
operation of a real-time application? Is it pretty noticeable 
with any use of the GC or only if you're deallocating large 
chunks at a time?


I'd like to add that you can tell the runtime (and therefore the 
GC) to ignore a thread:


http://dlang.org/phobos/core_thread.html#.thread_detachThis

This allows you to implement real-time tasks in that thread, and 
it will never be interrupted by the GC. You can still use the GC 
in other threads. Of course, you need to make sure not to call 
into the GC from the detached thread (easy by using @nogc), and 
to keep at least one reference to GC data used in the detached 
thread in a normal thread.


Interpreting the D grammar

2015-08-02 Thread Jacob Carlborg via Digitalmars-d
I'm trying to read the D grammar [1] to enhance the D TextMate bundle. 
If we take the add expression as an example. It's defined like this in 
the grammar:


AddExpression:
MulExpression
AddExpression + MulExpression
AddExpression - MulExpression
CatExpression

And like this in the grammar made by Brian [2]:

addExpression:
  mulExpression
| addExpression ('+' | '-' | '~') mulExpression
;

I'm not so familiar with grammars but this looks like it's recursive. Is 
it possible to translate this piece of grammar to a regular expression? 
TextMate uses regular expressions and a couple of 
enhancements/extensions to define a grammar for a language.


[1] http://dlang.org/grammar.html
[2] https://rawgit.com/Hackerpilot/DGrammar/master/grammar.html

--
/Jacob Carlborg


Seattle D meetup

2015-08-02 Thread Walter Bright via Digitalmars-d-announce
Seeing the threads on London, Silicon Valley and Berlin meetups, is there any 
interest for a Seattle one?


Re: store template value

2015-08-02 Thread Ali Çehreli via Digitalmars-d-learn

On 08/02/2015 05:15 AM, maarten van damme via Digitalmars-d-learn wrote:

 Oh, neat. This saves the day :)

Awesome! :) However, that solution depends on the implementation details 
of std.parallelism. It is possible to do the same thing by inheriting 
from an 'interface' and hiding the templated type under there.


The following program need not spell out the template instance:

import std.parallelism;

double foo(int i)
{
return i * 1.5;
}

double bar(int i)
{
return i * 2.5;
}

/* This is what the user code will need to know about. */
interface MyTask
{
void executeInNewThread();
void yieldForce();
}

/* This subclass hides the actual templated Task type. */
class MyTaskImpl(TaskType) : MyTask
{
TaskType t;

this(TaskType t)
{
this.t = t;
}

/* These two are to satisfy the interface requirements. */
void executeInNewThread()
{
t.executeInNewThread();
}

void yieldForce()
{
t.yieldForce();
}
}

/* A convenience function to hide the Task template instance. */
auto newMyTask(TaskType)(TaskType taskObject)
{
return new MyTaskImpl!TaskType(taskObject);
}

void main()
{
/* Populate */
MyTask[] myTasks;
myTasks ~= newMyTask(task!foo(1));
myTasks ~= newMyTask(task!bar(2));

import std.algorithm;

/* Execute */
myTasks.each!(t = t.executeInNewThread);

/* Wait */
myTasks.each!(t = t.yieldForce);
}

Ali



Re: D for project in computational chemistry

2015-08-02 Thread bachmeier via Digitalmars-d

On Sunday, 2 August 2015 at 16:25:18 UTC, Yura wrote:
I just wander how D would be suitable for my purpose? Please, 
correct me if I am wrong, but in D the need of pointers is 
minimal, there is a garbage collector, the arrays can be 
dynamically allocated, the arrays can be sliced, ~=, etc which 
makes it similar to python at some extent. I tried to write a 
little code in D and it was very much intuitive and similar to 
what I did both in Python and C.


If you can do it in C, you can do it in D. Full stop.

You get a lot of nice additional features with D, and unlike C++, 
there are not a thousand ways to shoot yourself in the foot with 
a hundred line program. You can easily call C libraries from D so 
you lose nothing wrt to legacy C code. You can use pyd to 
interoperate with Python, so you can move as quickly or as slowly 
as desired from Python to D. You can even call D from C, so if D 
doesn't work out, you don't lose the code you've written.


I primarily use R but have been moving a lot of code into D for 
speed and the nice language features for two years now, and I 
have no regrets. When I started with D, I read lots of comments 
about the compiler being buggy, but have yet to encounter a 
compiler bug. Thankfully that myth seems to be dying.


Re: Rant after trying Rust a bit

2015-08-02 Thread Jonathan M Davis via Digitalmars-d

On Sunday, 2 August 2015 at 19:02:22 UTC, Max Samukha wrote:

On Sunday, 26 July 2015 at 23:29:18 UTC, Walter Bright wrote:

For example, the '+' operator. Rust traits sez gee, there's a 
+ operator, it's good to go. Ship it! Meanwhile, you thought 
the function was summing some data, when it actually is 
creating a giant string, or whatever idiot thing someone 
decided to use '+' for.


Number addition and string concatenation are monoid operations. 
In this light, '+' for both makes perfect sense.


Well, using + for adding strings together does make sense on 
some level, which is why it's done in so many languages, and I 
don't think that it causes as much confusion as Walter sometimes 
seems to think (at least in C/C++-derived languages). That being 
said, I think that it's definitely an improvement that D has 
another operator for it. It makes it clearer when concatenation 
is occurring without having to figure out what types you're 
dealing with, and it allows user-defined code to have both an 
addition operator and a concatenation operator on the same type.


Where distinguishing between + and ~ would likely make a big 
difference though is dynamic languages that aren't strict with 
types and allow nonsense like 5 + 2. And in that case, I expect 
that Walter is completely right. It's just error-prone to use + 
for concatenation in cases like that, and providing a separate 
concatenation operator would reduce bugs.


Regardless, I definitely like the fact that we have ~ and ~= 
instead of reusing + and += for that. It's a small improvement, 
but it is an improvement.


- Jonathan M Davis


Re: Array start index

2015-08-02 Thread QAston via Digitalmars-d-learn

On Saturday, 1 August 2015 at 23:02:51 UTC, bachmeier wrote:
But what type of programming are you doing? Even after decades 
of programming and trying out dozens of languages, zero-based 
indexing still gets me at times when the arrays I work with 
represent vectors and matrices. Especially when porting code 
from other languages that use one-based indexing. One of the 
nice things about D is that it gives you the tools to easily 
make the change if you want.


Adding 1-indexed arrays to the language fixes nothing. Just write 
your 1-indexed array type and if you enjoy using it, publish it 
as a library. Who knows, if demand is high it may even end up in 
phobos.


Re: DMD on WIndows 10

2015-08-02 Thread Tofu Ninja via Digitalmars-d

On Sunday, 2 August 2015 at 17:07:39 UTC, Timon Gehr wrote:

On 08/01/2015 12:02 AM, Paul D Anderson wrote:
p.s. Please don't tell me how much better your favorite 
operating system

is than Windows. Thank you. :)


There are plenty operating systems that are not my favourite, 
yet still much better than Windows.


Just couldn't restrain your self eh?


Re: DMD on WIndows 10

2015-08-02 Thread Etienne Cimon via Digitalmars-d

On Saturday, 1 August 2015 at 07:56:34 UTC, John Chapman wrote:

On Friday, 31 July 2015 at 22:02:13 UTC, Paul D Anderson wrote:
I'm waiting to upgrade from Windows 7 to Windows 10 to avoid 
the inevitable just-released bugs, but does anyone have any 
info about D on Windows 10? Has anyone tried it?


I'm on Windows 10, and my DMD-built programs run just fine.


Did you get a sort of freeze on Win10 when trying to open some 
executables downloaded from the internet? I was annoyed a bit 
when re-downloading all my apps, the installer just appeared out 
of nowhere 5 minutes later.


[Issue 14612] typeid(interface) returns TypeInfo_Class object

2015-08-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14612

--- Comment #10 from Kenji Hara k.hara...@gmail.com ---
I found slightly related issue tickets:

Issue 4979 - Implementing an interface twice results in different a reference
for each interface
Issue 11683 - Document current Identity Expression over `interface`s behaviour

--


Re: Seattle D meetup

2015-08-02 Thread Joakim via Digitalmars-d-announce

On Sunday, 2 August 2015 at 22:53:00 UTC, Walter Bright wrote:
Seeing the threads on London, Silicon Valley and Berlin 
meetups, is there any interest for a Seattle one?


btw, the Silicon Valley Meetup doesn't show up on this nice 
little worldwide map of Dlang Meetups on their website:


http://dpl.meetup.com/

Maybe Ali or some other organizer needs to add the appropriate 
tag to their Meetup so it will?  Would be cool if we could have a 
nicely populated Meetup map to show off on dlang.org somewhere.


[Issue 14863] CLOCK_BOOTTIME should be optional to support 2.6.39 kernels

2015-08-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14863

--- Comment #1 from Jonathan M Davis issues.dl...@jmdavisprog.com ---
Great... People are still using kernels that old? This sort of problem didn't
even occur to me. We really aren't set up to have different C headers depending
on the kernel version and the like, and we're certainly not set up to support
different ClockTypes depending on your kernel version - though in theory, it's
supposed to be set up so that if you don't explicitly use a particular
ClockType, it wouldn't matter.

The GC and runtime should only care about MonoTime itself - i.e.
MonoTimeImpl!(ClockType.normal) and not any of the other instantiations of
MonoTimeImpl. I guess that in one of the rounds of changes that we made
relating to static constructor bugs must have resulted in the clock frequency
being grabbed for all of the ClockTypes that the system supports (or at least
supposedly supports). *sigh*

The simplest solution of course would be to simply get rid of
ClockType.bootTime, though that definitely would suck, and I don't know how
we'd decide when to readd it (I really don't want to have start worrying about
kernel versions). Other than that, presumably, we have to make sure that none
of the ClockTypes other than ClockType.normal get used in any way unless
someone uses them in their own program.

I guess that I'll have to find time to dig into this ASAP.

--


Re: London D meetups ...

2015-08-02 Thread Laeeth Isharc via Digitalmars-d-announce

On Sunday, 2 August 2015 at 19:01:56 UTC, Andy Smith wrote:

Hi All,

   I've just been in touch with Kingsley Hendrickse who's
unfortunately not going to have time to organise the London D
Programmer meetups in the future. Which is a real shame - I only
attended one of the two meetups but I was quite impressed with 
the
calibre of people that turned up, and Kinglsey did a great job 
of

organising it :-)

   I'd really hate for this initiative to die off just as it was
getting going. So I thought I'd just ping the London community 
and see

if there was any appetite for anyone to pick up the baton, so to
speak. Normally I'd just say I'll do it but I'm on the verge 
of
beginning a new job (literally starting tomorrow!), so I need 
to wait
until I'm achieved some sort of equilibrium there before I 
commit to

anything else.

   One thought I had was maybe a 'rolling' organiser would make 
sense?
Committing to organising one meetup is a far less onerous 
commitment
than becoming a full fledged card-carrying organiser so maybe 
that
would make sense?! I'd quite happily commit to organising one 
meetup
if there was a rotating quorum of organisers willing to step 
up. (
Probably wouldn't do any harm to the old linked-in profile :-) 
).


   Anyway lets know your thoughts. The meetup group 'dies' on 
17th
August unless someone else steps up - hopefully that won't 
happen :-)


Cheers,

Andy.


Hi Andy.

Kingsley did a great job, but it's a tough thing to keep going as 
professional and personal demands increase.  It's important for D 
to have a presence in London, and being more involved probably 
pays for itself careerwise in the end, one way or the other.  We 
should definitely strive to keep things going.  I can't do much 
the next few weeks, and can't make a firm regular commitment as 
it's hard to predict other demands.  But if it's needed I will 
definitely do one, and try to do so again from time to time.



Laeeth.




Re: D for Game Development

2015-08-02 Thread Sebastiaan Koppe via Digitalmars-d

On Sunday, 2 August 2015 at 14:03:50 UTC, Rikki Cattermole wrote:
Some of things that goes on in the modding world is truely 
amazing.


For every item/block with a recipe and vanilla items/blocks 
hardcoded. It'll calculate at the start of runtime an EMC value 
in EE3. It does it ridiculously fast.


I understand absolutely nothing about it.




Visual Studio Code

2015-08-02 Thread bitwise via Digitalmars-d

Just stumbled upon this:

https://code.visualstudio.com/

I see support for Rust and Go, but no D.

If you download it, there is a little smiley/frowny in the bottom 
right corner for feedback/feature requests.


Or just vote here:

http://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/7763160-support-the-d-programming-language


Bit


Re: Last call for AliasSeq

2015-08-02 Thread Enamex via Digitalmars-d

On Friday, 24 July 2015 at 08:51:04 UTC, Marc Schütz wrote:
Martin has just merged the rename of `TypeTuple` to `AliasSeq` 
into the stable branch, which will be released soon. If anyone 
wants to change the name again, please open a PR immediately, 
this is the last chance.


Slightly non-sequitur question: Does this whole thing mean that 
tuple literals are never going to be implemented? The DIP I found 
mentioned most often is from 2013...