Re: Bug or feature? iota has different semantics for integer and float arguments

2023-01-07 Thread Arredondo via Digitalmars-d-learn
On Saturday, 7 January 2023 at 02:31:14 UTC, Ali Çehreli wrote: On 1/6/23 17:50, Arredondo wrote: > Would anyone volunteer to file a bug report? Me! Me! :) https://issues.dlang.org/show_bug.cgi?id=23604 Ali Thanks a lot :D Arredondo.

Re: Bug or feature? iota has different semantics for integer and float arguments

2023-01-06 Thread Ali Çehreli via Digitalmars-d-learn
On 1/6/23 17:50, Arredondo wrote: > Would anyone volunteer to file a bug report? Me! Me! :) https://issues.dlang.org/show_bug.cgi?id=23604 Ali

Re: Bug or feature? iota has different semantics for integer and float arguments

2023-01-06 Thread Arredondo via Digitalmars-d-learn
On Saturday, 7 January 2023 at 00:52:20 UTC, Ali Çehreli wrote: Although that difference is a bug, iota does have a special floating point implementation to prevent the accumulation of floating point errors. Thank you for this clarification Ali. I appreciate the fact that there is a

Re: Bug or feature? iota has different semantics for integer and float arguments

2023-01-06 Thread Ali Çehreli via Digitalmars-d-learn
On 1/6/23 15:23, Arredondo wrote: > then you get an exception (incorrect startup parameters). Although that difference is a bug, iota does have a special floating point implementation to prevent the accumulation of floating point errors. I mention it as item 4 here:

Bug or feature? iota has different semantics for integer and float arguments

2023-01-06 Thread Arredondo via Digitalmars-d-learn
Consider: ``` import std.range.iota; auto r = iota(5, 0); ``` `r` is an empty range, as it should be. But if you call: ``` auto r = iota(5.0, 0); ``` then you get an exception (incorrect startup parameters). This was unexpected, and a pain to debug. What is the rationale behind iota having

Proper way to override (swap) runtime and phobos. [feature request?]

2022-11-23 Thread AnimusPEXUS via Digitalmars-d-learn
for development purposes. is there are correct way to somehow (partially or complete) override druntime and phobos? or, maybe, some code injection/patching mechanisms during compilation of own code.

Re: save() feature for iota

2022-11-04 Thread Imperatorn via Digitalmars-d-learn
On Friday, 4 November 2022 at 08:48:36 UTC, Salih Dincer wrote: On Thursday, 3 November 2022 at 11:58:20 UTC, Paul Backus wrote: On Thursday, 3 November 2022 at 06:26:22 UTC, Salih Dincer Looking at the source, it seems that only the numeric overloads of `iota` implement `save`. I think this

Re: save() feature for iota

2022-11-04 Thread Salih Dincer via Digitalmars-d-learn
On Thursday, 3 November 2022 at 11:58:20 UTC, Paul Backus wrote: On Thursday, 3 November 2022 at 06:26:22 UTC, Salih Dincer Looking at the source, it seems that only the numeric overloads of `iota` implement `save`. I think this is probably just an oversight, though, since I can't see any

Re: save() feature for iota

2022-11-03 Thread Ali Çehreli via Digitalmars-d-learn
On 11/3/22 04:58, Paul Backus wrote: > https://issues.dlang.org/show_bug.cgi?id=23453 Even though iterating over UTF value ranges don't make sense in general, they would work for some values including the ASCII range. Ali

Re: save() feature for iota

2022-11-03 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 3 November 2022 at 06:26:22 UTC, Salih Dincer wrote: Hi All, Isn't there a save feature for `iota()`? Looking at the source, it seems that only the numeric overloads of `iota` implement `save`. I think this is probably just an oversight, though, since I can't see any reason why

save() feature for iota

2022-11-03 Thread Salih Dincer via Digitalmars-d-learn
Hi All, Isn't there a save feature for `iota()`? ```d import std.stdio; import std.range; void main() { foreach(num; iota!char('a', 'f').chunks(3)/* "onetwosixfour".chunks(3)//*/ ) { //auto n = num.save(); num.writeln(": &q

Re: Create alias of same name in inner scope, bug or feature?

2021-08-14 Thread Tejas via Digitalmars-d-learn
On Saturday, 14 August 2021 at 08:23:20 UTC, user1234 wrote: On Saturday, 14 August 2021 at 04:09:34 UTC, Tejas wrote: [...] Oh right, the ```.``` operator will reference variable in the _module_ scope, not just the _immediate outer scope_, you can use the module name to disambiguate as

Re: Create alias of same name in inner scope, bug or feature?

2021-08-14 Thread user1234 via Digitalmars-d-learn
On Saturday, 14 August 2021 at 04:09:34 UTC, Tejas wrote: [...] Oh right, the ```.``` operator will reference variable in the _module_ scope, not just the _immediate outer scope_, you can use the module name to disambiguate as well. To extend Mike answer, the general rule is that if you can

Re: Create alias of same name in inner scope, bug or feature?

2021-08-13 Thread Tejas via Digitalmars-d-learn
On Saturday, 14 August 2021 at 04:01:31 UTC, Mike Parker wrote: On Saturday, 14 August 2021 at 03:47:05 UTC, Tejas wrote: ```d import std; auto abc(T)(auto ref T a, auto ref T b){ return a+b; } auto def(T)(auto ref T a, auto ref T b){ return a*b; } alias macro_1 = abc; void main()

Re: Create alias of same name in inner scope, bug or feature?

2021-08-13 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 14 August 2021 at 03:47:05 UTC, Tejas wrote: ```d import std; auto abc(T)(auto ref T a, auto ref T b){ return a+b; } auto def(T)(auto ref T a, auto ref T b){ return a*b; } alias macro_1 = abc; void main() { writeln(macro_1(15, 20)); alias macro_1 = def;// is

Create alias of same name in inner scope, bug or feature?

2021-08-13 Thread Tejas via Digitalmars-d-learn
```d import std; auto abc(T)(auto ref T a, auto ref T b){ return a+b; } auto def(T)(auto ref T a, auto ref T b){ return a*b; } alias macro_1 = abc; void main() { writeln(macro_1(15, 20)); alias macro_1 = def;// is this NOT considered variable shadowing?

Re: Is returning void functions inside void functions a feature or an artifact?

2021-08-03 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 3 August 2021 at 10:28:53 UTC, Rekel wrote: On Tuesday, 3 August 2021 at 00:53:43 UTC, user1234 wrote: You got the answer in another reply but here is a bit of more fun: ```d void main() { return cast(void) 1; } ``` What does casting to void do? Does it just ignore whatever

Re: Is returning void functions inside void functions a feature or an artifact?

2021-08-03 Thread Rekel via Digitalmars-d-learn
On Tuesday, 3 August 2021 at 00:53:43 UTC, user1234 wrote: You got the answer in another reply but here is a bit of more fun: ```d void main() { return cast(void) 1; } ``` What does casting to void do? Does it just ignore whatever follows it? On Tuesday, 3 August 2021 at 07:23:34 UTC,

Re: Is returning void functions inside void functions a feature or an artifact?

2021-08-03 Thread Patrick Schluter via Digitalmars-d-learn
On Monday, 2 August 2021 at 14:46:36 UTC, jfondren wrote: On Monday, 2 August 2021 at 14:31:45 UTC, Rekel wrote: [...] I don't know where you can find this in the docs, but what doesn't seem trivial about it? The type of the expression `print()` is void. That's the type that `doSomething`

Re: Is returning void functions inside void functions a feature or an artifact?

2021-08-02 Thread user1234 via Digitalmars-d-learn
On Monday, 2 August 2021 at 14:31:45 UTC, Rekel wrote: I recently found one can return function calls to void functions, though I don't remember any documentation mentioning this even though it doesn't seem trivial. [...] If this is intended, where could I find this in the docs? I haven't

Re: Is returning void functions inside void functions a feature or an artifact?

2021-08-02 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Aug 02, 2021 at 04:42:14PM +, Rekel via Digitalmars-d-learn wrote: [...] > Also slightly off topic, but when would one use an alias instead of a > function/delegate? I haven't used aliases before. When you want a compile-time binding that could potentially elide the indirect function

Re: Is returning void functions inside void functions a feature or an artifact?

2021-08-02 Thread Ali Çehreli via Digitalmars-d-learn
On 8/2/21 9:42 AM, Rekel wrote: > when would one use an alias instead of a > function/delegate? I haven't used aliases before. alias will match both functions and delegates... and... any symbol at all. So, if you don't have a reason to constain the user, callable template parameters are most

Re: Is returning void functions inside void functions a feature or an artifact?

2021-08-02 Thread Rekel via Digitalmars-d-learn
On Monday, 2 August 2021 at 14:51:07 UTC, H. S. Teoh wrote: This is intentional, in order to make it easier to write generic code without always having to special-case functions that don't return anything. Ooh that indeed seems useful. Thanks for the hint. Also slightly off topic, but when

Re: Is returning void functions inside void functions a feature or an artifact?

2021-08-02 Thread Rekel via Digitalmars-d-learn
On Monday, 2 August 2021 at 14:46:36 UTC, jfondren wrote: C, C++, Rust, and Zig are all fine with this. Nim doesn't like it. I had no clue, never seen it used in any case. I've always assumed one couldn't return void as it's not a value. I guess intuitions aren't always universal . Good to

Re: Is returning void functions inside void functions a feature or an artifact?

2021-08-02 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Aug 02, 2021 at 02:31:45PM +, Rekel via Digitalmars-d-learn wrote: > I recently found one can return function calls to void functions, > though I don't remember any documentation mentioning this even though > it doesn't seem trivial. This is intentional, in order to make it easier to

Re: Is returning void functions inside void functions a feature or an artifact?

2021-08-02 Thread jfondren via Digitalmars-d-learn
On Monday, 2 August 2021 at 14:31:45 UTC, Rekel wrote: I recently found one can return function calls to void functions, though I don't remember any documentation mentioning this even though it doesn't seem trivial. ```d void print(){ writeln("0"); } void doSomething(int a){

Is returning void functions inside void functions a feature or an artifact?

2021-08-02 Thread Rekel via Digitalmars-d-learn
I recently found one can return function calls to void functions, though I don't remember any documentation mentioning this even though it doesn't seem trivial. ```d void print(){ writeln("0"); } void doSomething(int a){ if (a==0) return print();

Re: Bug or Feature: unsigned integer overflow

2019-12-14 Thread Tobias Pankrath via Digitalmars-d-learn
On Saturday, 14 December 2019 at 10:32:10 UTC, berni44 wrote: On Saturday, 14 December 2019 at 09:33:13 UTC, Tobias Pankrath wrote: See: https://dlang.org/spec/lex.html#integerliteral What I am aiming at: Is the spec wrong or am I misunderstanding it and did this change recently? You are

Re: Bug or Feature: unsigned integer overflow

2019-12-14 Thread berni44 via Digitalmars-d-learn
On Saturday, 14 December 2019 at 09:33:13 UTC, Tobias Pankrath wrote: See: https://dlang.org/spec/lex.html#integerliteral What I am aiming at: Is the spec wrong or am I misunderstanding it and did this change recently? You are right. The implementation does not do what the specs tell here.

Re: Bug or Feature: unsigned integer overflow

2019-12-14 Thread Tobias Pankrath via Digitalmars-d-learn
On Saturday, 14 December 2019 at 07:44:37 UTC, berni44 wrote: On Saturday, 14 December 2019 at 07:09:30 UTC, Tobias Pankrath wrote: void main() { auto x = 9223372036854775808; // long.max + 1 } You need to tell, that this is an unsigned long literal, else the compiler treats it as an

Re: Bug or Feature: unsigned integer overflow

2019-12-13 Thread berni44 via Digitalmars-d-learn
On Saturday, 14 December 2019 at 07:09:30 UTC, Tobias Pankrath wrote: void main() { auto x = 9223372036854775808; // long.max + 1 } You need to tell, that this is an unsigned long literal, else the compiler treats it as an int: void main() { auto x = 9223372036854775808UL; //

Bug or Feature: unsigned integer overflow

2019-12-13 Thread Tobias Pankrath via Digitalmars-d-learn
void main() { auto x = 9223372036854775808; // long.max + 1 } onlineapp.d(3): Error: signed integer overflow According to spec x should be of type ulong and this should compile? It indeed compiles if I add the uL postfix. Is this a bug or indented behaviour?

Re: Bug or Feature: `this` necessary to call function with template this parameter

2019-10-30 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 30 October 2019 at 20:22:25 UTC, Q. Schroll wrote: struct Example { private void helper(int i, this X)() { } void funcTempl(T, this X)(T value) { this.helper!0(); // ^ Why do I need this? } } void main() { auto ex = Example();

Bug or Feature: `this` necessary to call function with template this parameter

2019-10-30 Thread Q. Schroll via Digitalmars-d-learn
struct Example { private void helper(int i, this X)() { } void funcTempl(T, this X)(T value) { this.helper!0(); // ^ Why do I need this? } } void main() { auto ex = Example(); ex.funcTempl(1); } The question is in the comment in the code. Is that

Re: Cannot take the .keys of shared AA. Is this a regression in 2.087 or a feature?

2019-08-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 16, 2019 2:16:31 AM MDT Piotr Mitana via Digitalmars-d- learn wrote: > On Thursday, 15 August 2019 at 19:51:30 UTC, Jonathan M Davis > > wrote: > > Not being able to implicitly convert to const is a bit odd, but > > arguably, nothing should ever be called on a shared AA anyway. >

Re: Cannot take the .keys of shared AA. Is this a regression in 2.087 or a feature?

2019-08-16 Thread Piotr Mitana via Digitalmars-d-learn
On Thursday, 15 August 2019 at 19:51:30 UTC, Jonathan M Davis wrote: Not being able to implicitly convert to const is a bit odd, but arguably, nothing should ever be called on a shared AA anyway. If an operation isn't thread-safe, then it shouldn't work with shared. To use a shared object

Re: Cannot take the .keys of shared AA. Is this a regression in 2.087 or a feature?

2019-08-15 Thread bauss via Digitalmars-d-learn
On Thursday, 15 August 2019 at 19:51:30 UTC, Jonathan M Davis wrote: n Thursday, August 15, 2019 11:33:06 AM MDT Piotr Mitana via Digitalmars-d- learn wrote: Code: import std; shared(string[string]) dict; void main() { dict.keys; } Error:

Re: Cannot take the .keys of shared AA. Is this a regression in 2.087 or a feature?

2019-08-15 Thread Jonathan M Davis via Digitalmars-d-learn
n Thursday, August 15, 2019 11:33:06 AM MDT Piotr Mitana via Digitalmars-d- learn wrote: > Code: > > import std; > > shared(string[string]) dict; > > void main() > { > dict.keys; > } > > Error: > > /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(3417): > Error: cannot implicitly

Cannot take the .keys of shared AA. Is this a regression in 2.087 or a feature?

2019-08-15 Thread Piotr Mitana via Digitalmars-d-learn
Code: import std; shared(string[string]) dict; void main() { dict.keys; } Error: /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(3417): Error: cannot implicitly convert expression aa of type shared(string[string]) to const(shared(string)[string]) onlineapp.d(7): Error:

Re: Any full feature xml library available?

2019-05-05 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2019-05-03 at 14:07 -0700, H. S. Teoh via Digitalmars-d-learn wrote: > […] > The problem is that while there is no shortage of complaints about XML > support in D, there is a great dearth of people actually willing to *do* > something about it. In my case it is because I have no need to

Re: Any full feature xml library available?

2019-05-03 Thread Domain via Digitalmars-d-learn
On Friday, 3 May 2019 at 21:07:29 UTC, H. S. Teoh wrote: On Fri, May 03, 2019 at 09:56:56PM +0100, Russel Winder via Digitalmars-d-learn wrote: On Thu, 2019-05-02 at 09:28 -0700, H. S. Teoh via Digitalmars-d-learn wrote: > On Thu, May 02, 2019 at 05:23:29PM +0100, Russel Winder via >

Re: Any full feature xml library available?

2019-05-03 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, May 03, 2019 at 09:56:56PM +0100, Russel Winder via Digitalmars-d-learn wrote: > On Thu, 2019-05-02 at 09:28 -0700, H. S. Teoh via Digitalmars-d-learn > wrote: > > On Thu, May 02, 2019 at 05:23:29PM +0100, Russel Winder via > > Digitalmars-d-learn wrote: > > [...] > > > There are

Re: Any full feature xml library available?

2019-05-03 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2019-05-02 at 09:28 -0700, H. S. Teoh via Digitalmars-d-learn wrote: > On Thu, May 02, 2019 at 05:23:29PM +0100, Russel Winder via > Digitalmars-d-learn wrote: > [...] > > There are situations where you create a binding in preference to > > writing something from scratch. cf. gtk,

Re: Any full feature xml library available?

2019-05-02 Thread rikki cattermole via Digitalmars-d-learn
On 03/05/2019 4:23 AM, Russel Winder wrote: On Fri, 2019-05-03 at 03:50 +1200, rikki cattermole via Digitalmars-d- learn wrote: On 03/05/2019 3:36 AM, Russel Winder wrote: […] libxml2 is definitely usable from Python, it must be usable from D. Of course, I am assuming libxml2 has the

Re: Any full feature xml library available?

2019-05-02 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 2 May 2019 at 15:50:53 UTC, rikki cattermole wrote: On 03/05/2019 3:36 AM, Russel Winder wrote: On Thu, 2019-05-02 at 02:11 +1200, rikki cattermole via Digitalmars-d- learn wrote: […] It does not. Those features come under the big bad guys feature list. Gonna have to go to C

Re: Any full feature xml library available?

2019-05-02 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, May 02, 2019 at 05:23:29PM +0100, Russel Winder via Digitalmars-d-learn wrote: [...] > There are situations where you create a binding in preference to > writing something from scratch. cf. gtk, gstreamer, etc. so why not > libxml2? [...] No particular reason, except nobody has taken up

Re: Any full feature xml library available?

2019-05-02 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2019-05-03 at 03:50 +1200, rikki cattermole via Digitalmars-d- learn wrote: > On 03/05/2019 3:36 AM, Russel Winder wrote: > > […] > > libxml2 is definitely usable from Python, it must be usable from D. > > Of > > course, I am assuming libxml2 has the facilities required. > > libxml2 is

Re: Any full feature xml library available?

2019-05-02 Thread rikki cattermole via Digitalmars-d-learn
On 03/05/2019 3:36 AM, Russel Winder wrote: On Thu, 2019-05-02 at 02:11 +1200, rikki cattermole via Digitalmars-d- learn wrote: […] It does not. Those features come under the big bad guys feature list. Gonna have to go to C for it. Surely that means you can use Python, Rust, C++, or D

Re: Any full feature xml library available?

2019-05-02 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2019-05-02 at 02:11 +1200, rikki cattermole via Digitalmars-d- learn wrote: […] > > It does not. Those features come under the big bad guys feature list. > > Gonna have to go to C for it. Surely that means you can use Python, Rust, C++, or D rather than having to descen

Re: Any full feature xml library available?

2019-05-01 Thread rikki cattermole via Digitalmars-d-learn
ude;>         Have you looked at this? https://github.com/jmdavis/dxml Yes, but I don't think dxml support these features. It does not. Those features come under the big bad guys feature list. Gonna have to go to C for it.

Re: Any full feature xml library available?

2019-05-01 Thread Domain via Digitalmars-d-learn
On Wednesday, 1 May 2019 at 13:57:04 UTC, bachmeier wrote: On Wednesday, 1 May 2019 at 13:54:08 UTC, Domain wrote: I need a xml library which support document entity or xinclude. The xml may like this: ]> http://www.w3.org/2001/XInclude;> Have you looked at this?

Re: Any full feature xml library available?

2019-05-01 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 1 May 2019 at 13:54:08 UTC, Domain wrote: I need a xml library which support document entity or xinclude. The xml may like this: ]> http://www.w3.org/2001/XInclude;> Have you looked at this? https://github.com/jmdavis/dxml

Any full feature xml library available?

2019-05-01 Thread Domain via Digitalmars-d-learn
I need a xml library which support document entity or xinclude. The xml may like this: ]> http://www.w3.org/2001/XInclude;>

Re: Can you get typeof(this) in a mixin template - trying to mimic a Kotlin feature here.

2018-08-29 Thread aliak via Digitalmars-d-learn
On Tuesday, 28 August 2018 at 20:58:23 UTC, Alex wrote: Isn't the problem, that inside a template a declaration is expected, and not a foreach? Boh, you're right. I guess I misunderstood mixin templates. Found a way with a normap function though :p void mapSelf(alias self, alias aa)()

Re: Can you get typeof(this) in a mixin template - trying to mimic a Kotlin feature here.

2018-08-28 Thread Alex via Digitalmars-d-learn
On Tuesday, 28 August 2018 at 20:39:16 UTC, aliak wrote: Hi, I'm trying to do something similar to what Kotlin allows with assigning to member variables from a map. The syntax is very readable and looks like: class User(val map: Map) { val name: String by map val age: Int by map

Can you get typeof(this) in a mixin template - trying to mimic a Kotlin feature here.

2018-08-28 Thread aliak via Digitalmars-d-learn
Hi, I'm trying to do something similar to what Kotlin allows with assigning to member variables from a map. The syntax is very readable and looks like: class User(val map: Map) { val name: String by map val age: Int by map } So I'm trying to do something similar in D: mixin

Re: Package method is not virtual and cannot override - a bug or a feature?

2018-05-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, May 10, 2018 11:52:38 Piotr Mitana via Digitalmars-d-learn wrote: > Given this code: > > abstract class A > { > package @property void x(int x); > package @property int x(); > } > > class B : A > { > package @property override void x(int x) {} > package @property

Package method is not virtual and cannot override - a bug or a feature?

2018-05-10 Thread Piotr Mitana via Digitalmars-d-learn
Given this code: abstract class A { package @property void x(int x); package @property int x(); } class B : A { package @property override void x(int x) {} package @property override int x() { return 0; } } void main() {} I get the following message: onlineapp.d(9): Error:

Re: Can't add ubytes together to make a ubyte... bug or feature?

2018-03-17 Thread Ali Çehreli via Digitalmars-d-learn
On 03/17/2018 11:36 AM, Jonathan wrote: `(a+b)&0xff` What is this syntax?!  Could you give a link to this in the D documentation? Here is my description of bitwise AND: http://ddili.org/ders/d.en/bit_operations.html#ix_bit_operations.&,%20bitwise%20and The section titled "Masking" on the

Re: Can't add ubytes together to make a ubyte... bug or feature?

2018-03-17 Thread bauss via Digitalmars-d-learn
On Saturday, 17 March 2018 at 18:56:55 UTC, Dominikus Dittes Scherkl wrote: On Saturday, 17 March 2018 at 18:36:35 UTC, Jonathan wrote: On Tuesday, 19 January 2016 at 23:36:14 UTC, Adam D. Ruppe wrote: On Tuesday, 19 January 2016 at 22:12:06 UTC, Soviet Friend wrote: I don't care if my

Re: Can't add ubytes together to make a ubyte... bug or feature?

2018-03-17 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Saturday, 17 March 2018 at 18:36:35 UTC, Jonathan wrote: On Tuesday, 19 January 2016 at 23:36:14 UTC, Adam D. Ruppe wrote: On Tuesday, 19 January 2016 at 22:12:06 UTC, Soviet Friend wrote: I don't care if my computer needs to do math on a 4 byte basis, I'm not writing assembly. x86

Re: Can't add ubytes together to make a ubyte... bug or feature?

2018-03-17 Thread Jonathan via Digitalmars-d-learn
On Tuesday, 19 January 2016 at 23:36:14 UTC, Adam D. Ruppe wrote: On Tuesday, 19 January 2016 at 22:12:06 UTC, Soviet Friend wrote: I don't care if my computer needs to do math on a 4 byte basis, I'm not writing assembly. x86 actually doesn't need to do math that way, if you were writing

Re: Finding equivalent of C++ feature in D documentation.

2017-12-23 Thread kerdemdemir via Digitalmars-d-learn
it make sense to make a table with feature names and corresponding name of the same feature in other languages ? Try this: https://wiki.dlang.org/Programming_in_D_for_C%2B%2B_Programmers ... and potentially this: https://wiki.dlang.org/Coming_From Those resources are community maintained

Re: Finding equivalent of C++ feature in D documentation.

2017-12-23 Thread Seb via Digitalmars-d-learn
On Saturday, 23 December 2017 at 15:45:33 UTC, Mike Franklin wrote: On Saturday, 23 December 2017 at 15:04:30 UTC, kerdemdemir wrote: Is there any better way for me to search C/C++ equivalent features? As a humble suggestion would it make sense to make a table with feature names

Re: Finding equivalent of C++ feature in D documentation.

2017-12-23 Thread Mike Franklin via Digitalmars-d-learn
On Saturday, 23 December 2017 at 15:04:30 UTC, kerdemdemir wrote: Is there any better way for me to search C/C++ equivalent features? As a humble suggestion would it make sense to make a table with feature names and corresponding name of the same feature in other languages ? Try

Finding equivalent of C++ feature in D documentation.

2017-12-23 Thread kerdemdemir via Digitalmars-d-learn
ld it make sense to make a table with feature names and corresponding name of the same feature in other languages ? Erdem

Re: Base class' constructor is not implicitly inherited for immutable classes. A bug or a feature?

2017-07-20 Thread arturg via Digitalmars-d-learn
On Wednesday, 19 July 2017 at 16:00:56 UTC, Piotr Mitana wrote: Hello, I have this code: immutable class Base { this() {} } immutable class Derived : Base {} void main() { new immutable Derived(); } I'd like class Derived to automatically inherit the default constructor from

Re: Base class' constructor is not implicitly inherited for immutable classes. A bug or a feature?

2017-07-20 Thread Eugene Wissner via Digitalmars-d-learn
On Wednesday, 19 July 2017 at 16:00:56 UTC, Piotr Mitana wrote: Hello, I have this code: immutable class Base { this() {} } immutable class Derived : Base {} void main() { new immutable Derived(); } I'd like class Derived to automatically inherit the default constructor from

Re: Base class' constructor is not implicitly inherited for immutable classes. A bug or a feature?

2017-07-20 Thread bauss via Digitalmars-d-learn
On Wednesday, 19 July 2017 at 16:00:56 UTC, Piotr Mitana wrote: Hello, I have this code: immutable class Base { this() {} } immutable class Derived : Base {} void main() { new immutable Derived(); } I'd like class Derived to automatically inherit the default constructor from

Base class' constructor is not implicitly inherited for immutable classes. A bug or a feature?

2017-07-19 Thread Piotr Mitana via Digitalmars-d-learn
Hello, I have this code: immutable class Base { this() {} } immutable class Derived : Base {} void main() { new immutable Derived(); } I'd like class Derived to automatically inherit the default constructor from Base. However, this is not the case: main.d(6): Error: class

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-13 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 13 May 2017 at 10:51:09 UTC, k-five wrote: Okay, and NOW I understood what you are trying to say. First of all I thought you got mad at me. And I became sad. My sincere apologies! Always assume the best in people :-) I am glad you asked for clarification. [...] Still I am a

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-13 Thread k-five via Digitalmars-d-learn
On Saturday, 13 May 2017 at 10:15:34 UTC, Bastiaan Veelo wrote: On Saturday, 13 May 2017 at 08:23:55 UTC, k-five wrote: [...] OK understood. [...] I am sorry for expressing myself poorly. What I meant to say is that it looked like you can write an interesting article about your

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-13 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 13 May 2017 at 08:23:55 UTC, k-five wrote: On Friday, 12 May 2017 at 20:53:56 UTC, Bastiaan Veelo wrote: Is it safe to say that these 40 lines of D do the same as your 324 lines of C++ [1]? No. I cannot say that. Since this is not a full port of renrem in C++ to D. It was just

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-13 Thread k-five via Digitalmars-d-learn
On Friday, 12 May 2017 at 20:53:56 UTC, Bastiaan Veelo wrote: Is it safe to say that these 40 lines of D do the same as your 324 lines of C++ [1]? No. I cannot say that. Since this is not a full port of renrem in C++ to D. It was just an example in D, nothing else. This, and your comments

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 12 May 2017 at 21:26:01 UTC, Bastiaan Veelo wrote: On Friday, 12 May 2017 at 15:24:52 UTC, k-five wrote: A full version that I just added to my gitgub: https://github.com/k-five/dren You may like getopt[1] for command line argument parsing. https://dlang.org/phobos/std_getopt.html

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-12 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 12 May 2017 at 15:24:52 UTC, k-five wrote: A full version that I just added to my gitgub: https://github.com/k-five/dren You may like getopt[1] for command line argument parsing. https://dlang.org/phobos/std_getopt.html

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-12 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 12 May 2017 at 15:24:52 UTC, k-five wrote: On Friday, 12 May 2017 at 11:10:01 UTC, k-five wrote: I was waiting for a stable version of C++17 ( standard library ) to add some features of fileSystem in C++17 to my program that wants to iterate through all files in a directory

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-12 Thread k-five via Digitalmars-d-learn
On Friday, 12 May 2017 at 11:10:01 UTC, k-five wrote: I was waiting for a stable version of C++17 ( standard library ) to add some features of fileSystem in C++17 to my program that wants to iterate through all files in a directory recursively. I was thinking how could I do for implementing

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-12 Thread k-five via Digitalmars-d-learn
On Friday, 12 May 2017 at 12:56:50 UTC, drug wrote: 12.05.2017 14:58, k-five пишет: On Friday, 12 May 2017 at 11:41:57 UTC, cym13 wrote: On Friday, 12 May 2017 at 11:10:01 UTC, k-five wrote: --- also .each!writeln should be possible

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-12 Thread drug via Digitalmars-d-learn
12.05.2017 14:58, k-five пишет: On Friday, 12 May 2017 at 11:41:57 UTC, cym13 wrote: On Friday, 12 May 2017 at 11:10:01 UTC, k-five wrote: --- Shorter: void main( string[] args ){ dirEntries( ".", SpanMode.depth, false )

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-12 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 12 May 2017 at 11:10:01 UTC, k-five wrote: I was waiting for a stable version of C++17 ( standard library ) to add some features of fileSystem in C++17 to my program that wants to iterate through all files in a directory recursively. I was thinking how could I do for implementing

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-12 Thread cym13 via Digitalmars-d-learn
On Friday, 12 May 2017 at 11:58:23 UTC, k-five wrote: On Friday, 12 May 2017 at 11:41:57 UTC, cym13 wrote: [...] --- [...] - Thanks and the correct syntax for each! is, passing a

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-12 Thread k-five via Digitalmars-d-learn
On Friday, 12 May 2017 at 11:41:57 UTC, cym13 wrote: On Friday, 12 May 2017 at 11:10:01 UTC, k-five wrote: --- Shorter: void main( string[] args ){ dirEntries( ".", SpanMode.depth, false ) .filter!( file =>

Re: As many thanks As possible to who crates D and UFCS feature

2017-05-12 Thread cym13 via Digitalmars-d-learn
On Friday, 12 May 2017 at 11:10:01 UTC, k-five wrote: I was waiting for a stable version of C++17 ( standard library ) to add some features of fileSystem in C++17 to my program that wants to iterate through all files in a directory recursively. I was thinking how could I do for implementing

As many thanks As possible to who crates D and UFCS feature

2017-05-12 Thread k-five via Digitalmars-d-learn
I was waiting for a stable version of C++17 ( standard library ) to add some features of fileSystem in C++17 to my program that wants to iterate through all files in a directory recursively. I was thinking how could I do for implementing that and add it to my program. Now after starting to

Re: Needed return type in static method? bug or feature?

2016-03-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, March 08, 2016 14:56:06 Antonio Corbi via Digitalmars-d-learn wrote: > On Tuesday, 8 March 2016 at 14:13:17 UTC, Adam D. Ruppe wrote: > > On Tuesday, 8 March 2016 at 13:40:06 UTC, Antonio Corbi wrote: > >> Is it a feature or a bug? > > > > It is allo

Re: Needed return type in static method? bug or feature?

2016-03-08 Thread Antonio Corbi via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 14:13:17 UTC, Adam D. Ruppe wrote: On Tuesday, 8 March 2016 at 13:40:06 UTC, Antonio Corbi wrote: Is it a feature or a bug? It is allowed because the "auto" keyword doesn't actually required for auto functions (or variables), what you need i

Re: Needed return type in static method? bug or feature?

2016-03-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 13:40:06 UTC, Antonio Corbi wrote: Is it a feature or a bug? It is allowed because the "auto" keyword doesn't actually required for auto functions (or variables), what you need is any one of the storage classes. Those include static, auto, const, immut

Needed return type in static method? bug or feature?

2016-03-08 Thread Antonio Corbi via Digitalmars-d-learn
turn 1; } static sbar () { return "hi!"; } static ibar () { return 0; } } void main () { auto b = new B; writeln (B.sbar); writeln (B.ibar); } -8><-------- Is it a feature or a bug? I've seen it being used in https://github.com/geck

Re: Is this a feature?

2016-01-21 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 21 January 2016 at 14:39:43 UTC, Adam D. Ruppe wrote: On Thursday, 21 January 2016 at 14:35:09 UTC, Sebastiaan Koppe wrote: static if (!is(SomethingUndefined!moreUndefined[0] : UndefinedThing)) Yes, the is expression returns false for undefined things because they aren't types.

Is this a feature?

2016-01-21 Thread Sebastiaan Koppe via Digitalmars-d-learn
module undefined; unittest { static if (!is(SomethingUndefined!moreUndefined[0] : UndefinedThing)) { pragma(msg,"This will compile just fine!"); } }

Re: Is this a feature?

2016-01-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 21 January 2016 at 14:35:09 UTC, Sebastiaan Koppe wrote: static if (!is(SomethingUndefined!moreUndefined[0] : UndefinedThing)) Yes, the is expression returns false for undefined things because they aren't types. The standard library uses this in a lot of places to test for

Can't add ubytes together to make a ubyte... bug or feature?

2016-01-19 Thread Soviet Friend via Digitalmars-d-learn
I just attempted to add one ubyte to another and store the result in a ubyte but apparently ubytes get converted to ints when being added... and converting what becomes an int becomes impossible to store in a ubyte without an explicit cast... ubyte a, b; ubyte c = a + b; // Error: cannot

Re: Can't add ubytes together to make a ubyte... bug or feature?

2016-01-19 Thread Daniel Kozak via Digitalmars-d-learn
Soviet Friend píše v Út 19. 01. 2016 v 22:12 +: > I just attempted to add one ubyte to another and store the result  > in a ubyte but apparently ubytes get converted to ints when being  > added... and converting what becomes an int becomes impossible to  > store in a ubyte without an explicit

Re: Can't add ubytes together to make a ubyte... bug or feature?

2016-01-19 Thread Chris Wright via Digitalmars-d-learn
On Tue, 19 Jan 2016 23:32:57 +0100, Daniel Kozak wrote: > Soviet Friend píše v Út 19. 01. 2016 v 22:12 +: >> I just attempted to add one ubyte to another and store the result in a >> ubyte but apparently ubytes get converted to ints when being added... >> and converting what becomes an int

Re: Can't add ubytes together to make a ubyte... bug or feature?

2016-01-19 Thread Ali Çehreli via Digitalmars-d-learn
On 01/19/2016 02:12 PM, Soviet Friend wrote: > ubytes get converted to ints when being added... It's a common feature involving all integral type in languages like C, C++, and D: https://dlang.org/spec/type.html#integer-promotions > On the topic of complaining about casting...

Re: Can't add ubytes together to make a ubyte... bug or feature?

2016-01-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 19 January 2016 at 22:12:06 UTC, Soviet Friend wrote: I don't care if my computer needs to do math on a 4 byte basis, I'm not writing assembly. x86 actually doesn't need to do math that way, if you were writing assembly, it would just work. This is just an annoying rule brought

Re: Feature for paranoids

2015-11-10 Thread ponce via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 13:09:09 UTC, Fyodor Ustinov wrote: Hi! Is it possible when using the "-release" indicate that this one in/out/invariant/assert should not to be disabled? WBR, Fyodor. Since assert(false) is special (cf.

Re: Feature for paranoids

2015-11-10 Thread Kagamin via Digitalmars-d-learn
I wouldn't recommend release mode to paranoids. I personally use `debug invariant` and `debug assert` for purely debugging code.

Re: Feature for paranoids

2015-11-10 Thread ponce via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 20:37:00 UTC, Fyodor Ustinov wrote: assert(false) AKA assert(0) - is a part of this language that I think it is absolute evil. WBR, Fyodor. I would say it's a minor evil, that create problems by needing an explanation. At this point it has been

  1   2   3   >