Re: Recursive attribute for virtual functions?

2018-03-27 Thread arturg via Digitalmars-d
On Tuesday, 27 March 2018 at 21:25:33 UTC, ag0aep6g wrote: On 03/27/2018 11:10 PM, 12345swordy wrote: Shouldn't it give a warning then? I wouldn't mind a warning, or even an error. Putting both @safe and @system directly on a function is an error, too. shouldn't it create a overload? for ex

Re: Recursive attribute for virtual functions?

2018-03-27 Thread arturg via Digitalmars-d
On Tuesday, 27 March 2018 at 23:23:38 UTC, ag0aep6g wrote: DMD might accept that, but I don't think it works in a meaningful way. How do you call the @system one? Looks like the @safe one will always be called, even from @system code: import std.stdio; void talk() @system { writeln("

Re: Recursive attribute for virtual functions?

2018-03-27 Thread arturg via Digitalmars-d
On Tuesday, 27 March 2018 at 23:34:20 UTC, arturg wrote: On Tuesday, 27 March 2018 at 23:23:38 UTC, ag0aep6g wrote: DMD might accept that, but I don't think it works in a meaningful way. How do you call the @system one? Looks like the @safe one will always be called, even from @system code:

Re: Found on proggit: Krug, a new experimental programming language, compiler written in D

2018-04-26 Thread arturg via Digitalmars-d
On Thursday, 26 April 2018 at 15:07:37 UTC, H. S. Teoh wrote: On Thu, Apr 26, 2018 at 08:50:27AM +, Joakim via Digitalmars-d wrote: https://github.com/felixangell/krug https://www.reddit.com/r/programming/comments/8dze54/krug_a_systems_programming_language_that_compiles/ It's still too ea

Re: Found on proggit: Krug, a new experimental programming language, compiler written in D

2018-04-26 Thread arturg via Digitalmars-d
On Thursday, 26 April 2018 at 22:29:46 UTC, Nick Sabalausky (Abscissa) wrote: On 04/26/2018 01:13 PM, arturg wrote: why do people use this syntax? if val == someVal or while val != someVal it makes editing the code harder then if you use if(val == someVal). The theory goes: A. "less syn

Re: returning and receiving multiple values from a function

2018-05-14 Thread arturg via Digitalmars-d
On Tuesday, 15 May 2018 at 01:40:50 UTC, timepp wrote: Now C++ allow this in a very clean way: std::tuple foo() { return {128, true, 1.5f}; } auto [value1, value2, value3] = foo(); Would D plan to support that in syntax level? it depends if some dip like https://github.com/tgehr/DIPs

Re: Sealed classes - would you want them in D? (v2)

2018-05-16 Thread arturg via Digitalmars-d
On Thursday, 17 May 2018 at 05:06:54 UTC, KingJoffrey wrote: If people want to propose putting each class in it's own module, that does not address my requirements, and therefore is not helpful to this discussion. you could declare the public api of your class inside an actual interface the

Re: Sealed classes - would you want them in D? (v2)

2018-05-17 Thread arturg via Digitalmars-d
On Thursday, 17 May 2018 at 07:30:58 UTC, KingJoffrey wrote: On Thursday, 17 May 2018 at 06:03:19 UTC, arturg wrote: you could declare the public api of your class inside an actual interface then use it instead of the class, that wont give you access to the private members of the class. you

Re: Mysterious identifier in std.traits.ParameterStorageClassTuple

2018-07-24 Thread arturg via Digitalmars-d
On Tuesday, 24 July 2018 at 21:05:05 UTC, Jean-Louis Leroy wrote: What is `PT` here: https://github.com/dlang/phobos/blob/master/std/traits.d#L1224 Where does it come from? https://dlang.org/spec/expression.html#is_expression look for 6. is ( Type Identifier == TypeSpecialization )

Re: Dscanner - DCD - Dfix ... Editor support or the lack of it.

2018-01-28 Thread arturg via Digitalmars-d
On Sunday, 28 January 2018 at 16:02:36 UTC, Jonathan M Davis wrote: Erm, you do realize that Vim has built-in commands for navigating nested brackets and parentheses, right? And automatic bracket closing is just a macro away. You don't even need a plugin for that. LOL. One of the reasons th

Re: Dscanner - DCD - Dfix ... Editor support or the lack of it.

2018-01-28 Thread arturg via Digitalmars-d
On Sunday, 28 January 2018 at 17:51:19 UTC, Jonathan M Davis wrote: Hmm. Thanks. I'll have to check that out. I haven't done anything with folds in ages. Fortunately, I don't have to do anything with python right now though. The main reason that I used it before was so that I could have cro

Re: Opt-in non-null class references?

2018-03-03 Thread arturg via Digitalmars-d
On Saturday, 3 March 2018 at 18:28:42 UTC, aliak wrote: On Friday, 2 March 2018 at 19:47:23 UTC, SimonN wrote: If you know of other ways though I'm all ears :) Cheers maybe not exactly what you want, but here are some templates i wrote a while ago which basically are a more flexible form of

Re: DIP 1005 - Preliminary Review Round 1

2017-04-23 Thread Arturg via Digitalmars-d
On Sunday, 23 April 2017 at 12:03:47 UTC, Andrei Alexandrescu wrote: On 4/22/17 4:52 PM, Joakim wrote: On Saturday, 22 April 2017 at 11:54:08 UTC, Mike Parker wrote: DIP 1005 is titled "Dependency-Carrying Declarations". https://github.com/dlang/DIPs/blob/master/DIPs/DIP1005.md All review-rel

Re: new contract syntax DIP

2017-05-23 Thread arturg via Digitalmars-d
On Tuesday, 23 May 2017 at 17:28:21 UTC, MysticZach wrote: I made a pull request for a new DIP dealing with contract syntax: https://github.com/dlang/DIPs/pull/66 I write the DIP in response to the discussions for DIP 1003: http://forum.dlang.org/thread/wcqebjzdjxldeywlx...@forum.dlang.org

Re: Named arguments via struct initialization in functions

2016-03-08 Thread arturg via Digitalmars-d
hi, has the UDA syntax been proposed already? void fun(int foo, int bar, int bazDaz = 0){} fun(10, 30, 50); // normal fun(10, 30); normal with default fun(10, 30, @bazDaz 50); // mixed fun(@bazDaz 50, 10, 30) // mixed and reordered fun(@bar 30, 10); // mixed, reordered and default fun(@foo 10,

with and checked with expression?

2016-05-24 Thread ArturG via Digitalmars-d
ive read some discussions about some library solution for the ?. operator, has there been anything added to phobos? wouldnt a checked with expression be a more general/longer form of the ?. operator? A with expression not only allows you to do unchecked/checked access to members but to any o

Re: with and checked with expression?

2016-05-25 Thread ArturG via Digitalmars-d
On Wednesday, 25 May 2016 at 00:36:04 UTC, Seb wrote: On Tuesday, 24 May 2016 at 19:03:11 UTC, ArturG wrote: would something like this be usefull? A general word of advice - try to keep your post short & concise. It is more likely to get replies then. Yes i might have used to many example

chainable scopes

2016-06-08 Thread ArturG via Digitalmars-d
this is a library implementation based on the with expression[1] idea i posted a while ago and is kinda related to the ?. operator. as we cant fully implement the above idea as a library i tried to do what's possible which are basically chainable scopes[2]. implemented as 2 templates: uncheck

Re: Monads in D

2016-06-11 Thread ArturG via Digitalmars-d
On Saturday, 11 June 2016 at 14:26:20 UTC, Atila Neves wrote: Why? Because I could, I don't plan on using this for anything serious. I think "with" is my favourite D feature right now. I also wrote the Writer and State monads (not that D needs them): https://github.com/atilaneves/felix At

Re: DIP 88: Simple form of named parameters

2016-01-25 Thread arturg via Digitalmars-d
On Monday, 25 January 2016 at 08:55:55 UTC, Jacob Carlborg wrote: On 2016-01-24 19:23, Chris Wright wrote: It shouldn't. However, it is another way to pass function arguments, so for thoroughness it would be better to mention it. Added an example. Is this what you intended? If so, please do

Re: DIP 88: Simple form of named parameters

2016-01-25 Thread arturg via Digitalmars-d
On Monday, 25 January 2016 at 13:40:18 UTC, HaraldZealot wrote: On Saturday, 23 January 2016 at 14:19:03 UTC, Jacob Carlborg wrote: This is mostly to prevent ugly hacks like Flag [1]. http://wiki.dlang.org/DIP88 [1] https://dlang.org/phobos/std_typecons.html#.Flag Why not simply allow progra

Re: DIP 88: Simple form of named parameters

2016-01-25 Thread arturg via Digitalmars-d
On Monday, 25 January 2016 at 16:17:27 UTC, Chris Wright wrote: It's a comment that the compiler verifies. You could argue that the bulk of the type system is comments that the compiler verifies. named arguments solve this problem void foo(int a = 4, int b = 10, int c = 3) {} foo(c : 5);

Re: DIP 88: Simple form of named parameters

2016-01-25 Thread arturg via Digitalmars-d
On Monday, 25 January 2016 at 16:50:49 UTC, HaraldZealot wrote: On Monday, 25 January 2016 at 14:35:09 UTC, arturg wrote: On Monday, 25 January 2016 at 13:40:18 UTC, HaraldZealot wrote: the equal sign cant be used because D behaves like this int width, height; foo(width = 5, height = 10); // 5

named args

2016-06-23 Thread ArturG via Digitalmars-d
http://melpon.org/wandbox/permlink/u8lpOZ9owC7QXfa3 hi, that code is based on ideas and code from this[1] thread. some examples: // named and in order args!(fun, a=>6, b=>65, s=>"test", f=>1.4); // named and out of order args!(fun, b=>65, f=>1.4, s=>"test", a=>6); // unnamed and in

Re: TryElseExpression DIP

2016-09-05 Thread arturg via Digitalmars-d
On Monday, 5 September 2016 at 18:07:52 UTC, pineapple wrote: It works like this: try: do_something() except Exception as e: pass # Runs when an error inheriting from Exception was raised else: pass # Runs when no error was raised finally: pass

Re: Pattern matching in D?

2016-10-21 Thread ArturG via Digitalmars-d
On Friday, 21 October 2016 at 02:40:45 UTC, Stefan Koch wrote: On Friday, 21 October 2016 at 02:16:44 UTC, Chris M. wrote: So I know you can do some pattern matching with templates in D, but has there been any discussion about implementing it as a language feature, maybe something similar to Ru

Re: If Statement with Declaration

2016-11-07 Thread ArturG via Digitalmars-d
On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int* weDontPollute = someFunc()) { // use weDontP

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-14 Thread ArturG via Digitalmars-d
On Wednesday, 14 December 2016 at 19:39:55 UTC, Andrei Alexandrescu wrote: On 12/14/2016 02:04 PM, Meta wrote: On Wednesday, 14 December 2016 at 17:32:10 UTC, H. S. Teoh wrote: What about: /* Showing full declaration just for context */ bool myFunc(R1, R2)(R1 r1, R2 r2) import {

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-14 Thread arturg via Digitalmars-d
On Wednesday, 14 December 2016 at 22:56:54 UTC, Andrei Alexandrescu wrote: The acceptability of the proposal decays exponentially with its deviation from existing import syntax. -- Andrei sorry, i missed the import keyword :/ T1 fun(T1, T2)(T1 t1, T2 t2) import { version(A) { impor

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-15 Thread ArturG via Digitalmars-d
On Thursday, 15 December 2016 at 19:52:50 UTC, Andrei Alexandrescu wrote: On 12/15/2016 02:22 PM, Timothee Cour via Digitalmars-d wrote: Some more details on my proposa based on UDA: ... I now understand the idea, thank you. My question is, doesn't this take things too far? Earlier I wrote:

Re: DIP10005: Dependency-Carrying Declarations is now available for community feedback

2016-12-30 Thread ArturG via Digitalmars-d
On Friday, 30 December 2016 at 23:49:23 UTC, Andrei Alexandrescu wrote: The main win, which indeed is not emphasized enough, is better encapsulation. Walter pointed that out, and I will redo the DIP to put that front and center. Maybe i can provide an example where i think DCD's would be us