Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-29 Thread pineapple via Digitalmars-d
On Thursday, 29 September 2016 at 11:45:42 UTC, Marc Schütz wrote: On Wednesday, 28 September 2016 at 22:12:27 UTC, Idan Arye wrote: Foo foo; try { foo = Foo(); } catch (FooCreationException) { // ... } else { foo.doSomethingWithFoo(); } // foo

Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-29 Thread Steven Schveighoffer via Digitalmars-d
On 9/28/16 6:12 PM, Idan Arye wrote: On Wednesday, 28 September 2016 at 21:00:00 UTC, Steven Schveighoffer wrote: Declaring variables that you need in the right scopes is pretty straightforward. Having scopes magically continue around other separate scopes (catch scopes) doesn't look correct. I

Re: Reinstalled Mac

2016-09-29 Thread Guillaume Piolat via Digitalmars-d-learn
On Thursday, 29 September 2016 at 06:24:08 UTC, Jacob Carlborg wrote: On 2016-09-29 03:43, David Nadlinger wrote: Jacob is also the author of DVM, so he might be a bit biased. ;) And you would never recommend LDC? ;) More or less related: it would be nice if DVM supports LDC fetching and

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Minty Fresh via Digitalmars-d
On Thursday, 29 September 2016 at 12:54:54 UTC, Jacob Carlborg wrote: BTW, there's a CTFE parser generator for D around somewhere. And that will handle all that the DMD parser does? I don't think so. I agree with this entirely. Lest you have an entire D compiler implemented in CTFE

Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-29 Thread Steven Schveighoffer via Digitalmars-d
On 9/29/16 7:02 AM, pineapple wrote: On Thursday, 29 September 2016 at 10:51:01 UTC, Nick Treleaven wrote: Note that finally(bool) is more flexible than finally/else as you can interleave code arbitrarily. __guard makes it clearer something special is happening rather than just implicitly

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Stefan Koch via Digitalmars-d
On Thursday, 29 September 2016 at 13:58:44 UTC, Eugene Wissner wrote: On Wednesday, 14 September 2016 at 20:28:13 UTC, Stefan Koch wrote: On Wednesday, 14 September 2016 at 20:24:13 UTC, Stefan Koch wrote: I would like to see users of fullyQualifiedName because apart from binderoo code which

Re: Learning ddoc

2016-09-29 Thread Antonio Corbi via Digitalmars-d-learn
On Thursday, 29 September 2016 at 11:50:26 UTC, bachmeier wrote: On Thursday, 29 September 2016 at 09:35:56 UTC, Antonio Corbi wrote: [...] They used https://github.com/economicmodeling/harbored Thanks! that's it. Antonio

Release candidate vibe.d 0.7.30-rc.1

2016-09-29 Thread Sönke Ludwig via Digitalmars-d-announce
Am 31.08.2016 um 10:57 schrieb Sönke Ludwig: Main changes over 0.7.29: - Compiles on the latest DMD version - Added a new authorization framework for the web/REST interface generators - Extended the serialization framework with more hooks and traits, enabling the use of custom

Re: The XML and JSON library

2016-09-29 Thread Nick Sabalausky via Digitalmars-d
On 09/28/2016 05:40 PM, Szabo Bogdan wrote: How about Json... there is something that is stopping the D community to move the `vibe.data.json` to `phobos`? Why does it need to be in phobos? It's already usable as-is. Only libraries within a std lib are valid?

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread rikki cattermole via Digitalmars-d
Me and Cauterite were toying with the idea of AST macros but in a completely new form a while ago. Below is the usage of it. Something you'll notice about it is that it could turn the asm block into a library solution (which is clearly what we'd want anyway). Not to mention Linq style

Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-29 Thread Jack Stouffer via Digitalmars-d
On Thursday, 29 September 2016 at 12:24:31 UTC, Andrei Alexandrescu wrote: Once submitted, if rejected, the only way to propose a similar feature is by authoring a new proposal with a completely novel perspective. So official review is an important milestone with a high bar. -- Andrei Ok, I

Re: D, ZeroMQ, Nanomsg

2016-09-29 Thread qznc via Digitalmars-d
On Thursday, 29 September 2016 at 04:18:55 UTC, Nikolay wrote: On Wednesday, 28 September 2016 at 11:53:05 UTC, Russel Winder wrote: Has anyone wrapped Nanomsg? Be aware - Nanomsg project is mostly dead now. See http://sealedabstract.com/rants/nanomsg-postmortem-and-other-stories/ That

Re: "Disappearing" operator methods

2016-09-29 Thread Marc Schütz via Digitalmars-d
Please have a look at this PR: https://github.com/dlang/dmd/pull/6140 However, the error message printed with this PR isn't particularly helpful either: Error: incompatible types for ((5) in (m2)): 'int' and 'const(MyTable)' You might want to add a comment there, and/or open an enhancement

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Jacob Carlborg via Digitalmars-d
On 2016-09-29 11:31, pineapple wrote: This is not an argument to justify adding just any feature, it's an argument that it is idiocy to give a programmer a powerful tool, and then impose arbitrary limitations upon how they are allowed to use it. One of the most popular topics of discussion in

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread rikki cattermole via Digitalmars-d
On 30/09/2016 2:18 AM, Jacob Carlborg wrote: On 2016-09-29 14:57, rikki cattermole wrote: Me and Cauterite were toying with the idea of AST macros but in a completely new form a while ago. Below is the usage of it. Something you'll notice about it is that it could turn the asm block into a

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Eugene Wissner via Digitalmars-d
On Wednesday, 14 September 2016 at 20:28:13 UTC, Stefan Koch wrote: On Wednesday, 14 September 2016 at 20:24:13 UTC, Stefan Koch wrote: I would like to see users of fullyQualifiedName because apart from binderoo code which seems to work, I have none. That was supposed to say : I would like

[Issue 15984] [REG2.071] Interface contracts retrieve garbage instead of parameters

2016-09-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15984 anonymous4 changed: What|Removed |Added CC||be...@caraus.de ---

[Issue 16565] Implementing an interface with preconditions causes segfault

2016-09-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16565 anonymous4 changed: What|Removed |Added Status|NEW |RESOLVED

Re: Qualifier parameters (inout on steroids)

2016-09-29 Thread Steven Schveighoffer via Digitalmars-d
On 9/29/16 8:53 AM, Tomer Filiba wrote: `inout` is a useful feature, but it's nearly impossible to actually use it. Suppose I have struct MyTable { @property items() inout { return Range(); } static struct Range { MyTable* table; // can't be inout } } I want my

Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-29 Thread Andrei Alexandrescu via Digitalmars-d
On 09/29/2016 09:00 AM, pineapple wrote: One thing I'd point out: You rewrote my rewritten examples without using `else`, but as was stated immediately before I listed those examples: The best examples of code that can be more elegantly written using this `else` clause occur in application

Qualifier parameters (inout on steroids)

2016-09-29 Thread Tomer Filiba via Digitalmars-d
`inout` is a useful feature, but it's nearly impossible to actually use it. Suppose I have struct MyTable { @property items() inout { return Range(); } static struct Range { MyTable* table; // can't be inout } } I want my items-range to be const if `this` is

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Jacob Carlborg via Digitalmars-d
On 2016-09-29 14:57, rikki cattermole wrote: Me and Cauterite were toying with the idea of AST macros but in a completely new form a while ago. Below is the usage of it. Something you'll notice about it is that it could turn the asm block into a library solution (which is clearly what we'd

Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-29 Thread Andrei Alexandrescu via Digitalmars-d
On 09/28/2016 04:21 PM, pineapple wrote: On Wednesday, 28 September 2016 at 20:18:06 UTC, pineapple wrote: This is not and was not intended to be a glorious, incredible addition to the language. It is meant to shove D a couple inches further in the direction of modern programming constructs.

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread pineapple via Digitalmars-d
On Thursday, 29 September 2016 at 12:20:42 UTC, Russel Winder wrote: Opinionated is not always bad. Look at Go, the developers know that there is no sane way of doing generics so they ban it. Also they know that exceptions are totally incomprehensible to all programmers so they ban them. Rust

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Jacob Carlborg via Digitalmars-d
On 2016-09-29 09:58, Walter Bright wrote: I.e. you can overload '+' to do bad things. Yes, you can, and as I replied upthread that can be done because there's no way to prevent that while having operator overloading at all. But that is not justification for allowing such disasters for the

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Sai via Digitalmars-d
I.e. you can overload '+' to do bad things. Yes, you can, and as I replied upthread that can be done because there's no way to prevent that while having operator overloading at all. But that is not justification for allowing such disasters for the comparison operators. I.e. one weakness is

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Eugene Wissner via Digitalmars-d
On Thursday, 29 September 2016 at 16:02:53 UTC, David Nadlinger wrote: This wouldn't be a correct use of the feature anyway, since it runs into all sorts of fundamental issues with imports/scoping, aliases and templates. Using .stringof/fullyQualifiedName to generate a reference to a type or

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Stefan Koch via Digitalmars-d
On Thursday, 29 September 2016 at 16:30:56 UTC, Eugene Wissner wrote: The problem is you can never know all the use cases of some feature. It is just pointless to try to predict where a user will need a feature. I had a use case where I could be sure that everything needed is imported and

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Eugene Wissner via Digitalmars-d
On Thursday, 29 September 2016 at 14:49:03 UTC, Stefan Koch wrote: The reason why this fails is because of the cast(Flag) which should be cast(Flag!"unsafe"). I can probably make it work tough, that means more special casing :) Yes, I know. See this topic for the first discussion:

Re: "Disappearing" operator methods

2016-09-29 Thread Yuxuan Shui via Digitalmars-d
On Thursday, 29 September 2016 at 14:34:18 UTC, Marc Schütz wrote: Please have a look at this PR: https://github.com/dlang/dmd/pull/6140 However, the error message printed with this PR isn't particularly helpful either: Error: incompatible types for ((5) in (m2)): 'int' and 'const(MyTable)'

Re: Reinstalled Mac

2016-09-29 Thread Paolo Invernizzi via Digitalmars-d-learn
On Thursday, 29 September 2016 at 11:43:32 UTC, Jacob Carlborg wrote: Cool, what if I want to use different versions in different sessions, i.e. I have two tabs open in my terminal? Ummm... All the installed stuff is pretty well organised inside `/usr/local`, so this works... --- hw0062:~

Re: Linking D code into existing C programs

2016-09-29 Thread David Soria Parra via Digitalmars-d
On Monday, 26 September 2016 at 23:32:05 UTC, Walter Bright wrote: How much of an issue is this with D? Is it something we need to address? I've run into this problem a few times and it took me a while to understand how to correctly initialize the druntime (including attaching pthreads),

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread David Nadlinger via Digitalmars-d
On Thursday, 29 September 2016 at 13:58:44 UTC, Eugene Wissner wrote: Any chance to get this one working: import std.typecons; enum Stuff { asdf, } void main() { BitFlags!Stuff a; mixin(__traits(fullyQualifiedName, typeof(a)) ~ " c;"); } This wouldn't be a correct

Re: The XML and JSON library

2016-09-29 Thread Nick Sabalausky via Digitalmars-d
On 09/29/2016 04:14 PM, Szabo Bogdan wrote: On Thursday, 29 September 2016 at 14:46:10 UTC, Nick Sabalausky wrote: On 09/28/2016 05:40 PM, Szabo Bogdan wrote: How about Json... there is something that is stopping the D community to move the `vibe.data.json` to `phobos`? Why does it need to

Re: How to create dynamically sized objects

2016-09-29 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 29 September 2016 at 07:10:44 UTC, Straivers wrote: Hi, Say I wanted to create an object that has a string member, and I want the string to be allocated with the object contiguously instead of as a pointer to another location (as a constructor would do). For example: class C {

Re: GC blessed for C++ (again)

2016-09-29 Thread deadalnix via Digitalmars-d-announce
On Wednesday, 28 September 2016 at 20:50:28 UTC, Ali Çehreli wrote: https://www.reddit.com/r/programming/comments/54xnbg/herb_sutters_experimental_deferred_and_unordered/ Ali GC is unnacceptable ! Ho ! a deferred and unordered destruction library, really cool ! Is there intelligent life in

Re: Allow Explicit Pointer for Auto Declaration

2016-09-29 Thread Mike Parker via Digitalmars-d
On Friday, 30 September 2016 at 01:48:02 UTC, Jacob wrote: auto* pValue = expr; // still invalid code unless expr evaluate to a pointer type auto* pValue = // this is valid if expr is a ref It still requires the &, what it prevents is this situation: auto pValue = expr; // wanted pointer,

Re: Allow Explicit Pointer for Auto Declaration

2016-09-29 Thread Jacob via Digitalmars-d
On Friday, 30 September 2016 at 03:07:41 UTC, Mike Parker wrote: On Friday, 30 September 2016 at 01:48:02 UTC, Jacob wrote: auto* pValue = expr; // still invalid code unless expr evaluate to a pointer type auto* pValue = // this is valid if expr is a ref It still requires the &, what it

Re: Allow Explicit Pointer for Auto Declaration

2016-09-29 Thread Steven Schveighoffer via Digitalmars-d
On 9/29/16 9:48 PM, Jacob wrote: It still requires the &, what it prevents is this situation: auto pValue = expr; // wanted pointer, expr evaluates to non-ptr value through change of code or simply forgetting "&" Wait, what happens when you do that? If that's now an error, this is a

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Walter Bright via Digitalmars-d
On 9/29/2016 9:41 AM, Sai wrote: If I understand the issue correctly, one will not be able to overload <=, >, etc for symbolic math, like CAS (mimicking mathematica for example), how can I do it now? a.isLessThan(b)

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Stefan Koch via Digitalmars-d
On Thursday, 29 September 2016 at 17:24:55 UTC, Ilya Yaroshenko wrote: Problem Most ndslice API accepts variadic list of integers. The following code example shows how `slice` and `[a, b, c]` can generate 64 identical functions each. ``` // (1, 1U, 1UL, 1L) x // (2, 2U, 2UL, 2L) x // (3, 3U,

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Stefan Koch via Digitalmars-d
On Thursday, 29 September 2016 at 18:37:36 UTC, Ilya Yaroshenko wrote: On Thursday, 29 September 2016 at 17:56:59 UTC, Stefan Koch wrote: Solution T[] can be added to a template variadic name. ``` void foo(size_t[] Index...)(Indexes index) { ... } ``` This description does not tell me

Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-29 Thread Walter Bright via Digitalmars-d
On 9/29/2016 7:32 AM, Andrei Alexandrescu wrote: A DIP should stay as far away from this kind of argument as possible. Redundancy of existing features should not be used as precedent and justification for adding another redundant feature. More generally, a problem with existing feature X is

dmd --fileprefix=$PWD/ to show custom file prefix before error messages

2016-09-29 Thread Timothee Cour via Digitalmars-d
I'd like to be able to customize rendering of files (eg in error messages) output by dmd, eg: dmd XXX foo/bar.d: Warning: statement is unreachable dmd --fileprefix=mydir/ XXX mydir/foo/bar.d: Warning: statement is unreachable this makes it easy to allow user to see where errors came from even

DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Ilya Yaroshenko via Digitalmars-d
Problem Most ndslice API accepts variadic list of integers. The following code example shows how `slice` and `[a, b, c]` can generate 64 identical functions each. ``` // (1, 1U, 1UL, 1L) x // (2, 2U, 2UL, 2L) x // (3, 3U, 3UL, 3L) = 4 ^^ 3 = 64 identical variants auto cube = slice!double(1, 2,

Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-29 Thread Walter Bright via Digitalmars-d
On 9/29/2016 4:45 AM, Marc Schütz wrote: And `Foo` could have `@disabled this()`, so you simply _can't_ declare it without initializing it Foo foo = void;

Re: Linking D code into existing C programs

2016-09-29 Thread Walter Bright via Digitalmars-d
On 9/26/2016 4:32 PM, Walter Bright wrote: Produces: bar.o:(.eh_frame+0x13): undefined reference to `__dmd_personality_v0' I fixed this for Linux and OSX: https://github.com/dlang/dmd/pull/6159 There is apparently some issue with the gnu toolchain on FreeBSD which prevents this

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Russel Winder via Digitalmars-d
On Thu, 2016-09-29 at 10:52 -0700, Walter Bright via Digitalmars-d wrote: > On 9/29/2016 9:41 AM, Sai wrote: > > > > If I understand the issue correctly, one will not be able to > > overload <=, >, etc > > for symbolic math, like CAS (mimicking mathematica for example), > > how can I do it > >

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Minty Fresh via Digitalmars-d
On Thursday, 29 September 2016 at 18:07:37 UTC, Russel Winder wrote: On Thu, 2016-09-29 at 10:52 -0700, Walter Bright via Digitalmars-d wrote: On 9/29/2016 9:41 AM, Sai wrote: > > If I understand the issue correctly, one will not be able to > overload <=, >, etc > for symbolic math, like CAS

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Ilya Yaroshenko via Digitalmars-d
https://github.com/libmir/mir/wiki/Compiler-and-druntime-bugs#dips

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Ilya Yaroshenko via Digitalmars-d
On Thursday, 29 September 2016 at 17:56:59 UTC, Stefan Koch wrote: Solution T[] can be added to a template variadic name. ``` void foo(size_t[] Index...)(Indexes index) { ... } ``` This description does not tell me anything. Current template argument can be declared as `(Index...)`.

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Ilya Yaroshenko via Digitalmars-d
On Thursday, 29 September 2016 at 18:49:45 UTC, Stefan Koch wrote: On Thursday, 29 September 2016 at 18:37:36 UTC, Ilya Yaroshenko wrote: On Thursday, 29 September 2016 at 17:56:59 UTC, Stefan Koch wrote: Solution T[] can be added to a template variadic name. ``` void foo(size_t[]

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Andrei Alexandrescu via Digitalmars-d
On 09/29/2016 02:53 PM, Ilya Yaroshenko wrote: `(Index...)` -> `(size_t[] Index...)` // this is about template arguments, not runtime What is the drawback of taking Index... and constraining it with a template constraint (all must be integral)? We use that in a few places in Phobos. --

Re: The XML and JSON library

2016-09-29 Thread cym13 via Digitalmars-d
On Thursday, 29 September 2016 at 20:14:27 UTC, Szabo Bogdan wrote: On Thursday, 29 September 2016 at 14:46:10 UTC, Nick Sabalausky wrote: [...] Well... the json format can be used in a lot of cases not only for the web and I think it does not make much sense to include a web framework in

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Ilya Yaroshenko via Digitalmars-d
On Thursday, 29 September 2016 at 21:31:11 UTC, Timothee Cour wrote: maybe remove the corresponding DIP from https://github.com/libmir/mir/wiki/Compiler-and-druntime-bugs#dips ? On Thu, Sep 29, 2016 at 2:19 PM, Ilya Yaroshenko via Digitalmars-d < digitalmars-d@puremagic.com> wrote: On

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread ag0aep6g via Digitalmars-d
On 09/29/2016 11:28 PM, Ilya Yaroshenko wrote: On Thursday, 29 September 2016 at 20:57:00 UTC, ag0aep6g wrote: [...] void foo(size_t n)(size_t[n] a ...) { /* ... */ } Just found an example, where this approach does not work :-( template transposed(Dimensions...) if (Dimensions.length) {

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Ilya Yaroshenko via Digitalmars-d
On Thursday, 29 September 2016 at 20:12:44 UTC, Walter Bright wrote: Here's one way to do it: -- import core.stdc.stdio; void foo(T)(T[] a ...) { printf("%d %d %d\n", a[0], a[1], a[2]); } void main() { foo(1, 2, 3); } - C:\cbx>foo 1 2 3 a.length must be known at CT. 99%-100%

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Jonathan M Davis via Digitalmars-d
On Thursday, September 29, 2016 20:16:00 pineapple via Digitalmars-d wrote: > On Thursday, 29 September 2016 at 19:39:35 UTC, Jonathan M Davis > > wrote: > > The reality of the matter is that D's operator overloading was > > designed specifically so that you could overload the built-in > >

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Timothee Cour via Digitalmars-d
maybe remove the corresponding DIP from https://github.com/libmir/mir/wiki/Compiler-and-druntime-bugs#dips ? On Thu, Sep 29, 2016 at 2:19 PM, Ilya Yaroshenko via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > On Thursday, 29 September 2016 at 21:06:13 UTC, Timothee Cour wrote: > >> this

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Matthias Bentrup via Digitalmars-d
On Thursday, 29 September 2016 at 18:38:42 UTC, Jonathan M Davis wrote: Then you could always do something like a.myOp!"<"(b) and a.myOp!">="(b) if you still want to have the operator in there somewhere. You can name the functions whatever you want. You just can't use overloaded operators

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Ilya Yaroshenko via Digitalmars-d
On Thursday, 29 September 2016 at 18:55:07 UTC, Andrei Alexandrescu wrote: On 09/29/2016 02:53 PM, Ilya Yaroshenko wrote: `(Index...)` -> `(size_t[] Index...)` // this is about template arguments, not runtime What is the drawback of taking Index... and constraining it with a template

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread pineapple via Digitalmars-d
On Thursday, 29 September 2016 at 18:38:42 UTC, Jonathan M Davis wrote: You just can't use overloaded operators for it, since it would not be in line with what the operators are supposed to mean and be used for. This is not a valid argument because what an operator is "supposed to mean" is up

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Timon Gehr via Digitalmars-d
On 16.09.2016 01:25, Stefan Koch wrote: On Thursday, 15 September 2016 at 23:08:54 UTC, Andrei Alexandrescu wrote: Yes, that DIP. It would need some more formal work before defining an implementation. Stefan, would you want to lead that effort? -- Andrei I am not good at defining semantics,

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Timon Gehr via Digitalmars-d
On 16.09.2016 01:10, Andrei Alexandrescu wrote: On 9/15/16 7:08 PM, Andrei Alexandrescu wrote: Yes, that DIP. It would need some more formal work before defining an implementation. Stefan, would you want to lead that effort? -- Andrei Actually I see Timon authored that (I thought it's an

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread pineapple via Digitalmars-d
On Thursday, 29 September 2016 at 19:39:35 UTC, Jonathan M Davis wrote: The reality of the matter is that D's operator overloading was designed specifically so that you could overload the built-in operators to be used with your own types so that they could act like the built-in types. It was

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Andrei Alexandrescu via Digitalmars-d
On 09/29/2016 02:37 PM, Ilya Yaroshenko wrote: On Thursday, 29 September 2016 at 17:56:59 UTC, Stefan Koch wrote: Solution T[] can be added to a template variadic name. ``` void foo(size_t[] Index...)(Indexes index) { ... } ``` This description does not tell me anything. Current

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Steven Schveighoffer via Digitalmars-d
On 9/29/16 2:49 PM, Stefan Koch wrote: On Thursday, 29 September 2016 at 18:37:36 UTC, Ilya Yaroshenko wrote: On Thursday, 29 September 2016 at 17:56:59 UTC, Stefan Koch wrote: Solution T[] can be added to a template variadic name. ``` void foo(size_t[] Index...)(Indexes index) { ... }

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread pineapple via Digitalmars-d
On Thursday, 29 September 2016 at 18:56:40 UTC, Ilya Yaroshenko wrote: No, it does not --- void foo(size_t[] I...)(I i) { } Using phobos' allSatisfy or a similar template, this can become: enum isIndex(T) = is(T == size_t); void foo(I...)(I i) if(allSatisfy!(isIndex, I)){ ...

Re: The XML and JSON library

2016-09-29 Thread Szabo Bogdan via Digitalmars-d
On Thursday, 29 September 2016 at 14:46:10 UTC, Nick Sabalausky wrote: On 09/28/2016 05:40 PM, Szabo Bogdan wrote: How about Json... there is something that is stopping the D community to move the `vibe.data.json` to `phobos`? Why does it need to be in phobos? It's already usable as-is.

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Walter Bright via Digitalmars-d
Here's one way to do it: -- import core.stdc.stdio; void foo(T)(T[] a ...) { printf("%d %d %d\n", a[0], a[1], a[2]); } void main() { foo(1, 2, 3); } - C:\cbx>foo 1 2 3

Re: Parameterized delegate attributes

2016-09-29 Thread Steven Schveighoffer via Digitalmars-d
On 9/28/16 5:35 PM, Lodovico Giaretta wrote: On Wednesday, 28 September 2016 at 20:23:10 UTC, pineapple wrote: But using a templated opApply currently breaks type inference in `foreach`, right? It'd be really nice if that were fixed. Yeah, it would be nice, but I don't think it's technically

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Jonathan M Davis via Digitalmars-d
On Thursday, September 29, 2016 18:14:22 Minty Fresh via Digitalmars-d wrote: > On Thursday, 29 September 2016 at 18:07:37 UTC, Russel Winder > > wrote: > > On Thu, 2016-09-29 at 10:52 -0700, Walter Bright via > > > > Digitalmars-d wrote: > >> On 9/29/2016 9:41 AM, Sai wrote: > >> > If I

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Ilya Yaroshenko via Digitalmars-d
On Thursday, 29 September 2016 at 18:53:26 UTC, Andrei Alexandrescu wrote: On 09/29/2016 02:37 PM, Ilya Yaroshenko wrote: On Thursday, 29 September 2016 at 17:56:59 UTC, Stefan Koch wrote: Solution T[] can be added to a template variadic name. ``` void foo(size_t[] Index...)(Indexes index) {

Re: DIP Mir1 Draft: Variadic template parameters with the same time.

2016-09-29 Thread Ilya Yaroshenko via Digitalmars-d
On Thursday, 29 September 2016 at 19:03:00 UTC, pineapple wrote: On Thursday, 29 September 2016 at 18:56:40 UTC, Ilya Yaroshenko wrote: No, it does not --- void foo(size_t[] I...)(I i) { } Using phobos' allSatisfy or a similar template, this can become: enum isIndex(T) = is(T ==

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Minty Fresh via Digitalmars-d
On Thursday, 29 September 2016 at 19:11:55 UTC, pineapple wrote: Relinquish the notion that you or anyone can have the slightest idea what any language feature is "supposed to mean and be used for". Basically what led to D's CTFE implementation in the first place, IIRC.

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Jonathan M Davis via Digitalmars-d
On Thursday, September 29, 2016 19:11:55 pineapple via Digitalmars-d wrote: > On Thursday, 29 September 2016 at 18:38:42 UTC, Jonathan M Davis > > wrote: > > You just can't use overloaded operators for it, since it would > > not be in line with what the operators are supposed to mean and > > be

Re: The worst Phobos template (in binderoo)

2016-09-29 Thread Andrei Alexandrescu via Digitalmars-d
On 09/29/2016 03:27 PM, Timon Gehr wrote: On 16.09.2016 01:10, Andrei Alexandrescu wrote: On 9/15/16 7:08 PM, Andrei Alexandrescu wrote: Yes, that DIP. It would need some more formal work before defining an implementation. Stefan, would you want to lead that effort? -- Andrei Actually I see

Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-29 Thread Timon Gehr via Digitalmars-d
On 29.09.2016 19:35, Walter Bright wrote: On 9/29/2016 7:32 AM, Andrei Alexandrescu wrote: A DIP should stay as far away from this kind of argument as possible. Redundancy of existing features should not be used as precedent and justification for adding another redundant feature. More

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Timon Gehr via Digitalmars-d
On 29.09.2016 18:41, Sai wrote: I.e. you can overload '+' to do bad things. Yes, you can, and as I replied upthread that can be done because there's no way to prevent that while having operator overloading at all. But that is not justification for allowing such disasters for the comparison

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Minty Fresh via Digitalmars-d
On Thursday, 29 September 2016 at 19:39:35 UTC, Jonathan M Davis wrote: The language can't stop you from doing at least some arbitrary stuff with them (like making + do subtraction), but the whole goal was for user-defined types to be able to act like the built-in types, and as such, it would

Re: Reinstalled Mac

2016-09-29 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-29 03:43, David Nadlinger wrote: Jacob is also the author of DVM, so he might be a bit biased. ;) And you would never recommend LDC? ;) I've had good experiences using Homebrew, although you sometimes have to wait a day or three for a new release to appear. — David DVM doesn't

Re: Reinstalled Mac

2016-09-29 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-29 03:33, Joel wrote: Oops, I got confused and installed with homebrew. I was going to try DVM. You can install using DVM as well, it will take precedence. -- /Jacob Carlborg

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Jacob Carlborg via Digitalmars-d
On 2016-09-28 06:02, Walter Bright wrote: The limitations are deliberate based on the idea that comparison operators need to be consistent and predictable, and should have a close relationship to the mathematical meaning of the operators. Overloading <= to mean something other than "less than

Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-29 Thread ikod via Digitalmars-d
On Wednesday, 28 September 2016 at 20:18:06 UTC, pineapple wrote: On Wednesday, 28 September 2016 at 17:56:13 UTC, Steven Schveighoffer wrote: The more I think about this submission, I feel like the benefits are quite slim. This is not and was not intended to be a glorious, incredible

Re: Module names shadowing defined functions/templates.

2016-09-29 Thread Jacob Carlborg via Digitalmars-d
On 2016-09-29 04:26, Joakim wrote: I ran into this too, it is annoying. I think you're supposed to use different names. Yeah, especially since I have a lot of module looking like this: module main; void main() { // some stuff } This works since "main" is a special function which is

Re: The XML and JSON library

2016-09-29 Thread Chris via Digitalmars-d
On Wednesday, 28 September 2016 at 21:40:12 UTC, Szabo Bogdan wrote: On Sunday, 25 September 2016 at 09:12:03 UTC, Lodovico Giaretta wrote: On Sunday, 25 September 2016 at 08:26:58 UTC, Basile B. wrote: On Sunday, 25 September 2016 at 08:19:22 UTC, Szabo Bogdan wrote: [...] Wrong. Someone

Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-29 Thread John Colvin via Digitalmars-d
On Wednesday, 28 September 2016 at 23:44:19 UTC, Andrei Alexandrescu wrote: On 9/28/16 7:40 PM, Andrei Alexandrescu wrote: // With scope void assertNot(string s) { try { scope(success) assert(0, s); decode(s,DecodeMode.STRICT); } catch (DecodeException e) {} } Sorry, this is not

Re: Reinstalled Mac

2016-09-29 Thread Paolo Invernizzi via Digitalmars-d-learn
On Thursday, 29 September 2016 at 06:24:08 UTC, Jacob Carlborg wrote: On 2016-09-29 03:43, David Nadlinger wrote: I've had good experiences using Homebrew, although you sometimes have to wait a day or three for a new release to appear. — David DVM doesn't have that problem :). How easy is it

Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-29 Thread Jack Stouffer via Digitalmars-d
On Thursday, 29 September 2016 at 00:35:47 UTC, Walter Bright wrote: I agree with Steven. Having the 'else' continue on with a scope that is already closed by } is very weird and unsettling. Seconded But it is conditional compilation, and no other way around it has been proposed, and it has

Re: How to create dynamically sized objects

2016-09-29 Thread Straivers via Digitalmars-d-learn
Actually, would just passing the parameters and an allocator do it? You'd just need to allocate the string in the constructor, right?

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Walter Bright via Digitalmars-d
On 9/28/2016 11:48 PM, Jacob Carlborg wrote: If that is not allowed, why is this allowed: I.e. you can overload '+' to do bad things. Yes, you can, and as I replied upthread that can be done because there's no way to prevent that while having operator overloading at all. But that is not

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Timon Gehr via Digitalmars-d
On 29.09.2016 06:15, Walter Bright wrote: On 9/28/2016 1:40 PM, Timon Gehr wrote: What's wrong with that usage? Because then something other than comparison is happening with <=, You also complained about '+'. <, >, = and there'll be nothing in the code to give the user a hint. ...

How to create dynamically sized objects

2016-09-29 Thread Straivers via Digitalmars-d-learn
Hi, Say I wanted to create an object that has a string member, and I want the string to be allocated with the object contiguously instead of as a pointer to another location (as a constructor would do). For example: class C { this(int i, string s) { this.i = i; this.s =

[Issue 16564] New: KRRegion.empty sometimes returns Ternary.no

2016-09-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16564 Issue ID: 16564 Summary: KRRegion.empty sometimes returns Ternary.no Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major

Re: Required DMD changes for Mir and few thoughts about D future

2016-09-29 Thread Martin Nowak via Digitalmars-d
On Monday, 26 September 2016 at 22:34:59 UTC, Andrei Alexandrescu wrote: That would work out as long as interaction is seamless. Please advise. Overall: I think Ilya's work can make a real difference for D, and we can't afford it to not work with the reference implementation. -- Andrei There

Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread pineapple via Digitalmars-d
On Thursday, 29 September 2016 at 07:58:26 UTC, Walter Bright wrote: On 9/28/2016 11:48 PM, Jacob Carlborg wrote: If that is not allowed, why is this allowed: I.e. you can overload '+' to do bad things. Yes, you can, and as I replied upthread that can be done because there's no way to

Re: How to debug (potential) GC bugs?

2016-09-29 Thread Kagamin via Digitalmars-d-learn
Does it crash only in rt_finalize2? It calls the class destructor, and the destructor must not allocate or touch GC in any way because the GC doesn't yet support allocation during collection.

Re: Required DMD changes for Mir and few thoughts about D future

2016-09-29 Thread Robert Rat via Digitalmars-d
On Wednesday, 28 September 2016 at 09:04:23 UTC, Ilya Yaroshenko wrote: On Tuesday, 27 September 2016 at 15:31:41 UTC, Andrei Alexandrescu wrote: On 9/27/16 12:36 PM, Ilya Yaroshenko wrote: On Tuesday, 27 September 2016 at 10:20:09 UTC, Andrei Alexandrescu wrote: On 9/27/16 10:50 AM, Ilya

[Issue 4621] Destructors are inherently un-@safe

2016-09-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4621 anonymous4 changed: What|Removed |Added Keywords||spec --

[Issue 4621] Destructors are inherently un-@safe

2016-09-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4621 anonymous4 changed: What|Removed |Added Keywords||safe

  1   2   >