Re: Giving up

2022-08-06 Thread Rumbu via Digitalmars-d-announce
On Saturday, 6 August 2022 at 08:29:19 UTC, Walter Bright wrote: On 8/5/2022 9:43 AM, Max Samukha wrote: Both "123." and "123.E123" is valid C. For some reason, D only copied the former. It's to support UFCS (Universal Function Call Syntax). The idea with C compatible aspects of D is to not

Re: Giving up

2022-08-05 Thread Rumbu via Digitalmars-d-announce
On Friday, 5 August 2022 at 16:37:56 UTC, Steven Schveighoffer wrote: I don't think that code ever built. Possibly you didn't test it properly originally. But if you are done with it, I guess it doesn't matter. -Steve Thank you for this. Deleted since everything is fake there and never

Re: Giving up

2022-08-05 Thread Rumbu via Digitalmars-d-announce
On Friday, 5 August 2022 at 16:08:50 UTC, Steven Schveighoffer wrote: Just saying, I see an integer. That's an integer according to the language (as far back as I can test, which is 2.060 released 2012). If that was somehow parsing as a float before, that was a bug in the parser. Since your

Giving up

2022-08-05 Thread Rumbu via Digitalmars-d-announce
Hi, Sincerely I am tired to maintain my library with every change made by D compiler. Mostly regressions. Bug reports are ignored or challenged, I don't have time to argue. Therefore, if someone finds interesting my decimal lib [0], please continue or maintain it from here, I stopped

Re: On the D Blog -- Teaching D from Scratch: Is it a viable first language?

2021-12-24 Thread rumbu via Digitalmars-d-announce
On Thursday, 23 December 2021 at 12:44:04 UTC, Mike Parker wrote: Steven Schveighoffer has been using D to teach a group of children to program. He wrote about his experience for the D blog. Is D a viable first language? See what Steve has to say about it :-) The blog:

Re: How to loop through characters of a string in D language?

2021-12-23 Thread rumbu via Digitalmars-d-learn
On Thursday, 23 December 2021 at 07:14:35 UTC, Salih Dincer wrote: It seems faster than algorithms in Phobos. We would love to see this in our new Phobos. Replace: 436 msecs Malloc : 259 msecs */ It seems because MallocReplace is cheating a lot: - it is not called through another function

Re: what the closest thing we have to racket's check_expect()?

2021-12-22 Thread Rumbu via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 20:14:01 UTC, Dr Machine Code wrote: it differ from assert because it contains the expression, file and line information. See this https://stackoverflow.com/questions/14420857/check-expect-example-in-racket what's the closest thing we have in D? can we make it

Re: How to insert code in place with templates/mixins?

2021-12-20 Thread rumbu via Digitalmars-d-learn
On Monday, 20 December 2021 at 10:49:20 UTC, rempas wrote: On Monday, 20 December 2021 at 09:30:30 UTC, rumbu wrote: Thanks a lot for the info. When I try to use this code, I'm getting the following error: ``` Error: expression expected, not `%` Error: expression expected, not `%` ``` My

Re: How to insert code in place with templates/mixins?

2021-12-20 Thread rumbu via Digitalmars-d-learn
On Monday, 20 December 2021 at 08:45:50 UTC, rempas wrote: Here I am having a problem with templates again. No matter how much I read, I can't seem to understand how templates/mixins work. So any ideas why this doesn't work? because you cannot have statements directly in a template (the

Re: Immutability and arrays

2021-12-14 Thread rumbu via Digitalmars-d-learn
On Tuesday, 14 December 2021 at 16:21:03 UTC, Steven Schveighoffer wrote: On 12/14/21 11:19 AM, Steven Schveighoffer wrote: Er... scratch that, this isn't construction, it should use opAssign. Again, probably because memcpy+postblit is used by the runtime. If not reported, it should be.

Re: Immutability and arrays

2021-12-14 Thread rumbu via Digitalmars-d-learn
On Tuesday, 14 December 2021 at 12:13:23 UTC, Stanislav Blinov wrote: Because is(typeof(immutable(ComplexStruct).x) == immutable(int[])). Can't bind an array of immutable to array of mutable. This would require a deep copy, i.e. copy constructor. This means that the only way to write a

Immutability and arrays

2021-12-14 Thread rumbu via Digitalmars-d-learn
I am trying to understand why in this two different cases (Simple and Complex), the compiler behaviour is different. ```d struct SimpleStruct { int x;} struct ComplexStruct { int[] x; } void main() { SimpleStruct[] buf1; immutable(SimpleStruct)[] ibuf1; buf1[0 .. 10] = ibuf1[0 ..

Re: How to loop through characters of a string in D language?

2021-12-11 Thread Rumbu via Digitalmars-d-learn
On Saturday, 11 December 2021 at 14:42:53 UTC, russhy wrote: Here is mine - 0 allocations - configurable - let's you use it how you wish - fast You know that this is already in phobos? ``` "abc;def;ghi".splitter(';').joiner ```

Re: How to loop through characters of a string in D language?

2021-12-10 Thread Rumbu via Digitalmars-d-learn
On Friday, 10 December 2021 at 18:47:53 UTC, Stanislav Blinov wrote: Be interesting to see if this thread does evolve into a SIMD http://lemire.me/blog/2017/01/20/how-quickly-can-you-remove-spaces-from-a-string/

Re: How to loop through characters of a string in D language?

2021-12-10 Thread Rumbu via Digitalmars-d-learn
On Friday, 10 December 2021 at 11:06:21 UTC, IGotD- wrote: On Friday, 10 December 2021 at 06:24:27 UTC, Rumbu wrote: Since it seems there is a contest here: ```d "abc;def;ghi".split(';').join(); ``` :) Would that become two for loops or not? I thought it's a beauty contest. ```d string

Re: How to loop through characters of a string in D language?

2021-12-09 Thread Rumbu via Digitalmars-d-learn
On Wednesday, 8 December 2021 at 11:23:45 UTC, BoQsc wrote: Let's say I want to skip characters and build a new string. The character I want to skip: `;` Expected result: ``` abcdefab ``` Since it seems there is a contest here: ```d "abc;def;ghi".split(';').join(); ``` :)

Re: Mixin template overloads not working

2021-12-07 Thread Rumbu via Digitalmars-d-learn
On Friday, 3 December 2021 at 10:57:34 UTC, Stanislav Blinov wrote: On Friday, 3 December 2021 at 10:42:37 UTC, Rumbu wrote: Bug or feature? Is there any workaround? The error message explains what to do :) Error: class `mixinover.AnotherVisitor` use of `mixinover.Visitor.visit(S s)` is

Mixin template overloads not working

2021-12-03 Thread Rumbu via Digitalmars-d-learn
```d class S {} class A:S {} class B:S {} mixin template vmix(T) {    void visit(T t) {} } class Visitor {    void visit(S s) {}    mixin vmix!A;    mixin vmix!B; } class AnotherVisitor: Visitor {    override void visit(A a) {} } ``` This will result in error when I try to override mixin

Re: Attributes (lexical)

2021-11-25 Thread rumbu via Digitalmars-d-learn
On Thursday, 25 November 2021 at 11:25:49 UTC, Ola Fosheim Grøstad wrote: On Thursday, 25 November 2021 at 10:41:05 UTC, Rumbu wrote: I am not asking this questions out of thin air, I am trying to write a conforming lexer and this is one of the ambiguities. I think it is easier to just look

Re: Attributes (lexical)

2021-11-25 Thread Rumbu via Digitalmars-d-learn
On Thursday, 25 November 2021 at 10:10:25 UTC, Dennis wrote: On Thursday, 25 November 2021 at 08:06:27 UTC, rumbu wrote: Also, this works also for #line, even if the specification tells us that all tokens must be on the same line Where does it say that? Well: ``` #line IntegerLiteral

Attributes (lexical)

2021-11-25 Thread rumbu via Digitalmars-d-learn
Just playing around with attributes. This is valid D code: ```d @ nogc: //yes, this is @nogc in fact, even some lines are between @ /* i can put some comments */ /** even some documentation */ // single line comments also (12) // yes, comments and newlines are allowed between

Time to setup D's wallet

2021-11-09 Thread Rumbu via Digitalmars-d-announce
Nim received a nice donation :) https://nim-lang.org/blog/2021/10/25/nim-receives-100k-usd-bitcoin.html You never know when it happens.

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Rumbu via Digitalmars-d-learn
On Saturday, 6 March 2021 at 12:15:43 UTC, Mike Parker wrote: On Saturday, 6 March 2021 at 11:57:13 UTC, Imperatorn wrote: What... Is this really how it's supposed to be? Makes no sense to not use any of the existing conventions. extern(C) and extern(D) are both documented to be the same as

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Rumbu via Digitalmars-d-learn
On Friday, 5 March 2021 at 21:47:49 UTC, z wrote: On Friday, 5 March 2021 at 16:10:02 UTC, Rumbu wrote: First of all, in 64 bit ABI, parameters are not passed on stack, therefore a[RBP] is a nonsense. void complement32(simdbytes* a, simdbytes* b) a is in RCX, b is in RDX on Windows a is in

Re: Using YMM registers causes an undefined label error

2021-03-05 Thread Rumbu via Digitalmars-d-learn
On Friday, 5 March 2021 at 12:57:43 UTC, z wrote: XMM registers work, but as soon as they are changed into YMM DMD outputs "bad type/size of operands %s" and LDC outputs an "label YMM0 is undefined" error. Are they not supported? To illutrate : https://run.dlang.io/is/IqDHlK By the way, how

Re: How can I make this work?

2021-02-28 Thread Rumbu via Digitalmars-d-learn
On Sunday, 28 February 2021 at 09:04:49 UTC, Rumbu wrote: On Sunday, 28 February 2021 at 07:05:27 UTC, Jack wrote: I'm using a windows callback function where the user-defined value is passed thought a LPARAM argument type. I'd like to pass my D array then access it from that callback

Re: How can I make this work?

2021-02-28 Thread Rumbu via Digitalmars-d-learn
On Sunday, 28 February 2021 at 07:05:27 UTC, Jack wrote: I'm using a windows callback function where the user-defined value is passed thought a LPARAM argument type. I'd like to pass my D array then access it from that callback function. How is the casting from LPARAM to my type array done in

Windows Bindings v1.1

2021-02-20 Thread Rumbu via Digitalmars-d-announce
- updated to Windows SDK 10.19041.5 - wchar* constants with GUID patterns translated as GUID structures - improved documentation - strongly typed handles - auto disposed handles - new attributes (currently ignored): RetVal, NullNullTerminated, NotNullTerminated - published as dub package

Re: Windows Bindings v1.0

2021-02-18 Thread Rumbu via Digitalmars-d-announce
On Wednesday, 17 February 2021 at 20:53:49 UTC, tchaloupka wrote: On Tuesday, 16 February 2021 at 08:45:19 UTC, Rumbu wrote: The D Windows SDK projection reached first version. Generated bindings were compiled succesfully. https://github.com/rumbu13/windows-d Destroy! Thanks for this,

Re: Windows Bindings v1.0

2021-02-17 Thread Rumbu via Digitalmars-d-announce
On Wednesday, 17 February 2021 at 14:53:11 UTC, Steven Schveighoffer wrote: On 2/16/21 3:45 PM, Rumbu wrote: On Tuesday, 16 February 2021 at 08:53:06 UTC, rikki cattermole wrote: [...] Sincerely, I doubt that it's a good idea to duplicate gigs of WinAPI documentation which can be found on

Re: fold on empty range

2021-02-17 Thread Rumbu via Digitalmars-d-learn
On Wednesday, 17 February 2021 at 12:58:29 UTC, Mitacha wrote: On Wednesday, 17 February 2021 at 11:38:45 UTC, Rumbu wrote: [...] If you replace `fold` and `splitter` with this, then it doesn't allocate: ``` auto fn() @nogc { return only("k1,k2", "k3,k4") .map!(x =>

Re: fold on empty range

2021-02-17 Thread Rumbu via Digitalmars-d-learn
On Wednesday, 17 February 2021 at 10:15:10 UTC, Mitacha wrote: it'll use empty string as first element in range. BTW perheps you could use `joinner` instead of this `fold` to join values with ",". Thanks for that. I thought to joiner too, but it doesn't work. I need fold to take a list of

fold on empty range

2021-02-17 Thread Rumbu via Digitalmars-d-learn
In the expression below: return matchAll(content, keywordsPattern) .map!(a => a.hit.stripLeft("[").strip("]")) .fold!((a, b) => a ~ "," ~ b) .splitter(',') .map!(a => a.stripLeft("\" ").strip("\" ")) .filter!(a => !a.any!(b => b == ' '

Re: Windows Bindings v1.0

2021-02-16 Thread Rumbu via Digitalmars-d-announce
On Tuesday, 16 February 2021 at 20:49:30 UTC, Max Haughton wrote: On Tuesday, 16 February 2021 at 08:45:19 UTC, Rumbu wrote: The D Windows SDK projection reached first version. Generated bindings were compiled succesfully. https://github.com/rumbu13/windows-d Destroy! Hi, I'll be getting

Re: Windows Bindings v1.0

2021-02-16 Thread Rumbu via Digitalmars-d-announce
On Tuesday, 16 February 2021 at 08:53:06 UTC, rikki cattermole wrote: All of the symbols and modules need to be documented so that the documentation generators will generate documentation for them. Sincerely, I doubt that it's a good idea to duplicate gigs of WinAPI documentation which

Windows Bindings v1.0

2021-02-16 Thread Rumbu via Digitalmars-d-announce
The D Windows SDK projection reached first version. Generated bindings were compiled succesfully. https://github.com/rumbu13/windows-d Destroy!

Re: Is there other way to do that?

2021-02-15 Thread Rumbu via Digitalmars-d-learn
On Monday, 15 February 2021 at 07:26:56 UTC, Jack wrote: I need to check if an instance is of a specific type derived from my base class but this class has template parameter and this type isn't available at time I'm checking it. Something like: class B { } class A(T) : B { } class X : B { }

Re: Is this the proper way to do it?

2021-02-13 Thread Rumbu via Digitalmars-d-learn
On Saturday, 13 February 2021 at 05:52:34 UTC, Jack wrote: I have a base class A, where I make specific operator depending on the derived class type. Currently I'm using something like this: c is a class derived from A bool shouldDoX = (cast(X)c) !is null || (cast(Y)c) !is null || (cast(K)c)

Re: Real simple unresolved external symbols question...

2021-02-10 Thread Rumbu via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 19:37:17 UTC, WhatMeWorry wrote: I'm trying to create a super simple dynamic library consisting of two files: file2.d -- extern(D): double addEight(double d) { return (d + 8.0); } fileB.d

Re: Dimensions in compile time

2021-02-08 Thread Rumbu via Digitalmars-d-learn
On Monday, 8 February 2021 at 12:19:26 UTC, Basile B. wrote: On Monday, 8 February 2021 at 11:42:45 UTC, Vindex wrote: size_t ndim(A)(A arr) { return std.algorithm.count(typeid(A).to!string, '['); } Is there a way to find out the number of dimensions in an array at compile time? yeah.

Re: Finding position of a value in an array

2021-02-06 Thread Rumbu via Digitalmars-d-learn
On Sunday, 29 December 2019 at 08:26:58 UTC, Daren Scot Wilson wrote: Reading documentation... Array, Algorithms, ... maybe I've been up too late... how does one obtain the index of, say, 55 in an array like this int[] a = [77,66,55,44]; I want to do something like: int i =

Re: Ugly c++ syntax

2021-02-06 Thread Rumbu via Digitalmars-d-learn
On Saturday, 6 February 2021 at 00:35:12 UTC, Ali Çehreli wrote: On 2/5/21 1:10 PM, Rumbu wrote: I gave up after reading a lot, but I didn't manage to understand the meaning "&& ..." I think it's the universal reference. Thank you Ali, but nope, it's "parameter pack folding". This allows

Ugly c++ syntax

2021-02-05 Thread Rumbu via Digitalmars-d-learn
Can some C++ guru translate in D the template below? I gave up after reading a lot, but I didn't manage to understand the meaning "&& ..." template static uint8_t composite_index_size(Tables const&... tables) { return (composite_index_size(tables.size(),

Re: books for learning D

2020-01-29 Thread rumbu via Digitalmars-d-learn
On Wednesday, 29 January 2020 at 08:40:48 UTC, p.shkadzko wrote: Has anyone read "d programming language tutorial: A Step By Step Appoach: Learn d programming language Fast"? https://www.goodreads.com/book/show/38328553-d-programming-language-tutorial?from_search=true=G9QIeXioOJ=3 Beware,

Re: How to convert this C++ code to Dlang? Please send me Dlang version of this C++ code

2020-01-27 Thread rumbu via Digitalmars-d-learn
On Monday, 27 January 2020 at 11:34:47 UTC, Marcone wrote: #include #include #include #include "resource.h" #include HINSTANCE hInst; BOOL CALLBACK DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { } return TRUE;

Re: How load icon from resource using LoadImage?

2020-01-05 Thread Rumbu via Digitalmars-d-learn
On Sunday, 5 January 2020 at 13:33:35 UTC, Marcone wrote: I am using this code to load icon from local directory, but I want to load icon from resource.res file: wndclass.hIcon = LoadImage( NULL, "icon.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE| LR_SHARED | LR_LOADTRANSPARENT); You cannot

array of functions/delegates

2019-12-23 Thread Rumbu via Digitalmars-d-learn
I am trying to create an array of functions inside a struct. struct S { void f1() {} void f2() {} alias Func = void function(); immutable Func[2] = [, ] } What I got: Error: non-constant expression '' Tried also with delegates (since I am in a struct context but I got: no `this` to

Re: How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

2019-12-09 Thread rumbu via Digitalmars-d-learn
On Sunday, 8 December 2019 at 20:50:05 UTC, Marcone wrote: I want to add version to my program. I have configurated my version file "version.txt", but I dont know how link this file to my program. If Need spec file, please send the exemple code of spec. Or is is possible add version file by

Re: why local variables cannot be ref?

2019-11-25 Thread rumbu via Digitalmars-d-learn
On Monday, 25 November 2019 at 08:20:59 UTC, rumbu wrote: On Monday, 25 November 2019 at 08:07:50 UTC, Fanda Vacek wrote: Thanks for answer, I'm coming from C++. But anyway, pointers are not allowed in @safe code, so this is not always solution. Workaround exits even for @safe code, so my

Re: why local variables cannot be ref?

2019-11-25 Thread rumbu via Digitalmars-d-learn
On Monday, 25 November 2019 at 08:07:50 UTC, Fanda Vacek wrote: Thanks for answer, I'm coming from C++. But anyway, pointers are not allowed in @safe code, so this is not always solution. Workaround exits even for @safe code, so my question remains the same. What is a rationale for such a

Re: why local variables cannot be ref?

2019-11-24 Thread Rumbu via Digitalmars-d-learn
On Monday, 25 November 2019 at 03:07:08 UTC, Fanda Vacek wrote: Maybe I'm missing the thing, but I'm not able to declare local ref variable even if simple workaround exists. Is this preferred design pattern? ``` int main() { int a = 1; //ref int b = a; // Error: variable

Re: dud: A dub replacement

2019-11-20 Thread Rumbu via Digitalmars-d-announce
On Wednesday, 20 November 2019 at 13:37:39 UTC, Jacob Carlborg wrote: On Wednesday, 20 November 2019 at 11:40:19 UTC, Robert Schadek wrote: Here is disagree, to a degree I consider comments a code smell. If I have to write them, I failed to convey the information needed to understand the code

Re: Proper desctructor for an class containing dynamic array of objects

2019-06-14 Thread rumbu via Digitalmars-d-learn
On Friday, 14 June 2019 at 07:52:24 UTC, Marco de Wild wrote: On Thursday, 13 June 2019 at 16:08:52 UTC, Mike wrote: Opposed to Java, D's member variables are static initialised. Is there any documentation about this? I find it unexpected.

Re: Proper desctructor for an class containing dynamic array of objects

2019-06-13 Thread Rumbu via Digitalmars-d-learn
On Thursday, 13 June 2019 at 16:08:52 UTC, Mike wrote: How would a proper destructor of class Foo look like? Is it enough to set "array" to null? Or do I have to set every element of the array to null and then the array, or nothing of that at all because the garbage collecter collects it, if

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread rumbu via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:16:49 UTC, Jim wrote: On Tuesday, 21 May 2019 at 07:04:27 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: That's because foo is of type Base, not implementing FeatureX. Right, Base isn't implementing FeatureX, but foo is really a Foo

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread rumbu via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: Hi, consider this: interface Base { void setup(); } interface FeatureX { void x(); } class Foo: Base, FeatureX { void setup(){}; void x(){}; } void main() { Base foo = new Foo(); // This would be the result of a factory class

Re: [windows] Can't delete a closed file?

2019-05-10 Thread Rumbu via Digitalmars-d-learn
On Friday, 10 May 2019 at 19:10:05 UTC, Machine Code wrote: Well, I've had similar issue. The error message says "access denied" which I believe refers to the tmp directory; i.e, the user that is running your executable has no permissions to delete that file. Well, this has nothing to do

Re: [windows] Can't delete a closed file?

2019-05-09 Thread Rumbu via Digitalmars-d-learn
On Thursday, 9 May 2019 at 10:09:23 UTC, Cym13 wrote: Hi, this is likely not related to D itself but hopefully someone can help me with this since I'm rather new to windows programming, I mainly work on linux. I'm trying to bundle a DLL in a binary, write it in a temp folder, use it and

Re: D community's view on syntactic sugar

2018-06-15 Thread rumbu via Digitalmars-d
On Saturday, 16 June 2018 at 02:44:04 UTC, Jonathan M Davis wrote: Typically, the approach right now is to do stuff in libraries rather than the language if it's at all reasonably possible. The language is incredibly powerful as it is, and we can do a _lot_ of stuff with libraries,

Re: D only has Advantages

2018-06-14 Thread rumbu via Digitalmars-d-announce
On Thursday, 14 June 2018 at 10:18:26 UTC, Walter Bright wrote: On 6/14/2018 2:53 AM, Unsafe wrote: "D only has advantages" ?? What is the point of such a post? Read the parent post. This was in fact the problem: it was not obvious that there is a parent post.

Re: Morale of a story: ~ is the right choice for concat operator

2018-05-26 Thread rumbu via Digitalmars-d
On Saturday, 26 May 2018 at 10:08:35 UTC, Dukc wrote: On Saturday, 26 May 2018 at 09:01:29 UTC, rumbu wrote: Sorry, but the mistake here is the fact that you wrongly assume C behavior in C#. Yes it is. But that does not make differentiating concat and addition in language desing any less

Re: Morale of a story: ~ is the right choice for concat operator

2018-05-26 Thread rumbu via Digitalmars-d
On Friday, 25 May 2018 at 08:27:30 UTC, Dukc wrote: [...] result = (digit < 10? '0' + (char)digit: 'A' + (char)(digit - [...] Looks correct, right? Yes. [...] So, ~ may be a bit confusing for newcomers, but there is a solid reason why it's used instead of +, and it's because they have a

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

2018-05-16 Thread rumbu via Digitalmars-d
On Wednesday, 16 May 2018 at 16:43:31 UTC, Walter Bright wrote: On 5/16/2018 6:55 AM, Andrei Alexandrescu wrote: On 05/16/2018 04:42 AM, Dave Jones wrote: On Wednesday, 16 May 2018 at 08:20:23 UTC, Uknown wrote: On Wednesday, 16 May 2018 at 07:53:36 UTC, aliak wrote: Just checked the rust

Re: Module-level privacy

2018-05-13 Thread rumbu via Digitalmars-d
On Sunday, 13 May 2018 at 15:13:59 UTC, meppl wrote: Also, someone may say: I can see what happens in one and the same file. If there are two classes/structs in one file, they are "friends" and I dont need the "friend"-keyword anymore. Thats an argument, too. So, when you have 1000 classes,

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

2018-05-12 Thread rumbu via Digitalmars-d
On Saturday, 12 May 2018 at 07:07:33 UTC, Jonathan M Davis wrote: You obviously don't have to test your private functions if you don't want to, but if you're trying to state that testing private functions is bad practice (and that's very much what it seemed like you were saying when you

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

2018-05-12 Thread rumbu via Digitalmars-d
On Friday, 11 May 2018 at 20:22:52 UTC, H. S. Teoh wrote: On Fri, May 11, 2018 at 02:04:34PM -0600, Jonathan M Davis via Digitalmars-d wrote: On Friday, May 11, 2018 19:45:10 rumbu via Digitalmars-d wrote: [...] > The first example is unit testing. Having access to the > private m

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

2018-05-11 Thread rumbu via Digitalmars-d
On Friday, 11 May 2018 at 16:51:30 UTC, Mike Parker wrote: On Friday, 11 May 2018 at 14:05:25 UTC, KingJoffrey wrote: private is not private at all in D, and because of this, classes are fundamentally broken in D (by design apparently). Now.. I really do have better ways to spend my time.

Re: Funding for code-d/serve-d

2018-05-08 Thread rumbu via Digitalmars-d-announce
On Tuesday, 8 May 2018 at 05:53:43 UTC, Apocalypto wrote: On Monday, 7 May 2018 at 09:29:06 UTC, Dechcaudron wrote: Also, though I use WebFreak's extension for VS code, I never really got it to work 100% (never really invested more than a couple minutes either, to be fair). Thinks like syntax

OT - Replacing strings with slices in C# - high performance improvement

2018-04-20 Thread rumbu via Digitalmars-d
.NET Core 2.1 was announced, with emphasis on using Span instead of classic String class all around the framework. For people not familiar with C#, Span is similar to a D array slice. https://blogs.msdn.microsoft.com/dotnet/2018/04/18/performance-improvements-in-net-core-2-1/

Re: #include C headers in D code

2018-04-11 Thread rumbu via Digitalmars-d-announce
On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote: Here's my blog post about my project that allows directly #including C headers in D* https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ Cannot manage to build it on Windows: D:\git\dpp>dub build WARNING:

Re: Idiomatic error handling for ranges

2018-04-05 Thread rumbu via Digitalmars-d-learn
On Thursday, 5 April 2018 at 17:36:56 UTC, Seb wrote: On Thursday, 5 April 2018 at 17:06:04 UTC, rumbu wrote: Is there a standard way to handle errors in a chain of range transformations? [...] Are you aware of ifThrown? https://dlang.org/phobos/std_exception.html#ifThrown It's not

Idiomatic error handling for ranges

2018-04-05 Thread rumbu via Digitalmars-d-learn
Is there a standard way to handle errors in a chain of range transformations? Let's say I want to read some comma separated numbers from a file. auto myArray = file.byLine().splitter().map!(to!int).array(); Now, besides fatal errors (like I/O), let's suppose I want to handle some errors in a

Re: code-d 0.17.0 + serve-d 0.1.2

2018-04-04 Thread rumbu via Digitalmars-d-announce
On Tuesday, 3 April 2018 at 23:02:42 UTC, WebFreak001 wrote: new code-d (D extension for vscode) and serve-d (Language Server Protocol server for it) release dcd-server.exe remains active in memory after I quit VSCode. If I close/open VSCode several times, I have a lot of dcd-server.exe

Re: [OT] Unity migrating parts of their engine from C++ into High Performace C# (HPC#)

2018-04-03 Thread rumbu via Digitalmars-d
On Tuesday, 3 April 2018 at 05:24:02 UTC, rikki cattermole wrote: Shame we don't have signatures, then we'd have similar functionality only better! https://github.com/rikkimax/DIPs/blob/master/DIPs/DIP1xxx-RC.md +1000 This would be a very interesting development.

Re: [OT] Unity migrating parts of their engine from C++ into High Performace C# (HPC#)

2018-04-02 Thread rumbu via Digitalmars-d
On Monday, 2 April 2018 at 22:55:58 UTC, Meta wrote: On Monday, 2 April 2018 at 20:19:17 UTC, rumbu wrote: void foo(IRange someRange) { //do something with someRange even it's a struct //this includes code completion and other IDE specific stuff. } In D, template constrains are not

Re: [OT] Unity migrating parts of their engine from C++ into High Performace C# (HPC#)

2018-04-02 Thread rumbu via Digitalmars-d
On Monday, 2 April 2018 at 18:54:28 UTC, 12345swordy wrote: - Only structs are used, no classes; - .NET collections are replaced by native collections that manage their own memory - No code that would trigger GC is allowed - Compiler is aware of Unity features and is able to explore SIMD, by

Re: D mentioned in Infoworld

2018-03-29 Thread rumbu via Digitalmars-d
On Thursday, 29 March 2018 at 16:10:55 UTC, Johannes Loher wrote: Also I believe that D shares a lot of characteristics with Java and C#, in particular when you do OOP with D. I think you could make a case for the statement, that D is closer to Java than it is to C. Sure, let's prepare

Re: Help with specific template function

2018-03-26 Thread rumbu via Digitalmars-d-learn
On Monday, 26 March 2018 at 06:40:34 UTC, Vladimirs Nordholm wrote: However I do not understand how to use that with my arguments. Eg. I would expect to do something like: void foo(X, Y, Args...)(X x, Y y, Args args) if(isNumeric!(x) && isNumeric!(y) && args.length >= 1) {

Re: Am I reading this wrong, or is std.getopt *really* this stupid?

2018-03-24 Thread rumbu via Digitalmars-d
On Saturday, 24 March 2018 at 06:04:23 UTC, Seb wrote: Yes, Bugzilla is full of excellent ideas: https://issues.dlang.org/buglist.cgi?component=phobos_id=220544=D=--- There are even some tags like "bootcamp" for someone who is looking to get started:

Re: Calling Windows Command

2018-03-22 Thread rumbu via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 18:50:38 UTC, Vino wrote: Hi All, Request your help in calling the windows command to delete all file and folders recursively as the D function rmdirRecurse does not delete file in the permission of the file is readonly in windows 2008 R2 import std.process:

Template condition evaluation (shortcircuit)

2018-03-21 Thread rumbu via Digitalmars-d-learn
I tried to define a template: enum isFoo(alias T) = T.stringof.length >= 3 && T.stringof[0..3] == "abc"; int i; pragma(msg, isFoo!i); Error: string slice [0 .. 3] is out of bounds Error: template object.__equals cannot deduce function from argument types !()(string, string), candidates

Re: Slow start up time of runtime (correction: Windows real-time protection)

2018-03-20 Thread rumbu via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 16:56:59 UTC, Dennis wrote: On Tuesday, 20 March 2018 at 12:18:16 UTC, Adam D. Ruppe wrote: On Tuesday, 20 March 2018 at 09:44:41 UTC, Dennis wrote: I suspect you are seeing the Windows antivirus hitting you. D runtime starts up in a tiny fraction of a second, you

Re: Is there a way to pipeline program with random-access ranges in C#?

2018-03-19 Thread rumbu via Digitalmars-d-learn
On Monday, 19 March 2018 at 11:35:46 UTC, Dukc wrote: This topic is technically in wrong place, since the problem is with C#, not D. But because what I'm asking is more idiomatic in D than elsewhere, I think I have the best changes to get understood here. So, I'm looking for some library, or

Re: The D Language Foundation at Open Collective

2018-03-19 Thread rumbu via Digitalmars-d-announce
On Monday, 19 March 2018 at 07:22:42 UTC, Paolo Invernizzi wrote: On Thursday, 15 March 2018 at 12:36:24 UTC, Meta wrote: On Wednesday, 14 March 2018 at 12:00:42 UTC, Seb wrote: Yeah, the idea is that 5$ a month isn't much (~ one coffee in most countries), but if 500 people donate one coffee a

Re: OT: Behaviour of Experienced Programmers Towards Newcomers

2018-03-17 Thread rumbu via Digitalmars-d
On Saturday, 17 March 2018 at 06:46:17 UTC, Uknown wrote: I haven't really noticed any of what he mentions in the D community 3 days ago: https://forum.dlang.org/post/ylngefsfuwqodaprw...@forum.dlang.org

Re: Vision document for H1 2018

2018-03-16 Thread rumbu via Digitalmars-d-announce
On Friday, 16 March 2018 at 15:04:21 UTC, Kagamin wrote: On Thursday, 15 March 2018 at 16:03:14 UTC, rumbu wrote: Are you sure that you are talking about phobos and not tango? :) I'm eager to find how I'm uninformed. Tango doesn't use UFCS, while phobos and .net framework are big on

Re: Vision document for H1 2018

2018-03-15 Thread rumbu via Digitalmars-d-announce
On Thursday, 15 March 2018 at 21:10:47 UTC, flamencofantasy wrote: On Wednesday, 14 March 2018 at 05:22:53 UTC, rumbu wrote: I doubt that this was the blocker because C# had ArraySegment since .net framework 2.0 (2006), which is exactly a slice, but doesn't have the syntactic sugar for it.

Re: Vision document for H1 2018

2018-03-15 Thread rumbu via Digitalmars-d-announce
On Thursday, 15 March 2018 at 17:17:47 UTC, Dukc wrote: On Sunday, 11 March 2018 at 07:59:53 UTC, rumbu wrote: My opinion is that the day when C# will compile to native (on any platform), the C# developer interest in D will drop instantly. I do write a commerical project in C#. But I have an

Re: signbit question

2018-03-15 Thread rumbu via Digitalmars-d-learn
On Thursday, 15 March 2018 at 17:18:08 UTC, Miguel L wrote: On Thursday, 15 March 2018 at 16:31:56 UTC, Stefan Koch wrote: On Thursday, 15 March 2018 at 15:28:16 UTC, Miguel L wrote: Why does std.math.signbit only work for floating point types? Is there an analogue function for integer types?

Re: Vision document for H1 2018

2018-03-15 Thread rumbu via Digitalmars-d-announce
On Thursday, 15 March 2018 at 12:23:19 UTC, Kagamin wrote: No, FWIW phobos uses more or less the same programming solutions as .net framework, the claim that they are different is an uninformed opinion. Are you sure that you are talking about phobos and not tango? :) I'm eager to find how

Re: Proposal for a standard Decimal type in alpha

2018-03-14 Thread rumbu via Digitalmars-d-announce
On Wednesday, 14 March 2018 at 15:18:18 UTC, Jordi Gutiérrez Hermoso wrote: On Wednesday, 14 March 2018 at 14:57:12 UTC, rumbu wrote: For 20 decimal digits, you can use decimal128 (having a 34 decimal digits precision) and set the context precision to 20.

Re: Proposal for a standard Decimal type in alpha

2018-03-14 Thread rumbu via Digitalmars-d-announce
On Wednesday, 14 March 2018 at 14:41:21 UTC, Jordi Gutiérrez Hermoso wrote: On Wednesday, 14 March 2018 at 14:29:48 UTC, Seb wrote: https://forum.dlang.org/thread/mutegviphsjwqzqfo...@forum.dlang.org?page=1 While certainly impressive and feature-complete, rumbu's isn't a bigdecimal library.

Re: Vision document for H1 2018

2018-03-13 Thread rumbu via Digitalmars-d-announce
On Tuesday, 13 March 2018 at 23:20:22 UTC, Nick Sabalausky (Abscissa) wrote: On 03/11/2018 11:31 PM, Laeeth Isharc wrote: C# slices look great. I wonder if that might open the door for D on the CLR. I know that was attempted once a long way back, but was deemed infeasible and abandoned.

Are there any working instructions about how to build and test dmd on Windows?

2018-03-13 Thread rumbu via Digitalmars-d-learn
I know that there are contributing guides but I fail to successfully follow any of them: https://wiki.dlang.org/Starting_as_a_Contributor 1. Bash install script will not run under Windows. Using git bash will result in error (Command error: undefined switch '-C') 2. Digger it's not compiling

Re: How to simplify nested ifs

2018-03-13 Thread rumbu via Digitalmars-d-learn
On Tuesday, 13 March 2018 at 12:23:06 UTC, Ozan Süel wrote: Hi I have a construction like the following if (source) { if (source.pool) { if (source.pool.repository) { if (source.pool.repository.directory) { if (source.pool.repository.directory.users) { // do

Re: Vision document for H1 2018

2018-03-12 Thread rumbu via Digitalmars-d-announce
On Monday, 12 March 2018 at 04:48:43 UTC, psychoticRabbit wrote: but I think comparing things in the C# world, to things in the D world, does not make a lot of sense, really. It's like comparing my local corner shop to some worldwide supermarket chain. I'm comparing two open source

Re: Vision document for H1 2018

2018-03-11 Thread rumbu via Digitalmars-d-announce
On Monday, 12 March 2018 at 03:11:34 UTC, Laeeth Isharc wrote: You don't need to have subsystem for Linux to use bash. Just the standard git client for Windows is enough. Happy to find out about this. It's not like using git bash everyday on Windows to know this by default. sh setup.sh

Re: Vision document for H1 2018

2018-03-11 Thread rumbu via Digitalmars-d-announce
On Monday, 12 March 2018 at 03:37:11 UTC, Laeeth Isharc wrote: cd test make all -j8 Command error: undefined switch '-j8' Why are you adding -j8 ? Does it say to do so in the instructions ? Try without it. (I can't test here as typing from my phone).

Re: Vision document for H1 2018

2018-03-11 Thread rumbu via Digitalmars-d-announce
On Sunday, 11 March 2018 at 17:15:28 UTC, Seb wrote: I assume you are using Windows? Yes, I'm the typical lazy convenient Windows user scared of the terminal window. Setup on Posix is really simple. git clone all three repos + run make. I am happy for Posix users. Theoretically the

Re: Vision document for H1 2018

2018-03-11 Thread rumbu via Digitalmars-d-announce
On Sunday, 11 March 2018 at 14:37:28 UTC, bachmeier wrote: And this clarifies the source of your confusion. The D programming language is an open source project, not a for-profit company. D is not the language you're looking for. There are 3 years since C# is also open source project. Last

  1   2   3   4   >