Re: access violation With dll?

2015-07-16 Thread jklp via Digitalmars-d-learn

On Thursday, 16 July 2015 at 17:22:50 UTC, jklp wrote:
On Thursday, 16 July 2015 at 17:04:09 UTC, Taylor Hillegeist 
wrote:

[...]


Your proto is wrong. Your forgot the FFI convention (__cdecl = 
extern(C)).

Try this instead:

---
extern(C)
alias Proto = void function(char*, int);

Proto func = cast(Proto) GetProcAddress(h, Test);

if (func)
{
char[] STUFF;
STUFF.length = 5000;
func (STUFF.ptr , STUFF.length);
// prints etc...
}



Also i guess that the dll returns a null terminated string so the 
result has to be

read like this:

---
import std.string;
printf(%s\n, fromStringz(STUFF.ptr));
---

Otherwise you'll get a random output after the 'HELLO WORLD'.
(wait maybe the console will automatically cut... ?)


Re: Phobos: test suite

2015-07-16 Thread Walter Bright via Digitalmars-d

On 7/16/2015 4:39 AM, Rikki Cattermole wrote:

I do not believe this issue has been raised yet.
But for std.experimental.image (or at least to my intention) I will be needing a
test suite for e.g. PNG file format loader/exporter.

To my knowledge we currently only support unittests for Phobos. What I need
structure wise is similar to dmd's testsuite.

I do not know nor want to get into setting this up.

For example the PNG file format it should really be tested using separate
programs to compare against load/export/load for the files[0].
This is quite crucial to ensure the correctness of the loader/exporter. It will
help prevent and detect many bugs.

So, would anybody like to get a head start on it?

[0] http://www.schaik.com/pngsuite/


I haven't looked at your code, but for an image file reader, the D way is to 
separate file handling code from image handling code. This means that the image 
code can be tested not by handing it a file name, but handing it the data that 
can be inlined in a D source code file.


This makes testing much more straightforward.


really good talk about the Hotspot VM

2015-07-16 Thread Benjamin Thaut via Digitalmars-d
This talk is really good and contains a lot of usefull 
information very densly packed:

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

The speaker has 30 years of experience working on javas hotspot 
vm and shares his opinions on what you should do. My takeaways 
from this talk are:


GC:
-You want a fully percise GC (e.g. know _all_ pointers even the 
ones on the stack), the benenift outweights the cost for tracking 
pointers.
-You do not want to pin allocations in the gc heap as it is to 
restrictive for your gc implementation.

-GC safepoints worked out really well.

TLS:
To get fast thread local storage, align the start of the stack so 
you can chop of a few bits of the stack pointer to get to the 
TLS-section. We might be able to use this on platforms with slow 
TLS?


Kind Regards
Benjamin Thaut



Re: Why aren't you using D at work?

2015-07-16 Thread Nick Sabalausky via Digitalmars-d

On 07/16/2015 04:56 AM, Kagamin wrote:

On Wednesday, 15 July 2015 at 18:57:35 UTC, Nick Sabalausky wrote:

On 07/15/2015 12:06 PM, Poyeyo wrote:


Lack of a complete MySQL driver. No DECIMAL support that I know of. Lack
of MySQL support in vibe.d.


Please file any issues you may have with mysql-native here:
https://github.com/mysql-d/mysql-native

Or ping any existing issues that you may need to ping.


https://github.com/mysql-d/mysql-native/issues/39 ?


That was closed as fixed last year. Have you hit a problem with the fix?



Re: Wait, what? What is AliasSeq?

2015-07-16 Thread David Nadlinger via Digitalmars-d
On Thursday, 16 July 2015 at 16:13:46 UTC, Andrei Alexandrescu 
wrote:

On 7/16/15 11:59 AM, H. S. Teoh via Digitalmars-d wrote:
On Thu, Jul 16, 2015 at 11:50:25AM -0400, Andrei Alexandrescu 
via Digitalmars-d wrote:

On 7/15/15 8:49 PM, Mike wrote:
1. AliasSeq is no good as evident from the first post that 
started

this thread


I am egging my face for starting this. Can we please return to
AliasSeq? -- Andrei


Yes, let's please return to AliasSeq. It's a pretty lousy 
name, but all
the alternatives are even worse. Let's not fix the problem by 
making it

worse.


WE HAVE CONSENSUS! :o)

(Well... anyone else in favor?)


Yes, me. ;)

 — David


Re: really good talk about the Hotspot VM

2015-07-16 Thread Justin Whear via Digitalmars-d
On Thu, 16 Jul 2015 17:30:05 +, Benjamin Thaut wrote:

 The speaker has 30 years of experience working on javas hotspot vm

How is this possible?  Time travel?


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 17:10:57 UTC, Deadalnix wrote:
On Thursday, 16 July 2015 at 05:44:29 UTC, Ola Fosheim Grøstad 
wrote:

Oh, here is one more term you can consider:

AliasPack

In Python splatting is called unpacking (splat refers to 
the visual impression of the * operator and is 
inappropriate).


C++ also have related use of the word pack:

http://en.cppreference.com/w/cpp/language/parameter_pack

So in C++ all of the terms list, sequence and pack can 
be used about parameter lists… but list is the general term: 
argument list, parameter list, initializer list etc…


Pack was my first choice, but it did seem to stick amongst the 
community when I asked around. I'd be happy with pack.


FWIW, just like Nat often is used to denote natural numbers, 
Seq is often used in formalizations of sequences, e.g. stuff 
that falls under this definition:


https://en.wikipedia.org/wiki/Sequence#Formal_definition

So AliasSeq is counter-intuitive to me, it does not fit with 
any use of the term Seq I have been in touch with...


Basically, to me Seq represent series of values, not 
configurations.




Re: really good talk about the Hotspot VM

2015-07-16 Thread rsw0x via Digitalmars-d

On Thursday, 16 July 2015 at 17:30:06 UTC, Benjamin Thaut wrote:
This talk is really good and contains a lot of usefull 
information very densly packed:

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

[...]


Treating D's GC the same as a managed language running in a VM's 
GC will only end in disappointment.


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread David Nadlinger via Digitalmars-d

On Thursday, 16 July 2015 at 17:39:13 UTC, David Nadlinger wrote:

Yes, me. ;)


(I should note that this is mainly because I'd really rather not 
have Tuple in the name because of first-hand experience in 
teaching beginners both on IRC and in person. And AliasSeq seems 
like the most likely candidate for this right now. I personally 
like Seq quite a bit too, but I'd rather not join that 
bikeshedding debate. —David)


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 21:44:13 UTC, Timon Gehr wrote:
On 07/16/2015 07:35 AM, Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= 
ola.fosheim.grostad+dl...@gmail.com wrote:

[...]
But I think sequence implies that everything has the same 
type...




That common type is 'alias'. :-)


*cringe*



[Issue 2354] conditional compilation rejects else if the declaration is a single pragma

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2354

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


Re: Phobos: test suite

2015-07-16 Thread Rikki Cattermole via Digitalmars-d

On Thursday, 16 July 2015 at 17:32:04 UTC, Walter Bright wrote:

On 7/16/2015 4:39 AM, Rikki Cattermole wrote:

I do not believe this issue has been raised yet.
But for std.experimental.image (or at least to my intention) I 
will be needing a

test suite for e.g. PNG file format loader/exporter.

To my knowledge we currently only support unittests for 
Phobos. What I need

structure wise is similar to dmd's testsuite.

I do not know nor want to get into setting this up.

For example the PNG file format it should really be tested 
using separate

programs to compare against load/export/load for the files[0].
This is quite crucial to ensure the correctness of the 
loader/exporter. It will

help prevent and detect many bugs.

So, would anybody like to get a head start on it?

[0] http://www.schaik.com/pngsuite/


I haven't looked at your code, but for an image file reader, 
the D way is to separate file handling code from image handling 
code. This means that the image code can be tested not by 
handing it a file name, but handing it the data that can be 
inlined in a D source code file.


Not an issue, takes an input range.


This makes testing much more straightforward.


My concern is about getting access to the images to test against.
While embedding is valid, the test images I linked to only total 
a couple meg at most. We will need others added. Both large and 
small. I am concerned about file sizes and maintainability.

Especially for e.g. other file formats.

Worse case scenario I'll make sure something like bin2d[0] is 
part of the tools repo. To generate these files.

I just don't like this approach.

[0] https://github.com/rikkimax/Bin2D/blob/master/source/Bin2D.d


Re: Weird behavior of this in a subclass, I think?

2015-07-16 Thread Daniel Kozák via Digitalmars-d-learn

On Thu, 16 Jul 2015 00:18:30 +
seashell86 via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:

 So I've been mostly just toying around with D as it seems like it 
 will end up being a strong language for game development both now 
 and even moreso in the future.  That being said, I'm perplexed by 
 using this code and not receiving the result I would imagine. 
 Here is the source code of a basic sandbox.d file:
 
  import std.stdio;
 
  class Animal {
  string voice;
 
  void speak() {
  writeln(this.voice);
  }
  }
 
  class Dog : Animal {
  string voice = Whoof!;
  }
 
  int main() {
  auto a = new Animal();
  auto d = new Dog();
 
  a.speak(); // Prints 
  d.speak(); // Prints  instead of Whoof!
 
  return 0;
  }
 
 I know that C++ behaves this way.  However, Dlang impresses me by 
 having a very no duh approach to things where this type of 
 example seems very no duh.  Anyways, please be gentle as I am 
 hardly what most would consider a skilled programmer and, as 
 such, was something I wanted to bounce off the pros :)


You can use template this parametr

import std.stdio;

class Animal {
string voice;

void speak(this C)() {
writeln((cast(C)this).voice);
}
}

class Dog : Animal {
string voice = Whoof!;
}

int main() {
auto a = new Animal();
auto d = new Dog();

a.speak(); // Prints 
d.speak(); // Prints Whoof!

return 0;
}


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread Jacob Carlborg via Digitalmars-d

On 2015-07-15 23:44, Timon Gehr wrote:


It should instead be acknowledged that there /should/ be no difference
in what three things can be passed to X(T...) and X(alias a, alias b,
alias c). The X(T...) if(T.length==k) pattern is ridiculous.


I completely agree.

--
/Jacob Carlborg


Re: Template function that accept strings and array of strings

2015-07-16 Thread Jacob Carlborg via Digitalmars-d-learn

On 2015-07-15 23:57, badlink wrote:

Hello, I can't figure how to write a template function that accept
either strings or array of strings.

This is my current code:

bool hasItemParent(T)(const(char)[] itemId, const(T)[] parentId)
if (is(typeof(T) == char) || (isArray!T  is(typeof(T[]) == char)))
{...}

I used const(T)[] because I'd like to accept immutable and mutable strings.
But calling it with an immutable string generate this error:

Error: template cache.MetadataCache.hasItemParent cannot deduce function
from argument types !()(string, string), candidates are:
cache.MetadataCache.hasItemParent(T)(const(char)[] itemId, const(T)[]
parentId) if (is(typeof(T) == char))

Any suggestions ?


If I understand you correctly, I think you want a type safe variadic 
function:


void foo (const(char[])[] args ...)
{
writeln(args);
}

void main()
{
foo(foo, bar);
foo(foo.dup, bar.dup);
auto a = [foo, bar];
foo(a);
auto b = [foo.dup, bar.dup];
foo(b);
}

--
/Jacob Carlborg


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread Jacob Carlborg via Digitalmars-d

On 2015-07-07 23:16, Andrei Alexandrescu wrote:

So I thought we were supposed to replace bad names with good names.
Template arguments are indexable, so sequence doesn't quite apply.

What happened? Why are we replacing a crappy term with another crappy term?


How about Bag or AliasBag?

--
/Jacob Carlborg


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread via Digitalmars-d
On Thursday, 16 July 2015 at 05:55:01 UTC, Ola Fosheim Grøstad 
wrote:

On Thursday, 16 July 2015 at 05:51:01 UTC, Mike wrote:

Sound familiar?  I propose simply Pack.


Or AliasListPack, AliasPackList, PackedAliasList…


Or would it be UnpackingAliasList or UnpackedAliasList? Oh… 
Headaches…




Re: Wait, what? What is AliasSeq?

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 05:51:01 UTC, Mike wrote:
On Thursday, 16 July 2015 at 05:44:29 UTC, Ola Fosheim Grøstad 
wrote:




C++ also have related use of the word pack:

http://en.cppreference.com/w/cpp/language/parameter_pack



Nice!  From the description:

A template parameter pack is a template parameter that accepts 
zero or more template arguments (non-types, types, or 
templates). A function parameter pack is a function parameter 
that accepts zero or more function arguments.


A template with at least one parameter pack is called a 
variadic template.


Sound familiar?  I propose simply Pack.



Only that it is in fact an UnPack...


Re: Last - but not least! - two DConf talks

2015-07-16 Thread via Digitalmars-d-announce

On Wednesday, 15 July 2015 at 19:28:13 UTC, Jacob Carlborg wrote:

On 2015-07-13 09:12, Atila Neves wrote:


https://www.reddit.com/r/programming/comments/3d3ooa/behaviourdriven_development_with_d_and_cucumber/


Also on HN, but as usual can't post the link.


The comment about not having to name the steps. One way to do 
that could be something like this:


step(foo bar, {
// step implementation
});

There are two problems with that:

1. D doesn't support module level code like this. Which could 
be solved by either using a unit test block, a module 
constructor or some other function the framework knows about to 
call.


Do mixin templates work on module level? They can even have an 
identifier.




2. That syntax is not as nice as in Ruby. It would be really 
nice if the following could be supported:


step(foo bar) {
// step implementation
}

A trailing delegate syntax, where the delegate is passed after 
the regular argument list.


Unfortunately there are syntactical ambiguities:

step(foo bar) {
}
.foo();

Is that a call chain, or two statements, with the second one 
calling a function in the root scope? And I think there are other 
similar cases...


Re: DUB RC 0.9.24-rc.1 ready for testing

2015-07-16 Thread Suliman via Digitalmars-d
On Tuesday, 14 July 2015 at 13:58:36 UTC, Andrei Alexandrescu 
wrote:

On 7/13/15 7:09 PM, Sönke Ludwig wrote:
If everything goes as planned, the 0.9.24 release will be the 
last one

before 1.0.0.


Great! I wish we'd synchronize release and distribution 
schedules for dmd, dub, and vibe soon. -- Andrei


In what version of DMD do you plan to include dub and vibe?


Are Lua tables possible to do with D?

2015-07-16 Thread Robert M. Münch via Digitalmars-d-learn
Hi, do you think it's possible to implemented something like Lua Tables 
(a hashed heterogeneous associative array) in D?


I know that Lua is dynamic and interpreted, hence it's a lot simpler to 
do than with a compiled language but I'm wondering if we could express 
such a generic data-structure in D.


--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



Re: question about the semantics of unshared variables

2015-07-16 Thread aki via Digitalmars-d-learn

I noticed just making many threads cause an error.
Are there any limit for the number of threads?

import std.concurrency;
import core.thread;
void fun() { Thread.sleep(5000.msecs); }
void testThread() {
foreach(i; 0..2000) {
spawn(fun);
}
}

core.thread.ThreadError@src\core\thread.d(2903): Error creating 
thread


Aki.



Re: question about the semantics of unshared variables

2015-07-16 Thread aki via Digitalmars-d-learn

On Thursday, 16 July 2015 at 07:36:39 UTC, Jonathan M Davis wrote:
Yes. Every thread gets a copy of the non-shared static 
variables, and all of the non-shared static constructors get 
run for each thread.


- Jonathan M Davis


Thank you for reply. Now i know.
I did some test using C++ as you said, then there are some
different problem occurred. Anyway no need to make so
many threads. Please just forget it.

Aki.



Re: Weird behavior of this in a subclass, I think?

2015-07-16 Thread Jacob Carlborg via Digitalmars-d-learn

On 2015-07-16 09:46, Jonathan M Davis via Digitalmars-d-learn wrote:


I've never heard of a language that overloaded member variables, and given
how class polymorphism works, I don't see how it would even be possible
without making it so that all accesses to a variable actually call a
function to access it, which would needlessly inefficient (polymorphism
works by looking up the correct function in the class' virtual table, and
the call site isn't going to know at compile time what class it's actually
operating on, so all of that has to be done at runtime). And if you really
want something approximating overriding variables, then you can just use
property functions to access the variable rather than accessing it directly,
and then you can override the property functions.


In Scala all public instance variables are implemented as methods, if I 
recall correctly.


--
/Jacob Carlborg


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 08:00:43 UTC, Marc Schütz wrote:

Maybe auto-flattening is a better name for this behaviour?


flattening: concatenating all the children recursively.

argument unpacking/expansion: filling in the actual parameters

Anyway, auto-flattening is undesirable as it makes the language 
more weakly typed and hides what goes on. And it gets in the way 
for structural pattern matching. But those issues are off-topic, 
I guess.




Re: Where will D sit in the web service space?

2015-07-16 Thread rsw0x via Digitalmars-d

On Thursday, 16 July 2015 at 10:29:54 UTC, Kagamin wrote:

Like minecraft?


Minecraft runs absolutely horrible, the earlier versions of 
minecraft used to allocate 2-300mb of data per second that was 
near instantly marked garbage.


Re: Where will D sit in the web service space?

2015-07-16 Thread rsw0x via Digitalmars-d

On Thursday, 16 July 2015 at 11:00:19 UTC, Paulo  Pinto wrote:

Well, there are lots of Geometry Wars clones in XNA and LibGDX.

As for Vulkan, I have the strong feeling it is DOA, with Apple, 
Sony, Nintendo, Microsoft favoring they own APIs.


Sure, if they can convince the major graphics vendors to care 
about their proprietary vendor lock-in crap. The only one of 
those that will exist in 5 years is probably DirectX.


Intel, AMD, and Valve are heavily invested in Vulkan. It will 
definitely not be DOA.


Re: Why aren't you using D at work?

2015-07-16 Thread Andrej Mitrovic via Digitalmars-d
On 7/15/15, Piotr Szturmaj via Digitalmars-d
digitalmars-d@puremagic.com wrote:
 By the way.. does anyone know if Sociomantic accepts remote D jobs?

Not currently that I'm aware of. There were some exceptions, but this
is rare. You can always e-mail care...@sociomantic.com to find out
more. :)


Re: Functional oriented programming in D

2015-07-16 Thread via Digitalmars-d-learn

On Thursday, 16 July 2015 at 09:52:59 UTC, ponce wrote:
On Thursday, 16 July 2015 at 09:49:03 UTC, Jarl André Hübenthal 
wrote:

Why?


The syntax for delegate literals with braces is


listenHTTP(settings, (req, res) {
res.writeBody(Hello, World!);
});


Thanks. Those small details you forget to test before asking is a 
bit embarrassing. I blame Scala for it :) In Scala its (req,res) 
= { ... } consistently.


[Issue 11304] In case of different @safe/@trusted/@system attributes the weaker is selected

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11304

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

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #1 from Kenji Hara k.hara...@gmail.com ---
(In reply to Denis Shelomovskij from comment #0)
 void f() @system {}
 
 @trusted {
 void f1() @safe
 { static assert(!__traits(compiles, f())); } // assert fails
 }

From 2.066, f1 is marked as @safe, then the assert failure is fixed.

 // It would be also good to reject g1/g2:
 @safe void g1() @trusted { f(); } // compiled as @trusted
 @trusted void g2() @safe { f(); } // compiled as @trusted

From 2.066, those fails to compile with conflicting storage class error.

--


Re: How to use core.thread.Thread

2015-07-16 Thread maarten van damme via Digitalmars-d-learn
You can certainly use thread but in most use cases, concurrency or
parallelism will accomplish the same in a much saner/safer way. (they're
wrappers around core.thread anyway).
Don't know of any tutorials about core.thread, about the other two you can
find help here : http://ddili.org/ders/d.en/

2015-07-16 11:24 GMT+02:00 aki via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com:

 On Thursday, 16 July 2015 at 08:21:26 UTC, maarten van damme wrote:

 Have you checked out std.parallelism and std.concurrency?


 I know std.concurrency to use spawn. If I cannot use Thread,
 I'll implement by spawn. But want to try Thread class because
 it seems similar to Java's Thread class.
 I don't know std.parallelism. It seems for the different case.

 Aki.




rust

2015-07-16 Thread roaming via Digitalmars-d

https://visualstudiomagazine.com/articles/2015/07/01/inside-visual-rust.aspx

and D?

can you do multiple dll on win yet?


Re: Where will D sit in the web service space?

2015-07-16 Thread Paulo Pinto via Digitalmars-d
On Thursday, 16 July 2015 at 10:50:02 UTC, Ola Fosheim Grøstad 
wrote:

On Thursday, 16 July 2015 at 10:29:54 UTC, Kagamin wrote:
Maybe I didn't understand it well? And what missed frames have 
to do with audio workstations and photo editors?


Real time audio workstations are very sensitive to missed 
audio-frames, much more so than any other desktop-application I 
can think of. They are used for live performances.


Next gen photo/video-editors require easy CPU/GPU integration. 
Excellent Vulcan-support might become a key feature there.



Like minecraft?


No, like Pong.


Well, there are lots of Geometry Wars clones in XNA and LibGDX.

As for Vulkan, I have the strong feeling it is DOA, with Apple, 
Sony, Nintendo, Microsoft favoring they own APIs.


Re: Casting random type to random struct - is this a bug?

2015-07-16 Thread rumbu via Digitalmars-d-learn

On Wednesday, 15 July 2015 at 15:58:17 UTC, Daniel Kozák wrote:


On Wed, 15 Jul 2015 15:45:43 +
rumbu ru...@rumbu.ro wrote:


struct S { int a, b; }
auto s = cast(S)10;
//compiles and sets s.a to 10.

It works also for any other type, if the structure contains a 
member of that type in the first position.


Is this normal behaviour?


Yes, this is OK

If you need to cast against diferent types you can try pointers:



In fact I'm trying to overload the cast operator in this case, I 
was surprised about the default casting since I didn't find any 
reference to this behaviour, nor in TDPL, nor online.


Since UFCS is not allowed in operator overloading I wonder if 
this is possible.





Re: Functional oriented programming in D

2015-07-16 Thread ponce via Digitalmars-d-learn
On Thursday, 16 July 2015 at 09:49:03 UTC, Jarl André Hübenthal 
wrote:

Why?


The syntax for delegate literals with braces is


listenHTTP(settings, (req, res) {
res.writeBody(Hello, World!);
});





Re: Where will D sit in the web service space?

2015-07-16 Thread Kagamin via Digitalmars-d
On Wednesday, 15 July 2015 at 14:57:35 UTC, Ola Fosheim Grøstad 
wrote:
You have deadlines or you miss frames in graphics, you have 
deadlines in audio, you have memory subsystem requirements that 
are similar, you also want to tap into the coprocessor (which 
we now think of as GPU) for all kinds of application areas: 3D 
sculpting, photo editors, audio workstations, photon based 
tracers, real time ray tracers, 3D scan browsers… I don't think 
shooters are all that special.


And there are tasks which benefit from being written in 
assembler. What's your point? And what the topic was about? Maybe 
I didn't understand it well? And what missed frames have to do 
with audio workstations and photo editors?


I think basically any interactive desktop application that you 
cannot do easily in Java is a candidate that could benefit from 
the same feature set.


Like minecraft?


Re: Where will D sit in the web service space?

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 10:29:54 UTC, Kagamin wrote:
Maybe I didn't understand it well? And what missed frames have 
to do with audio workstations and photo editors?


Real time audio workstations are very sensitive to missed 
audio-frames, much more so than any other desktop-application I 
can think of. They are used for live performances.


Next gen photo/video-editors require easy CPU/GPU integration. 
Excellent Vulcan-support might become a key feature there.



Like minecraft?


No, like Pong.



Re: Voting for std.experimental.allocator

2015-07-16 Thread Uranuz via Digitalmars-d-announce

On Thursday, 16 July 2015 at 10:02:17 UTC, Dicebot wrote:

On Wednesday, 8 July 2015 at 11:33:03 UTC, Dicebot wrote:

Voting ends in 2 weeks, on July 22.


~1 week remains


Yes. It's time to have this functionality in standart library.


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread Jacob Carlborg via Digitalmars-d
On 2015-07-16 10:00, Marc =?UTF-8?B?U2Now7x0eiI=?= schue...@gmx.net 
wrote:



What I meant is that there is no equivalent to the behaviour of TypeTuples:

 assert(is(TypeTuple!(int, float, TypeTuple!(string, int)) ==
   TypeTuple!(int, float, string, int));
 TypeTuple!(int, int) a;
 a[0] = 1; a[1] = 2;
 void foo(int, int);
 foo(a); // works

But not in Ruby:

 [1, 2, [3, 4]] != [1, 2, 3, 4]
 def foo a, b ; end
 foo([1, 2]);  // doesn't work
 foo(*[1, 2]); // but works with splat operator

Maybe auto-flattening is a better name for this behaviour?

My point is that there is no type in Ruby that is inherently splatty,
rather it's the operator that produces this behaviour. Therefore,
splat is not used as a noun to signify such a type.


I see what you mean now.

--
/Jacob Carlborg


Re: How to use core.thread.Thread

2015-07-16 Thread Daniel Kozák via Digitalmars-d-learn

On Thu, 16 Jul 2015 07:57:10 +
aki via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:

 I can't resolve the compile errors:
 
 import core.thread;
 class DerivedThread : Thread {
   int count = 0;
   this() {
   super(run);
   }
   private void run() {
   inc();  //testThread.d(8): Error: shared method 
 testThread.DerivedThread.inc is not callable using a non-shared 
 object
   }
   synchronized void inc() {
   ++count;//testThread.d(11): Deprecation:
 read-modify-write operations are not allowed for shared variables.
 Use core.atomic.atomicOp!+=(this.count, 1) instead.
   }
 }
 void main() {
   auto thr = new DerivedThread();
   thr.start();
   thr.inc();  //testThread.d(17): Error: shared method 
 testThread.DerivedThread.inc is not callable using a non-shared 
 object
   thr.join();
 }
 
 
 1. Should I declare thr as shared? But
   auto thr = new shared DerivedThread();
 does not resolve it.
 
 2. Why ++count cause an error? I think it is safe because
 it is marked as synchronized. If it is forced to use atomicOp
 all the time, it's painful.
 
 3. Are there any tutorials about using Thread class?
 
 Aki.
 

import core.thread;
class DerivedThread : Thread {
shared int count = 0;
__gshared int count2 = 0;
this() {
super(run);
}
private void run() {
inc();
inc2();
}
void inc() {
import core.atomic; 
atomicOp!+=(this.count, 1);
}

void inc2() {
synchronized {
++count2;
}
}
}
void main() {
auto thr = new DerivedThread();
thr.start();
thr.inc();
thr.inc2();
thr.join();
}


Re: How to use core.thread.Thread

2015-07-16 Thread aki via Digitalmars-d-learn
On Thursday, 16 July 2015 at 08:21:26 UTC, maarten van damme 
wrote:

Have you checked out std.parallelism and std.concurrency?


I know std.concurrency to use spawn. If I cannot use Thread,
I'll implement by spawn. But want to try Thread class because
it seems similar to Java's Thread class.
I don't know std.parallelism. It seems for the different case.

Aki.



Re: Wait, what? What is AliasSeq?

2015-07-16 Thread Dicebot via Digitalmars-d

On Wednesday, 15 July 2015 at 21:44:37 UTC, Timon Gehr wrote:
It should instead be acknowledged that there /should/ be no 
difference in what three things can be passed to X(T...) and 
X(alias a, alias b, alias c). The X(T...) if(T.length==k) 
pattern is ridiculous.


I am all for that but it needs to be explicitly acknowledged and 
implemented together with a rename.


Functional oriented programming in D

2015-07-16 Thread via Digitalmars-d-learn

Hi

After a couple of years using and keeping an eye on D I have 
grown into a functional oriented programmer. I began with 
JavaScripts semi pseudo functional style, then Clojures dynamic 
functional style, Haskells burritos and now Scala.


I have began to dislike Haskell for the academic approach to 
programming. To do anything you must think and think again. The 
knowledge you need to code haskell is more than the syntax and 
rules.


Then i thought about D some days ago. Thought Id give it a new 
try. Take a new look. See if something had changed from my side 
or the language. Well certainly from my side given the fact that 
I am no longer an OO programmer. Well i do OO stuff everyday, but 
despise it and remind myself and other devs how this could have 
be done better.


I found that there is std.algorithm, std.functional and lambda 
expressions in D. Thats very interesting. It gives a promise that 
I can use those tools to create (almost) class less programs. I 
initiated a vibe.d project and tried to change the listen handler 
to a lamdba expression:


listenHTTP(settings, (req, res) = res.writeBody(Hello, 
World!));


And it worked obviously well.

But when I changed it to multiline lambda:

listenHTTP(settings, (req, res) = {
res.writeBody(Hello, World!);
});

It gave me an error:

[jarl@galifrey vibed-app] $ dub
Target vibe-d 0.7.23 is up to date. Use --force to rebuild.
Building vibed-app ~master configuration application, build 
type debug.

Compiling using dmd...
source/app.d(8,12): Error: None of the overloads of 'listenHTTP' 
are callable using argument types (HTTPServerSettings, void), 
candidates are:

../../.dub/packages/vibe-d-0.7.23/source/vibe/http/server.d(71,6):
vibe.http.server.listenHTTP(HTTPServerSettings settings, void 
delegate(HTTPServerRequest req, HTTPServerResponse res) request_handler)
../../.dub/packages/vibe-d-0.7.23/source/vibe/http/server.d(95,6):
vibe.http.server.listenHTTP(HTTPServerSettings settings, void 
function(HTTPServerRequest req, HTTPServerResponse res) request_handler)
../../.dub/packages/vibe-d-0.7.23/source/vibe/http/server.d(100,6):
vibe.http.server.listenHTTP(HTTPServerSettings settings, 
HTTPServerRequestHandler request_handler)
FAIL 
.dub/build/application-debug-linux.posix-x86_64-dmd_2067-006B89616986857CBBFCCB1EAEA3E85E/ vibed-app executable

Error executing command run:
dmd failed with exit code 1.

Which I belive means that a single line lambda is a different 
object type than multiline lambda?


Why?


Re: Voting for std.experimental.allocator

2015-07-16 Thread Dicebot via Digitalmars-d-announce

On Wednesday, 8 July 2015 at 11:33:03 UTC, Dicebot wrote:

Voting ends in 2 weeks, on July 22.


~1 week remains



Re: Wait, what? What is AliasSeq? - `Pack` Proposal

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 07:30:19 UTC, Mike wrote:
I know Ola is making light of this situation and many of you 
find this discussion beneath you, but we need a name, and with 
the release looming we need it relatively soon.


Naming is difficult, but list and pack (alluding to 
unpacking) are the most accurate terms.


But you need a general term that covers both types and 
values/expressions... I don't know of one. alias is not an 
abstraction but more like an action that binds something. Maybe 
something like mixed…


Just Pack would be confusing... Sounds like a verb and I 
wouldn't understand it without looking it up in the docs. You 
need a word before pack.


These I would be able to infer from context:

MixedList
CompileTimeList
CTList
AliasList
AliasPack
ParamPack
ArgPack
Parameters
Arguments

Given that that D has its roots in C++ and this construct is 
similar to the one in question, it seems like a good fit.


Yes, if C++ integration is going to big thing for D, it sounds 
reasonable to use similar terminology. Searching on 
cppreference.com is useful.




Re: question about the semantics of unshared variables

2015-07-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 16, 2015 06:53:50 aki via Digitalmars-d-learn wrote:
 I noticed just making many threads cause an error.
 Are there any limit for the number of threads?

 import std.concurrency;
 import core.thread;
 void fun() { Thread.sleep(5000.msecs); }
 void testThread() {
   foreach(i; 0..2000) {
   spawn(fun);
   }
 }

 core.thread.ThreadError@src\core\thread.d(2903): Error creating
 thread

The OS has a limit for the number of threads that you can have (though I
would have thought that it was higher than 2000). I'm not aware of any other
limitations, but there might be some. But you may have hit the limit for the
number of threads on your system depending on what OS you're running and
what it's limitations are. Certainly, looking at core.thread, it looks like
it's the C call to create the thread which is failing, which would impy that
the problem is related to the C thread API being used and not what druntime
is doing. You'd have to investigate what the exact error is though.
Unfortunately, druntime doesn't currently get the error code or its
associated message, so I can't tell from what you've posted why the C
function for creating the thread is failing. But aside from debugging it
directly in druntime, you could just create a C/C++ program to create 2000
threads with the C API like you're doing here and see what it does on your
system. That might tell you why your code isn't working.

- Jonathan M Davis



Re: Wait, what? What is AliasSeq?

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 08:00:43 UTC, Marc Schütz wrote:
My point is that there is no type in Ruby that is inherently 
splatty, rather it's the operator that produces this 
behaviour. Therefore, splat is not used as a noun to signify 
such a type.


Yes, please forget about the tongue-in-cheek slang-term splat.  
That's for kids!


splat is just slang for asterisk-something:

https://en.wikipedia.org/wiki/Asterisk

«In Commodore (and related) filesystems, an asterisk appearing 
next to a filename in a directory listing denotes an improperly 
closed file, commonly called a splat file.»


«Certain categories of character types in role-playing games are 
called splats, and the game supplements describing them are 
called splatbooks. This usage originated with the shorthand 
*book for this type of supplement[…]»


«In many MUDs and MOOs, as well as male, female, and other 
more esoteric genders, there is a gender called splat, which 
uses an asterisk to replace the letters that differ in standard 
English gender pronouns. For example, h* is used rather than him 
or her.»


You might as well call it AliasGoo.



Re: Last - but not least! - two DConf talks

2015-07-16 Thread Jacob Carlborg via Digitalmars-d-announce
On 2015-07-16 10:26, Marc =?UTF-8?B?U2Now7x0eiI=?= schue...@gmx.net 
wrote:



Do mixin templates work on module level? They can even have an identifier.


Yes. But a mixin template seems only be able to contain declarations. 
How did you plan to use it?



Unfortunately there are syntactical ambiguities:

 step(foo bar) {
 }
 .foo();

Is that a call chain, or two statements, with the second one calling a
function in the root scope? And I think there are other similar cases...


Hmm, right. I have simple implementation of this. With you're example I 
get this error message:


function main.foo () is not callable using argument types (void 
function() @safe)


--
/Jacob Carlborg


Re: Weird behavior of this in a subclass, I think?

2015-07-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 16, 2015 01:20:10 seashell86 via Digitalmars-d-learn wrote:
 On Thursday, 16 July 2015 at 00:39:29 UTC, H. S. Teoh wrote:
  On Thu, Jul 16, 2015 at 12:18:30AM +, seashell86 via
  Digitalmars-d-learn wrote:
  [...]
 
  The reason is that class variables cannot be overridden, only
  class methods can.
 
  If you want to simulate overriding of class variables, you can
  use a @property method instead:
 
  class Animal {
  @property string voice() { return Wah!; }
  void speak() { writeln(voice); }
  }
 
  class Dog : Animal {
  override @property string voice() { return Whoof!; }
  }
 
 
  T

 Wow, a quick and thorough response! Thank you!  I'm actually
 curious as to why this feature would not be in the language?  Is
 it for performance reasons?

I've never heard of a language that overloaded member variables, and given
how class polymorphism works, I don't see how it would even be possible
without making it so that all accesses to a variable actually call a
function to access it, which would needlessly inefficient (polymorphism
works by looking up the correct function in the class' virtual table, and
the call site isn't going to know at compile time what class it's actually
operating on, so all of that has to be done at runtime). And if you really
want something approximating overriding variables, then you can just use
property functions to access the variable rather than accessing it directly,
and then you can override the property functions.

- Jonathan M Davis



How to use core.thread.Thread

2015-07-16 Thread aki via Digitalmars-d-learn

I can't resolve the compile errors:

import core.thread;
class DerivedThread : Thread {
int count = 0;
this() {
super(run);
}
private void run() {
		inc();	//testThread.d(8): Error: shared method 
testThread.DerivedThread.inc is not callable using a non-shared 
object

}
synchronized void inc() {
		++count;	//testThread.d(11): Deprecation: read-modify-write 
operations are not allowed for shared variables. Use 
core.atomic.atomicOp!+=(this.count, 1) instead.

}
}
void main() {
auto thr = new DerivedThread();
thr.start();
	thr.inc();	//testThread.d(17): Error: shared method 
testThread.DerivedThread.inc is not callable using a non-shared 
object

thr.join();
}


1. Should I declare thr as shared? But
auto thr = new shared DerivedThread();
does not resolve it.

2. Why ++count cause an error? I think it is safe because
it is marked as synchronized. If it is forced to use atomicOp
all the time, it's painful.

3. Are there any tutorials about using Thread class?

Aki.



Re: How to use core.thread.Thread

2015-07-16 Thread maarten van damme via Digitalmars-d-learn
Have you checked out std.parallelism and std.concurrency?

2015-07-16 9:57 GMT+02:00 aki via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com:

 I can't resolve the compile errors:

 import core.thread;
 class DerivedThread : Thread {
 int count = 0;
 this() {
 super(run);
 }
 private void run() {
 inc();  //testThread.d(8): Error: shared method
 testThread.DerivedThread.inc is not callable using a non-shared object
 }
 synchronized void inc() {
 ++count;//testThread.d(11): Deprecation:
 read-modify-write operations are not allowed for shared variables. Use
 core.atomic.atomicOp!+=(this.count, 1) instead.
 }
 }
 void main() {
 auto thr = new DerivedThread();
 thr.start();
 thr.inc();  //testThread.d(17): Error: shared method
 testThread.DerivedThread.inc is not callable using a non-shared object
 thr.join();
 }


 1. Should I declare thr as shared? But
 auto thr = new shared DerivedThread();
 does not resolve it.

 2. Why ++count cause an error? I think it is safe because
 it is marked as synchronized. If it is forced to use atomicOp
 all the time, it's painful.

 3. Are there any tutorials about using Thread class?

 Aki.




Re: Wait, what? What is AliasSeq?

2015-07-16 Thread Adrian Matoga via Digitalmars-d

On Thursday, 16 July 2015 at 05:51:01 UTC, Mike wrote:

A template parameter pack is a template parameter that accepts 
zero or more template arguments (non-types, types, or 
templates). A function parameter pack is a function parameter 
that accepts zero or more function arguments.


A template with at least one parameter pack is called a 
variadic template.


Sound familiar?  I propose simply Pack.


+ 1




Re: Wait, what? What is AliasSeq?

2015-07-16 Thread Adrian Matoga via Digitalmars-d

On Wednesday, 15 July 2015 at 21:44:37 UTC, Timon Gehr wrote:
It should instead be acknowledged that there /should/ be no 
difference in what three things can be passed to X(T...) and 
X(alias a, alias b, alias c). The X(T...) if(T.length==k) 
pattern is ridiculous.


+1


Re: Why aren't you using D at work?

2015-07-16 Thread Adrian Matoga via Digitalmars-d

On Wednesday, 15 July 2015 at 16:27:56 UTC, Piotr Szturmaj wrote:
By the way.. does anyone know if Sociomantic accepts remote D 
jobs?


I guess it's best to ask them directly.
BTW, I was hoping maybe for a software division in Warsaw office.


Re: Auto-Vectorization and array/vector operations

2015-07-16 Thread Iain Buclaw via Digitalmars-d
On 16 July 2015 at 00:42, Steven via Digitalmars-d
digitalmars-d@puremagic.com wrote:
 I was trying to show someone how awesome Dlang was earlier, and how the
 vector operations are expected to take advantage of the CPU vector
 instructions, and was dumbstruck when dmd and gdc both failed to
 auto-vectorize a simple case.  I've stripped it down to the bare minimum and
 loaded the example on the interactive compiler:
 http://asm.dlang.org/#%7B%22version%22%3A3%2C%22filterAsm%22%3A%7B%7D%2C%22compilers%22%3A%5B%7B%22sourcez%22%3A%22JYWwDg9gTgLgBAY2gUwHQGdQBMDcAoPAMwBsIBDGAbQCYBWANgF05kAPM8Y5AQQAoTyVOkzhkANHAEUaDZgCMAlHgDeeOJNLThzBPnUB6fXCjJ0AV2Ix0cYADs45uenRrElZgF5R7uAFo4cu56xsgwZlD2ungAvgRSQrIs7JzIAEL8mgki4hqCMiKKKq7xAByUAMzUjABuZHBeCGToMBmCZZWMCmTBpRVV1XL1iE0tvR0Kcj2Z7f1R6q6GIeaW1nYOZnJgLurVCD5etT7%2BA0EE6iZhEcPNrVqyCrv40UAAA%3D%22%2C%22compiler%22%3A%22dmd2067%22%2C%22options%22%3A%22-O%20-release%20-inline%20-boundscheck%3Doff%22%7D%5D%7D

 The reference documentation for arrays says:
 Implementation note: many of the more common vector operations are expected
 to take advantage of any vector math instructions available on the target
 computer.


DMD makes leverage of vector operations in the library, rather than in
the generated code.  So as long as you are doing array operations
using any of the supported types...


 Does this mean that while compilers are expected to take advantage of them,
 they currently do not, even when they have proper alignment?  I haven't
 tried LDC yet, so maybe LDC does perform auto-vectorization and I should
 attempt to use LDC if I plan on using vector ops a lot?


Auto-vectorization is deliberately strict in what triggers it to occur.

It is possible to give the compiler hints, however I'm not sure that
this should be done by the code generator.

See, for example: http://goo.gl/iMBbRs

Regards
Iain



Re: Why aren't you using D at work?

2015-07-16 Thread Kagamin via Digitalmars-d

On Wednesday, 15 July 2015 at 18:57:35 UTC, Nick Sabalausky wrote:

On 07/15/2015 12:06 PM, Poyeyo wrote:


Lack of a complete MySQL driver. No DECIMAL support that I 
know of. Lack

of MySQL support in vibe.d.


Please file any issues you may have with mysql-native here:
https://github.com/mysql-d/mysql-native

Or ping any existing issues that you may need to ping.


https://github.com/mysql-d/mysql-native/issues/39 ?


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread via Digitalmars-d
On Thursday, 16 July 2015 at 07:14:34 UTC, Ola Fosheim Grøstad 
wrote:

array: run-time indexable bag


Eh... not bag, bag often means value semantics without identity...

array: run-time indexable collection of entities.



Re: Are Lua tables possible to do with D?

2015-07-16 Thread Fusxfaranto via Digitalmars-d-learn

On Thursday, 16 July 2015 at 06:48:12 UTC, Robert M. Münch wrote:
Hi, do you think it's possible to implemented something like 
Lua Tables (a hashed heterogeneous associative array) in D?


I know that Lua is dynamic and interpreted, hence it's a lot 
simpler to do than with a compiled language but I'm wondering 
if we could express such a generic data-structure in D.


An associative array of Variant[string] ought to do the job well 
enough.


http://dlang.org/phobos/std_variant.html


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread Andrea Fontana via Digitalmars-d

On Thursday, 16 July 2015 at 06:32:15 UTC, Jacob Carlborg wrote:

How about Bag or AliasBag?


Blob :)

An object, especially a large one, having no distinct shape or 
definition


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 06:32:15 UTC, Jacob Carlborg wrote:

On 2015-07-07 23:16, Andrei Alexandrescu wrote:
So I thought we were supposed to replace bad names with good 
names.
Template arguments are indexable, so sequence doesn't quite 
apply.


What happened? Why are we replacing a crappy term with another 
crappy term?


How about Bag or AliasBag?


A bag is the same as a C++ multi-set.

Let's go over the common usage:

list: finite ordered source of entities

tuple: in math it is a fixed length list of values, in 
programming it usually has semantics close to a record/struct 
with numbers instead of field names and structural typing.


sequence: infinite or finite list of values of the same 
kind/type


bag: unordered list

set: bag with unique entities

array: run-time indexable bag



Re: question about the semantics of unshared variables

2015-07-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 15, 2015 16:21:29 aki via Digitalmars-d-learn wrote:
 I want to make sure about the semantics of unshared variables.

 import std.concurrency;
 import core.thread;
 ubyte[1024 * 1024] buf1MB;
 void fun() { Thread.sleep(5000.msecs); }
 void testThread() {
   foreach(i; 0..2000) {
   spawn(fun);
   }
 }

 Are instances of buf1MB created for every threads?
 Even if it is never accessed by the threads?
 If some static variable is defined in other module
 or in some library, all of them also instantiated
 for every threads?

Yes. Every thread gets a copy of the non-shared static variables, and all of
the non-shared static constructors get run for each thread.

- Jonathan M Davis



Re: Wait, what? What is AliasSeq? - `Pack` Proposal

2015-07-16 Thread Mike via Digitalmars-d

On Thursday, 16 July 2015 at 05:51:01 UTC, Mike wrote:


C++ also have related use of the word pack:

http://en.cppreference.com/w/cpp/language/parameter_pack


I propose simply Pack.



I know Ola is making light of this situation and many of you find 
this discussion beneath you, but we need a name, and with the 
release looming we need it relatively soon.


I've creating a pull request for Pack 
(https://github.com/D-Programming-Language/phobos/pull/3494) 
which is inspired by C++'s parameter_pack as linked in the 
previous post.


From the description:
A template parameter pack is a template parameter that accepts 
zero or more template arguments (non-types, types, or templates). 
A function parameter pack is a function parameter that accepts 
zero or more function arguments.
A template with at least one parameter pack is called a variadic 
template.


Given that that D has its roots in C++ and this construct is 
similar to the one in question, it seems like a good fit.


I prefer `Pack` over `AliasPack` or other variations because it's 
more general and allows us to be more specific in the future with 
`TypePack`, `ExpressionPack`, `AliasPack`, etc... later, but I'll 
be happy to change it if that's what you all wish.


Ultimately, though, it's going to be a judgment call, and I hope 
having a pull request ready to go makes things easier on those 
who have to make the call.  If it doesn't work, you know where 
the close button is.


Mike





Re: Wait, what? What is AliasSeq?

2015-07-16 Thread via Digitalmars-d

On Wednesday, 15 July 2015 at 19:52:39 UTC, Jacob Carlborg wrote:
On 2015-07-15 18:09, Marc =?UTF-8?B?U2Now7x0eiI=?= 
schue...@gmx.net wrote:


Yeah, splat as a name for an auto-expanding thingy would be 
a novelty.
Ruby for instance doesn't have anything like that, it has a 
splat
_operator_ (asterisk) to expand a normal array, or conversely, 
capture

several arguments in one parameter.


I'm not sure what should count as auto-expanding, but this 
works in Ruby:


a, b = [1, 2]

No extra operator is required in this case.


What I meant is that there is no equivalent to the behaviour of 
TypeTuples:


assert(is(TypeTuple!(int, float, TypeTuple!(string, int)) ==
  TypeTuple!(int, float, string, int));
TypeTuple!(int, int) a;
a[0] = 1; a[1] = 2;
void foo(int, int);
foo(a); // works

But not in Ruby:

[1, 2, [3, 4]] != [1, 2, 3, 4]
def foo a, b ; end
foo([1, 2]);  // doesn't work
foo(*[1, 2]); // but works with splat operator

Maybe auto-flattening is a better name for this behaviour?

My point is that there is no type in Ruby that is inherently 
splatty, rather it's the operator that produces this behaviour. 
Therefore, splat is not used as a noun to signify such a type.


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread via Digitalmars-d

On Wednesday, 15 July 2015 at 21:44:37 UTC, Timon Gehr wrote:
It should instead be acknowledged that there /should/ be no 
difference in what three things can be passed to X(T...) and 
X(alias a, alias b, alias c). The X(T...) if(T.length==k) 
pattern is ridiculous.


Yes, that would immediately solve the objection against Alias 
in the name, beside making the language more consistent.


Re: Auto-Vectorization and array/vector operations

2015-07-16 Thread John Colvin via Digitalmars-d

On Wednesday, 15 July 2015 at 22:42:05 UTC, Steven wrote:
I was trying to show someone how awesome Dlang was earlier, and 
how the vector operations are expected to take advantage of the 
CPU vector instructions, and was dumbstruck when dmd and gdc 
both failed to auto-vectorize a simple case.  I've stripped it 
down to the bare minimum and loaded the example on the 
interactive compiler: 
http://asm.dlang.org/#%7B%22version%22%3A3%2C%22filterAsm%22%3A%7B%7D%2C%22compilers%22%3A%5B%7B%22sourcez%22%3A%22JYWwDg9gTgLgBAY2gUwHQGdQBMDcAoPAMwBsIBDGAbQCYBWANgF05kAPM8Y5AQQAoTyVOkzhkANHAEUaDZgCMAlHgDeeOJNLThzBPnUB6fXCjJ0AV2Ix0cYADs45uenRrElZgF5R7uAFo4cu56xsgwZlD2ungAvgRSQrIs7JzIAEL8mgki4hqCMiKKKq7xAByUAMzUjABuZHBeCGToMBmCZZWMCmTBpRVV1XL1iE0tvR0Kcj2Z7f1R6q6GIeaW1nYOZnJgLurVCD5etT7%2BA0EE6iZhEcPNrVqyCrv40UAAA%3D%22%2C%22compiler%22%3A%22dmd2067%22%2C%22options%22%3A%22-O%20-release%20-inline%20-boundscheck%3Doff%22%7D%5D%7D


[...]


Not sure why DMD isn't using SIMD on the first one, haven't 
looked at that code in a while. Anyway, gdc vectorises both: 
http://goo.gl/CzD15s and that's with gcc4.9 backend, it can 
probably do better build against something more recent.


[Issue 14802] Template argument deduction depends on order of arguments

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14802

Steven Schveighoffer schvei...@yahoo.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||schvei...@yahoo.com
 Resolution|--- |INVALID

--- Comment #1 from Steven Schveighoffer schvei...@yahoo.com ---
template deduction depends on common type deduction.

For two types that implicitly cast to each other, it has to make an arbitrary
decision. Same thing happens with 1, 1U.

However, when it cannot implicitly convert one to the other, the decision is to
use the one that both can accept. For example: 1, 1L yields the same type as
1L, 1.

--


Re: Are Lua tables possible to do with D?

2015-07-16 Thread Robert M. Münch via Digitalmars-d-learn

On 2015-07-16 07:20:15 +, Fusxfaranto said:


An associative array of Variant[string] ought to do the job well enough.

http://dlang.org/phobos/std_variant.html


Thanks a lot. Somehow didn't see that...

--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



Phobos: test suite

2015-07-16 Thread Rikki Cattermole via Digitalmars-d

I do not believe this issue has been raised yet.
But for std.experimental.image (or at least to my intention) I 
will be needing a test suite for e.g. PNG file format 
loader/exporter.


To my knowledge we currently only support unittests for Phobos. 
What I need structure wise is similar to dmd's testsuite.


I do not know nor want to get into setting this up.

For example the PNG file format it should really be tested using 
separate programs to compare against load/export/load for the 
files[0].
This is quite crucial to ensure the correctness of the 
loader/exporter. It will help prevent and detect many bugs.


So, would anybody like to get a head start on it?

[0] http://www.schaik.com/pngsuite/


Re: Where will D sit in the web service space?

2015-07-16 Thread Paulo Pinto via Digitalmars-d

On Thursday, 16 July 2015 at 11:08:52 UTC, rsw0x wrote:

On Thursday, 16 July 2015 at 11:00:19 UTC, Paulo  Pinto wrote:

Well, there are lots of Geometry Wars clones in XNA and LibGDX.

As for Vulkan, I have the strong feeling it is DOA, with 
Apple, Sony, Nintendo, Microsoft favoring they own APIs.


Sure, if they can convince the major graphics vendors to care 
about their proprietary vendor lock-in crap. The only one of 
those that will exist in 5 years is probably DirectX.


Intel, AMD, and Valve are heavily invested in Vulkan. It will 
definitely not be DOA.


Apple has officially dropped OpenGL support at WWDC, if you care 
to watch the presentations and early release documentation.


On those presentations OpenGL has referred as backward 
compatibility only.


All the Mac OS X and iOS frameworks that used OpenGL, now have a 
Metal layer.


They might change their mind and surprise the world, but that is 
how things stand.


In the console market, no one cares about OpenGL. Sony [0], 
Nintendo, Microsoft and even Sega, never cared for it.


So who cares if Intel, AMD, and Valve are heavily invested in 
Vulkan?


The platform vendors that matter to games developers are not.


[0] OpenGL ES 1.0 on the PS 3 wasn't really that usable, everyone 
went native PS3 instead.




Re: Wait, what? What is AliasSeq?

2015-07-16 Thread David Nadlinger via Digitalmars-d

On Thursday, 16 July 2015 at 10:19:11 UTC, Dicebot wrote:
I am all for that but it needs to be explicitly acknowledged 
and implemented together with a rename.


There is no renaming involved here, as the issue concerns the 
alias parameter language constructs. Or are you suggesting using 
another keyword than alias?


 – David


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread David Nadlinger via Digitalmars-d

On Thursday, 16 July 2015 at 06:33:00 UTC, Jacob Carlborg wrote:

On 2015-07-15 23:44, Timon Gehr wrote:

It should instead be acknowledged that there /should/ be no 
difference
in what three things can be passed to X(T...) and X(alias a, 
alias b,

alias c). The X(T...) if(T.length==k) pattern is ridiculous.


I completely agree.


Walter has agreed at DConf that this (i.e. alias not accepting 
basic types) should be fixed.


 — David


Re: Why aren't you using D at work?

2015-07-16 Thread Sönke Ludwig via Digitalmars-d

Am 16.07.2015 um 14:18 schrieb sclytrack:

On Thursday, 16 July 2015 at 12:04:11 UTC, Sönke Ludwig wrote:

Am 15.07.2015 um 18:06 schrieb Poyeyo:

On Thursday, 28 May 2015 at 14:38:51 UTC, Manu wrote:

I've been using D in all my personal projects for years now, but I
lament coding C at work every day, and I pine for salvation.
I seem to have reasonable influence in my workplaces, and I suspect I
could have my workplace adopt D, but when considering the notion with
other staff, we always seem to encounter hard blockers to migration
that stop us in our tracks.

[...]


Lack of a complete MySQL driver. No DECIMAL support that I know of. Lack
of MySQL support in vibe.d.


The mysql-native driver is fully vibe.d compatible.



What is the postgresql variant for vibe.d?

There are so many database api's for D.


Should be https://github.com/pszturmaj/ddb



Re: Where will D sit in the web service space?

2015-07-16 Thread Wyatt via Digitalmars-d
On Sunday, 12 July 2015 at 17:54:02 UTC, Ola Fosheim Grøstad 
wrote:

On Sunday, 12 July 2015 at 12:32:32 UTC, Peter Alexander wrote:

Web servers: Why not?


Mostly because there is no real visible direction towards 
making D a competitor that directly addresses specific needs of 
web programming.



So what?

Personally, I've dealt with perl, ruby, python, java, and php in 
the web space and as far as I'm concerned they're all 
unmaintainable trash.  (perl, ironically, gave me the best 
experience of the five!)


If I ever decide I'm masochistic enough to attempt something in 
that vein again, D is at least as strong a contender for me 
because it offers fast iteration, solid performance, and a type 
system that doesn't make me want to punch small animals.


Go and Rust, for all their theoretical superiority in one place 
or another, _don't feel good_.  Go is to C what Plan 9 is to 
Unix, which is to say it's a thoroughly unimaginitive, 
ideologically hampered, overly-conservative iteration from Rob 
Pike.  Rust might be intriguing if it ever catches up to D in 
being pleasant to use.


-Wyatt


[Issue 13203] conflicting aliases allowed with static if

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13203

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

   What|Removed |Added

   Keywords||pull

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

--


[Issue 2354] conditional compilation rejects else if the declaration is a single pragma

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2354

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

   What|Removed |Added

   Keywords||pull
   Hardware|x86 |All
 OS|Windows |All

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

--


Re: Where will D sit in the web service space?

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 11:00:19 UTC, Paulo  Pinto wrote:

Well, there are lots of Geometry Wars clones in XNA and LibGDX.


The point is more this: the majority of interactive applications 
you can do easily in Java/C#/Swift/Javascript are going to be 
written in those languages for _very_ good reasons. I would too.


If desktop applications are a target then you need a feature set 
that makes it easier to write those applications that are 
difficult to do well in Java/C#/Swift/Javascript.


That makes you an attractive platform for new application 
frameworks.


As for Vulkan, I have the strong feeling it is DOA, with Apple, 
Sony, Nintendo, Microsoft favoring they own APIs.


It takes years before you get full adoption after standardization.

Vulkan/Metal does not matter. What matters is that you do better 
CPU/GPU integration for common hardware than the competing 
solutions. It could be just latest generation of iOS/OSX for a 
start. That alone is a pretty big market.




Re: Where will D sit in the web service space?

2015-07-16 Thread ponce via Digitalmars-d

On Thursday, 16 July 2015 at 10:58:08 UTC, rsw0x wrote:

On Thursday, 16 July 2015 at 10:29:54 UTC, Kagamin wrote:

Like minecraft?


Minecraft runs absolutely horrible, the earlier versions of 
minecraft used to allocate 2-300mb of data per second that was 
near instantly marked garbage.


OTOH, Minecraft Desktop benefits from a single build that work in 
Linux/Mac/Windows, has a web start page, and Notch goes pretty 
fast with Eclipse.


Re: Why aren't you using D at work?

2015-07-16 Thread Sönke Ludwig via Digitalmars-d

Am 15.07.2015 um 18:06 schrieb Poyeyo:

On Thursday, 28 May 2015 at 14:38:51 UTC, Manu wrote:

I've been using D in all my personal projects for years now, but I
lament coding C at work every day, and I pine for salvation.
I seem to have reasonable influence in my workplaces, and I suspect I
could have my workplace adopt D, but when considering the notion with
other staff, we always seem to encounter hard blockers to migration
that stop us in our tracks.

[...]


Lack of a complete MySQL driver. No DECIMAL support that I know of. Lack
of MySQL support in vibe.d.


The mysql-native driver is fully vibe.d compatible.


Re: rust

2015-07-16 Thread Kagamin via Digitalmars-d

http://rainers.github.io/visuald/visuald/StartPage.html


Re: Where will D sit in the web service space?

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 11:08:52 UTC, rsw0x wrote:
Intel, AMD, and Valve are heavily invested in Vulkan. It will 
definitely not be DOA.


Paulo probably referred to Apple announcing Metal for Os-X. So 
you might need to support both as Metal might be better optimized 
for by Apple even if Apple announce Vulkan support. All 
speculations...




Re: Last - but not least! - two DConf talks

2015-07-16 Thread Atila Neves via Digitalmars-d-announce

On Thursday, 16 July 2015 at 08:26:58 UTC, Marc Schütz wrote:
On Wednesday, 15 July 2015 at 19:28:13 UTC, Jacob Carlborg 
wrote:

On 2015-07-13 09:12, Atila Neves wrote:


https://www.reddit.com/r/programming/comments/3d3ooa/behaviourdriven_development_with_d_and_cucumber/


Also on HN, but as usual can't post the link.


The comment about not having to name the steps. One way to do 
that could be something like this:


step(foo bar, {
// step implementation
});

There are two problems with that:

1. D doesn't support module level code like this. Which could 
be solved by either using a unit test block, a module 
constructor or some other function the framework knows about 
to call.


Do mixin templates work on module level? They can even have an 
identifier.


Yes. But it doesn't make it pretty to use:

mixin When!(`...`, { });

Atila



Re: Last - but not least! - two DConf talks

2015-07-16 Thread Atila Neves via Digitalmars-d-announce

On Wednesday, 15 July 2015 at 19:28:13 UTC, Jacob Carlborg wrote:

On 2015-07-13 09:12, Atila Neves wrote:


https://www.reddit.com/r/programming/comments/3d3ooa/behaviourdriven_development_with_d_and_cucumber/


Also on HN, but as usual can't post the link.


The comment about not having to name the steps. One way to do 
that could be something like this:


step(foo bar, {
// step implementation
});

There are two problems with that:

1. D doesn't support module level code like this. Which could 
be solved by either using a unit test block, a module 
constructor or some other function the framework knows about to 
call.


2. That syntax is not as nice as in Ruby. It would be really 
nice if the following could be supported:


step(foo bar) {
// step implementation
}

A trailing delegate syntax, where the delegate is passed after 
the regular argument list.


I tried out something like this to see how I'd like it before the 
talk, and I didn't. I mentioned it but I should've drawn more 
attention to it, it'd look like this:


@When!(`...`, { ... }) {}

The empty block needed at the end was just too ugly.

Atila



Re: Why aren't you using D at work?

2015-07-16 Thread sclytrack via Digitalmars-d

On Thursday, 16 July 2015 at 12:04:11 UTC, Sönke Ludwig wrote:

Am 15.07.2015 um 18:06 schrieb Poyeyo:

On Thursday, 28 May 2015 at 14:38:51 UTC, Manu wrote:
I've been using D in all my personal projects for years now, 
but I

lament coding C at work every day, and I pine for salvation.
I seem to have reasonable influence in my workplaces, and I 
suspect I
could have my workplace adopt D, but when considering the 
notion with
other staff, we always seem to encounter hard blockers to 
migration

that stop us in our tracks.

[...]


Lack of a complete MySQL driver. No DECIMAL support that I 
know of. Lack

of MySQL support in vibe.d.


The mysql-native driver is fully vibe.d compatible.



What is the postgresql variant for vibe.d?

There are so many database api's for D.






Re: Where will D sit in the web service space?

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 12:44:22 UTC, Wyatt wrote:
Personally, I've dealt with perl, ruby, python, java, and php 
in the web space and as far as I'm concerned they're all 
unmaintainable trash.  (perl, ironically, gave me the best 
experience of the five!)


What advantage can perl possibly have over Python? I ditched perl 
over 10 years ago and never looked back.


If I ever decide I'm masochistic enough to attempt something in 
that vein again, D is at least as strong a contender for me 
because it offers fast iteration, solid performance, and a type 
system that doesn't make me want to punch small animals.


Well, the development-server-framework I use reload automatically 
whenever I save a file, so I am for now happy with iteration 
speed as I don't perceive any delays worth thinking about.


With PyCharm I also get debugger/web server integration and the 
PyCharm background-sanitizer gets pretty close to having static 
typing actually. Impressive for a dynamic language! Wish I had 
picked it up earlier!


If you go node.js, you get static typing with typescript if you 
want + same language on the browser, debuggable.


If you go Dart you get static typing if you want  + same language 
the browser, debuggable.


But in terms of programmer-productivity I think Python is hard to 
match in the webspace (for a wide range of reasons).


So I think you need to look at what exists _TODAY_ in the 
webspace, not what you used 3 years ago. That's history.


Go and Rust, for all their theoretical superiority in one 
place or another, _don't feel good_.  Go is to C what Plan 9 is 
to Unix, which is to say it's a thoroughly unimaginitive, 
ideologically hampered, overly-conservative iteration from Rob 
Pike.  Rust might be intriguing if it ever catches up to D in 
being pleasant to use.


I haven't used Go or Rust fulltime for the amount of time needed 
to get fully familiar with them (I guess that would take me 1-2 
months fulltime or so).


So I can't really say whether what I feel as oddities now will 
persist. I felt that Cs syntax was odd too, when I came to it 
from Pascal/asm.


So I am more concerned about the feature set, my brain can 
usually get around unusual choices if there is syntactical and 
semantic consistency.






Re: Wait, what? What is AliasSeq?

2015-07-16 Thread David Nadlinger via Digitalmars-d

On Thursday, 16 July 2015 at 14:38:09 UTC, Dicebot wrote:
I mean that if name AliasSomething goes to 2.068, matching 
change to compiler argument lists must land in same release - 
and there must be a change log entry connecting and explaining 
those two.


I disagree with that. These aren't related at all. The change 
would affect alias params, not argument lists (which already 
accept everything).


 — David


[Issue 14802] Template argument deduction depends on order of arguments

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14802

--- Comment #4 from Steven Schveighoffer schvei...@yahoo.com ---
In the case of integer literal + short array, this is a different story,
because:

foo!int(1, a) and foo!short(1, a) do not both compile.

However, for double/float:

f!double(1.0, 1.0f) and f!float(1.0, 1.0f) both compile.

Decision is necessarily arbitrary because both can compile. To make the
decision consistent is not necessarily a bug fix, I can see how the compiler
is free to arbitrarily decide which type to use.

However, I'll note that in other cases, the compiler prefers one over the
other:

// both double[]
auto arr = [1.0, 1.0f];
auto arr2 = [1.0f, 1.0];

// both double
auto x = true ? 1.0 : 1.0f;
auto x2 = true ? 1.0f : 1.0;

same for uint vs. int

--


[Issue 14626] [REG2.066] byValue doesn't work with inout AA

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14626

--- Comment #4 from Kenji Hara k.hara...@gmail.com ---
(In reply to Steven Schveighoffer from comment #1)
 That it worked before I think is a bug (the compiler did a lot of
 hand-waving with AA's to avoid sticky issues).

Yes, there was a compiler hack for the inout key/value types.
https://github.com/D-Programming-Language/dmd/blob/v2.065.0/src/mtype.c#L4897

(In reply to Martin Nowak from comment #3)
 Looks like the classical, mutable iterator over const/immutable container
 issue complicated by inout.
 Not sure if we can solve it with the current language features.

It would be a new DIP to extend inout feature.

--


[Issue 14626] [REG2.066] byValue doesn't work with inout AA

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14626

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

   What|Removed |Added

   Keywords||pull

--- Comment #5 from Kenji Hara k.hara...@gmail.com ---
Emulate the 2.065 and earlier behavior.
https://github.com/D-Programming-Language/druntime/pull/1324

--


[Issue 14802] Template argument deduction depends on order of arguments

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14802

--- Comment #2 from Ivan Timokhin timokhin...@gmail.com ---
(In reply to Steven Schveighoffer from comment #1)
 template deduction depends on common type deduction.
 
 For two types that implicitly cast to each other, it has to make an
 arbitrary decision. Same thing happens with 1, 1U.
 
 However, when it cannot implicitly convert one to the other, the decision is
 to use the one that both can accept. For example: 1, 1L yields the same type
 as 1L, 1.

Well, if this is expected and desired, then all right, but this is certainly
weird.

For one, I dont't think compiler should make arbitrary decisions on user's
behalf. It might just as well pick an arbitrary function from an overload set
if there are several equally good candidates, but it doesn't. Why does it do so
for types?

Furthermore, in both cases there seems to be one option that is better than the
other: for float and double the common type should definitely be double, as
more precise, for int and uint — probably uint, because int is promoted to uint
in arithmetic expressions, but not the other way around.

--


Re: Where will D sit in the web service space?

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 14:07:29 UTC, rsw0x wrote:
for Microsoft - never.) 6-7 android phones are selling per iOS 
phone, and this is projected to keep going up thanks to 
developing countries entering the market and Apple's popularity 
falling amongst western demographics.


No, Vulkan will _not_ be DOA.


Exactly. Apple usually avoid making announcements until they are 
certain that products will be ready for consumption. So being 
silent about Vulkan is business as usual. Apple don't do public 
roadmaps like Intel/AMD...


Having Metal on OSX is just another step in harmonizing iOS and 
OSX apis. Probably happens now due the desktop GPU situation. We 
need to keep in mind that iOS units have different GPUs.




Re: Where will D sit in the web service space?

2015-07-16 Thread Paulo Pinto via Digitalmars-d

On Thursday, 16 July 2015 at 14:07:29 UTC, rsw0x wrote:

On Thursday, 16 July 2015 at 13:17:43 UTC, Paulo  Pinto wrote:

[...]


PC game revenue outpaced console game revenue in 2012 or 
2013(...PC gaming segment is already twice the size of the 
console gaming market – and growing. ,) Sony and Microsoft 
haven't seen profits from their consoles in over a decade(and 
for Microsoft - never.) 6-7 android phones are selling per iOS 
phone, and this is projected to keep going up thanks to 
developing countries entering the market and Apple's popularity 
falling amongst western demographics.


[...]


Sure, but in what concerns PC games, DirectX rules.

Also Google hasn't shown any interest into adding Vulkan support 
to Android.


They don't even support OpenCL, pushing instead for Renderscript.



Re: Where will D sit in the web service space?

2015-07-16 Thread via Digitalmars-d

On Thursday, 16 July 2015 at 13:17:43 UTC, Paulo  Pinto wrote:
Apple has officially dropped OpenGL support at WWDC, if you 
care to watch the presentations and early release documentation.


Are you sure they have _dropped_ OpenGL and not just got switched 
away from using OpenGL as their low level layer for Cocoa?


https://developer.apple.com/opengl/
https://developer.apple.com/opencl/
https://developer.apple.com/metal/

They might change their mind and surprise the world, but that 
is how things stand.


AFAIK they are on the Vulkan working group, but probably don't 
view Vulkan as ready for consumption. They needed Metal on iOS 
because GPUs on iPads/iPhones are weak. That happend before 
Vulkan came along.


So it makes sense to move Metal to OS-X while waiting for Vulkan 
to mature on their hardware (or rather waiting for older GPUs to 
be irrelevant). They have a compatibility interest in keeping 
developers on Metal until iPhones/iPads are ready for Vulkan.


So who cares if Intel, AMD, and Valve are heavily invested in 
Vulkan?


Intel, AMD, NVIDIA and Imagination are all in on Vulkan, aren't 
they?


Everybody cares about what they do because they write the drivers 
for next gen GPUs. It makes sense to focus Vulkan-effort on next 
generation of hardware for vendors (profit motive).


It is not at all obvious that Apple will want to keep writing and 
maintaining their own low level drivers once GPU vendors ship 
solid Vulkan implementations.


Of course, Apple cannot tell the public that Metal will become 
irrelevant in a few years... They have a story to sell.


Re: Functional oriented programming in D

2015-07-16 Thread Meta via Digitalmars-d-learn
On Thursday, 16 July 2015 at 09:57:55 UTC, Jarl André Hübenthal 
wrote:

On Thursday, 16 July 2015 at 09:52:59 UTC, ponce wrote:
On Thursday, 16 July 2015 at 09:49:03 UTC, Jarl André 
Hübenthal wrote:

Why?


The syntax for delegate literals with braces is


listenHTTP(settings, (req, res) {
res.writeBody(Hello, World!);
});


Thanks. Those small details you forget to test before asking is 
a bit embarrassing. I blame Scala for it :) In Scala its 
(req,res) = { ... } consistently.


The difference in D is that (req, res) = { ... } is still valid 
syntax, but it doesn't do what you'd expect. { /* some code */ } 
is a valid delegate literal in D, specifying a delegate literal 
that takes no arguments. Thus, (req, res) = { /* some code */ } 
actually creates a delegate literal than returns *another* 
delegate literal.


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread Dicebot via Digitalmars-d

On Thursday, 16 July 2015 at 14:40:16 UTC, David Nadlinger wrote:

On Thursday, 16 July 2015 at 14:38:09 UTC, Dicebot wrote:
I mean that if name AliasSomething goes to 2.068, matching 
change to compiler argument lists must land in same release - 
and there must be a change log entry connecting and explaining 
those two.


I disagree with that. These aren't related at all. The change 
would affect alias params, not argument lists (which already 
accept everything).


 — David


We are arguing about a name for argument lists. For name 
'AliasSomething' to not be a lie, `T...` must be be absolutely 
identical to `alias a, alias b, ...` which currently is not the 
case.


Re: Where will D sit in the web service space?

2015-07-16 Thread rsw0x via Digitalmars-d

On Thursday, 16 July 2015 at 13:17:43 UTC, Paulo  Pinto wrote:

On Thursday, 16 July 2015 at 11:08:52 UTC, rsw0x wrote:

On Thursday, 16 July 2015 at 11:00:19 UTC, Paulo  Pinto wrote:

[...]


Sure, if they can convince the major graphics vendors to care 
about their proprietary vendor lock-in crap. The only one of 
those that will exist in 5 years is probably DirectX.


Intel, AMD, and Valve are heavily invested in Vulkan. It will 
definitely not be DOA.


Apple has officially dropped OpenGL support at WWDC, if you 
care to watch the presentations and early release documentation.


On those presentations OpenGL has referred as backward 
compatibility only.


All the Mac OS X and iOS frameworks that used OpenGL, now have 
a Metal layer.


They might change their mind and surprise the world, but that 
is how things stand.


In the console market, no one cares about OpenGL. Sony [0], 
Nintendo, Microsoft and even Sega, never cared for it.


So who cares if Intel, AMD, and Valve are heavily invested in 
Vulkan?


The platform vendors that matter to games developers are not.


[0] OpenGL ES 1.0 on the PS 3 wasn't really that usable, 
everyone went native PS3 instead.


PC game revenue outpaced console game revenue in 2012 or 
2013(...PC gaming segment is already twice the size of the 
console gaming market – and growing. ,) Sony and Microsoft 
haven't seen profits from their consoles in over a decade(and for 
Microsoft - never.) 6-7 android phones are selling per iOS phone, 
and this is projected to keep going up thanks to developing 
countries entering the market and Apple's popularity falling 
amongst western demographics.


No, Vulkan will _not_ be DOA.

http://www.forbes.com/sites/chuckjones/2015/04/06/apples-worldwide-iphone-market-share-declining-except-in-china/
http://www.forbes.com/sites/jasonevangelho/2014/04/28/as-global-pc-game-revenue-surpasses-consoles-how-long-should-console-makers-keep-fighting/
http://www.forbes.com/sites/marcochiappetta/2014/07/14/the-console-war-is-over-the-pc-already-won/


[Issue 14788] Incorrect rejection of inout function call

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14788

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

   What|Removed |Added

 Blocks|14626   |

--- Comment #1 from Kenji Hara k.hara...@gmail.com ---
(In reply to Kenji Hara from comment #0)
 This compiler bug is blocking fix for the regression issue 14626.

Now it's not required.

--


[Issue 14626] [REG2.066] byValue doesn't work with inout AA

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14626

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

   What|Removed |Added

 Depends on|14788   |

--


[Issue 14788] Incorrect rejection of inout function call

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14788

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

   What|Removed |Added

   Keywords||pull

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

--


[Issue 14802] Template argument deduction depends on order of arguments

2015-07-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14802

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

   What|Removed |Added

 Status|RESOLVED|REOPENED
   Hardware|x86_64  |All
 Resolution|INVALID |---
 OS|Linux   |All

--- Comment #3 from Kenji Hara k.hara...@gmail.com ---
From 2.066, IFTI is improved to support following case.

void foo(T)(T, T[] a) { pragma(msg, T); }
void main()
{
short[] a;
foo(1, a);  // prints 'short'
}

See also: https://issues.dlang.org/show_bug.cgi?id=12290

I think this issue is a part of the implemented enhancement.

At least, the order dependent behavior is a bug in D. Instead it should be
consistent result.

--


Re: Wait, what? What is AliasSeq?

2015-07-16 Thread Dicebot via Digitalmars-d

On Thursday, 16 July 2015 at 13:48:06 UTC, David Nadlinger wrote:

On Thursday, 16 July 2015 at 10:19:11 UTC, Dicebot wrote:
I am all for that but it needs to be explicitly acknowledged 
and implemented together with a rename.


There is no renaming involved here, as the issue concerns the 
alias parameter language constructs. Or are you suggesting 
using another keyword than alias?


 – David


I mean that if name AliasSomething goes to 2.068, matching change 
to compiler argument lists must land in same release - and there 
must be a change log entry connecting and explaining those two.


  1   2   >