Re: friends with phobos, workaround?

2015-09-09 Thread Idan Arye via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 20:19:44 UTC, Daniel N wrote: For the record, I think D made the right decision... omitting friends. However there's one case in particular which I find useful, anyone see a good workaround for this? #include class Friendly { private: int val;

Re: How to avoid multiple spelling `import`

2015-06-16 Thread Idan Arye via Digitalmars-d-learn
On Tuesday, 16 June 2015 at 09:33:22 UTC, Dennis Ritchie wrote: Hi, I can write this: import std.range : chain, split; But I can not write this: import std.range : chain, split, std.algorithm : map, each; We have several times to write the word `import`: import std.range : chain, split;

Re: Why is there no named parameter support?

2015-06-08 Thread Idan Arye via Digitalmars-d-learn
On Monday, 8 June 2015 at 20:36:10 UTC, Yuxuan Shui wrote: Is there any reasons/difficulties for not implementing named parameters? There is clearly a need: http://forum.dlang.org/thread/wokfqqbexazcguffw...@forum.dlang.org#post-pxndhoskpjxvnoacajaz:40forum.dlang.org

Re: Python's features, which requires D

2015-05-24 Thread Idan Arye via Digitalmars-d-learn
On Sunday, 24 May 2015 at 11:07:19 UTC, Dennis Ritchie wrote: On Sunday, 24 May 2015 at 02:43:47 UTC, Idan Arye wrote: I'm a fan of lisp(Clojure being my favorite. Too bad it takes about a century just to load the runtime...), and yet I find it quite ironic that Paul Graham claims lisp to be

Re: Python's features, which requires D

2015-05-24 Thread Idan Arye via Digitalmars-d-learn
On Sunday, 24 May 2015 at 15:40:21 UTC, Dennis Ritchie wrote: On Sunday, 24 May 2015 at 14:15:55 UTC, Idan Arye wrote: This IS ironic, because Paul Graham claims lisp to be the most powerful, but if he have ever encounter a more powerful language he couldn't accept it is more powerful than

Re: Python's features, which requires D

2015-05-23 Thread Idan Arye via Digitalmars-d-learn
On Saturday, 23 May 2015 at 22:01:42 UTC, Dennis Ritchie wrote: You may find it nonsense, but Paul Graham says that each language has its own power. He believes that Lisp is the most powerful language, and programmers who write in other languages, he said Blub programmers. Learn more about The

Re: Returning an empty range of a given type

2015-05-17 Thread Idan Arye via Digitalmars-d-learn
On Friday, 15 May 2015 at 03:47:46 UTC, rcorre wrote: On Friday, 15 May 2015 at 03:22:43 UTC, rcorre wrote: On Thursday, 14 May 2015 at 14:57:26 UTC, Idan Arye wrote: How about a more flexible solution? http://dpaste.dzfl.pl/2f99cc270651 Neat, thanks! The range I don't pick may be an

Re: Returning an empty range of a given type

2015-05-14 Thread Idan Arye via Digitalmars-d-learn
On Thursday, 14 May 2015 at 12:40:57 UTC, rcorre wrote: So I thought this might work: struct MaybeEmpty(R) if (isInputRange!R) { private bool _isEmpty; private R_input; alias _input this; this(bool isEmpty, R input) { _input = input; _isEmpty = isEmpty; } @property

Re: Run-time Indexing of a Compile-Time Tuple

2015-05-12 Thread Idan Arye via Digitalmars-d-learn
On Monday, 11 May 2015 at 22:46:00 UTC, Per Nordlöw wrote: The pattern final switch (_index) { import std.range: empty, front; foreach (i, R; Rs) { case i:

Re: Destruction in D

2015-05-01 Thread Idan Arye via Digitalmars-d-learn
On Friday, 1 May 2015 at 17:45:02 UTC, bitwise wrote: On Friday, 1 May 2015 at 02:35:52 UTC, Idan Arye wrote: On Thursday, 30 April 2015 at 23:27:49 UTC, bitwise wrote: Well, the third thing was just my reasoning for asking in the first place. I need to be able to acquire/release shared

Re: Destruction in D

2015-04-30 Thread Idan Arye via Digitalmars-d-learn
On Thursday, 30 April 2015 at 23:27:49 UTC, bitwise wrote: Well, the third thing was just my reasoning for asking in the first place. I need to be able to acquire/release shared resources reliably, like an OpenGL texture, for example. If you want to release resources, you are going to have to

Re: anonymous template predicates

2015-04-30 Thread Idan Arye via Digitalmars-d-learn
On Thursday, 30 April 2015 at 21:01:36 UTC, Vlad Levenfeld wrote: I was wondering if there's a mechanism to make anonymous templates, e.g. given: enum Policy {A, B} alias List = TypeTuple!(...); instead of this: enum has_policy_A (T) = T.policy == Policy.A; alias Result =

Re: Possible to write a classic fizzbuzz example using a UFCS chain?

2015-04-28 Thread Idan Arye via Digitalmars-d-learn
On Tuesday, 28 April 2015 at 11:03:09 UTC, bearophile wrote: Gary Willoughby: I wondered if it was possible to write a classic fizzbuzz[1] example using a UFCS chain? I've tried and failed. Is this OK? void main() { import std.stdio, std.algorithm, std.range, std.conv, std.functional;

Re: User defined properties signatures

2015-04-21 Thread Idan Arye via Digitalmars-d-learn
On Tuesday, 21 April 2015 at 13:53:15 UTC, Dicebot wrote: On Tuesday, 21 April 2015 at 13:27:48 UTC, Marc Schütz wrote: On Monday, 20 April 2015 at 20:22:40 UTC, Jonathan M Davis wrote: There may be languages out there which take the the return type into account when overloading, but I've

Re: why cant function parameters be grouped by type ?

2015-04-12 Thread Idan Arye via Digitalmars-d-learn
On Sunday, 12 April 2015 at 11:49:19 UTC, Baz wrote: Hi, while variable declarations work in list: uint a,b,c; function parameters declarations don't: void foo(uint a,b,c); Because of this, function declarations are sometimes super-wide. (despite of the fact that:

Re: Dlang seems like java now,but why not let d more like C# Style?

2015-03-17 Thread Idan Arye via Digitalmars-d-learn
On Tuesday, 17 March 2015 at 10:07:19 UTC, Kagamin wrote: On Monday, 16 March 2015 at 13:24:28 UTC, Idan Arye wrote: I don't think the problem is the lack of pattern matching. I think the problem is that by forcing the query syntax into lambda expression syntax, you obfuscate the syntax tree

Re: Dlang seems like java now,but why not let d more like C# Style?

2015-03-16 Thread Idan Arye via Digitalmars-d-learn
On Monday, 16 March 2015 at 12:18:42 UTC, Ellery Newcomer wrote: On Sunday, 15 March 2015 at 14:58:54 UTC, Idan Arye wrote: Even if we can't get the lambdas as syntax tress, the fact that we can send whatever types we want to the delegates and overload operators and stuff means we can still

Re: Dlang seems like java now,but why not let d more like C# Style?

2015-03-15 Thread Idan Arye via Digitalmars-d-learn
On Sunday, 15 March 2015 at 00:56:24 UTC, Ellery Newcomer wrote: On Saturday, 14 March 2015 at 23:57:33 UTC, weaselcat wrote: On Saturday, 14 March 2015 at 23:46:28 UTC, Ellery Newcomer wrote: And C# has LINQ, which when combined with the last point is fricken awesome. what does LINQ offer

Re: Dlang seems like java now,but why not let d more like C# Style?

2015-03-15 Thread Idan Arye via Digitalmars-d-learn
On Saturday, 14 March 2015 at 09:59:05 UTC, dnewer wrote: yes,java is good lang,but i dont think it's better than c#,if no oracle or google support java will less and less. C# is a good and easy lang. i like C# . but,C# cant compiled to native code. So far, I have been searching for a

Re: Can pointers to values inside associative arrays become invalid?

2015-01-06 Thread Idan Arye via Digitalmars-d-learn
On Tuesday, 6 January 2015 at 16:30:14 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Tue, Jan 06, 2015 at 04:18:17PM +, Idan Arye via Digitalmars-d-learn wrote: I have an associative array, and I use the `in` operator to get a reference to a value inside it and store it in a pointer

Can pointers to values inside associative arrays become invalid?

2015-01-06 Thread Idan Arye via Digitalmars-d-learn
I have an associative array, and I use the `in` operator to get a reference to a value inside it and store it in a pointer: int[string] aa; aa[myKey] = 42; int* myPointer = myKey in aa; Is it possible that due to rehashing or something D will decide to move the associative array's

Can the order in associative array change when keys are not midified?

2015-01-01 Thread Idan Arye via Digitalmars-d-learn
If I have an associative array and I only modify it's values, without changing the keys, can I assume that the order won't change?

Re: Can the order in associative array change when keys are not midified?

2015-01-01 Thread Idan Arye via Digitalmars-d-learn
On Thursday, 1 January 2015 at 13:39:57 UTC, Peter Alexander wrote: On Thursday, 1 January 2015 at 13:13:10 UTC, Andrej Mitrovic via Digitalmars-d-learn wrote: On 1/1/15, Idan Arye via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: If I have an associative array and I only modify

Re: is there any reason UFCS can't be used with 'new'?

2014-09-28 Thread Idan Arye via Digitalmars-d-learn
On Sunday, 28 September 2014 at 19:32:11 UTC, Jay wrote: thanks! but i'm still interested *why* you can't have this with 'new'. if there's no good reason i will file a bug report. Because `new` is not a function - it's an operator.

Re: Why no multiple-dispatch?

2014-08-25 Thread Idan Arye via Digitalmars-d-learn
On Monday, 25 August 2014 at 02:04:43 UTC, Aerolite wrote: On Monday, 25 August 2014 at 01:34:14 UTC, Idan Arye wrote: On Monday, 25 August 2014 at 01:10:32 UTC, Aerolite wrote: -- No syntax modification (unless you want the feature to be optional) If this ever gets into the core language,

Re: Why no multiple-dispatch?

2014-08-25 Thread Idan Arye via Digitalmars-d-learn
On Monday, 25 August 2014 at 10:02:41 UTC, Aerolite wrote: On Monday, 25 August 2014 at 07:36:22 UTC, Idan Arye wrote: If multi-dispatching is done at compile-time, it can't rely on the object's runtime type - only on the static type of the reference that holds it. This is no different than

Re: Why no multiple-dispatch?

2014-08-24 Thread Idan Arye via Digitalmars-d-learn
On Monday, 25 August 2014 at 00:08:25 UTC, Jonathan M Davis wrote: On Sunday, 24 August 2014 at 23:42:51 UTC, Aerolite wrote: Hey all, I was surprised to learn yesterday that D does not actually support Multiple-Dispatch, also known as Multimethods. Why is this? Support for this feature is

Re: Why no multiple-dispatch?

2014-08-24 Thread Idan Arye via Digitalmars-d-learn
On Monday, 25 August 2014 at 00:36:40 UTC, Vladimir Panteleev wrote: On Monday, 25 August 2014 at 00:20:26 UTC, Vladimir Panteleev wrote: dynamic!ReactSpecialization(me, other); Here's a very basic implementation: http://dpaste.dzfl.pl/5150ca9c13f4 Idan Arye is also working on functional

Re: Why no multiple-dispatch?

2014-08-24 Thread Idan Arye via Digitalmars-d-learn
On Monday, 25 August 2014 at 01:10:32 UTC, Aerolite wrote: -- No syntax modification (unless you want the feature to be optional) If this ever gets into the core language, it absolutely must be optional! Think of the implications of having this as the default and only behavior: * Every

Re: Value of floating in JSONValue

2014-08-21 Thread Idan Arye via Digitalmars-d-learn
On Thursday, 21 August 2014 at 23:05:48 UTC, Ali Çehreli wrote: I don't think it is a concern as JSON does not encode types. It is up to the receiver how to interpret the data. Here is the output of the program above: {value:1.234567889998901} Ali JSON may not encode the very specific

Re: In the new D release why use free functions instead of properties?

2014-08-18 Thread Idan Arye via Digitalmars-d-learn
On Monday, 18 August 2014 at 21:17:11 UTC, Jonathan M Davis wrote: On Monday, 18 August 2014 at 21:02:09 UTC, Gary Willoughby wrote: In the new D release there have been some changes regarding built-in types. http://dlang.org/changelog.html?2.066#array_and_aa_changes I would like to learn

Re: In the new D release why use free functions instead of properties?

2014-08-18 Thread Idan Arye via Digitalmars-d-learn
On Tuesday, 19 August 2014 at 00:54:25 UTC, Idan Arye wrote: On Monday, 18 August 2014 at 21:17:11 UTC, Jonathan M Davis wrote: On Monday, 18 August 2014 at 21:02:09 UTC, Gary Willoughby wrote: In the new D release there have been some changes regarding built-in types.

Re: getting autocompletion in emacs

2014-08-08 Thread Idan Arye via Digitalmars-d-learn
On Thursday, 7 August 2014 at 17:46:13 UTC, nikki wrote: I want to learn SDL2 and learn D at the same time, for the SDL2 part autocompletion would be very nice. I've found DCD but can't get it working (not finding symbols or declarations) at the moment but I was wondering if there are any