Re: Vision document for H1 2018
On Friday, March 16, 2018 21:37:44 Void-995 via Digitalmars-d-announce wrote: > Every time I'm thinking that something is impossible to be > elegantly and/or easily done even in D - someone proves me wrong. > > And common, I just had that little spark of motivation to look > into DMD, what is my purpose in life now? Fan it into flames and go learn it so that you can fix or improve other stuff that might come up? ;) Of course, depending on what you know and are interested in, doing stuff like writing useful libraries and putting them up on code.dlang.org can be of huge benefit even if you never do anything for dmd, druntime, or Phobos. In some ways, that's probably our biggest need. But regardless, if you're interested in helping out the D ecosystem, there are plenty of options. - Jonathan M Davis
Re: Vision document for H1 2018
On Friday, 16 March 2018 at 15:58:25 UTC, Steven Schveighoffer wrote: On 3/12/18 10:57 AM, Void-995 wrote: On Monday, 12 March 2018 at 10:38:57 UTC, bachmeier wrote: On Monday, 12 March 2018 at 05:02:31 UTC, Jonathan M Davis wrote: Now, I actually understand ranges and am very glad that they're there, but as a D newbie, they were annoying, because they were unfamiliar. Ranges are D's monads. The only thing missing is the burrito tutorials. I always thought the best spice in D is UFCS. If only there would be one for local symbols (but that needs either foundation's decision or I need to write my first DIP and do something instead of just crying silently into my sleeve). alias I(alias X) = X; void main() { int y = 5; int bar(int x) { return y * x; } // auto z = 6.bar; // error auto z = 6.I!bar; // OK } https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/ -Steve Every time I'm thinking that something is impossible to be elegantly and/or easily done even in D - someone proves me wrong. And common, I just had that little spark of motivation to look into DMD, what is my purpose in life now?
Re: Vision document for H1 2018
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 extension methods. Also tango uses object oriented console IO, while phobos and .net framework use procedural style for it. Do you know anything else in the .net library than LINQ where extension methods (somehow equivalent to UFCS) are abused? I thought that something happened in the .net world while I was asleep, that's why I just searched my local copy of .net core and there are exactly 198 extension methods. I would not call these "big". The Tango remark was just a pun (R.I.P.), since it looked 90% similar to .net. And what would make Tango unusable with UFCS? Is it not written in D? Last time I checked, .net Console was an enormous static class with three Stream objects behind the scenes. When I said that phobos looks like a mess compared to .net lib I referred especially to the poor choice of names (eg. RedBlackTree vs SortedDictionary) and lack of essential stuff (eg. happy to have levenshteinDistance built in, but I cannot sort correctly two strings in any other language than English).
Re: Vision document for H1 2018
On Friday, 16 March 2018 at 18:35:14 UTC, Tony wrote: I thought C# was like Java and does not allow free procedures. Can you give an example of C# procedural-style IO? Well, this is not IO, but: public struct DivInt { public int quot; public int rem; } public static class Utility { public static DivInt Div(this int dividee, int divisor) { int quot; int rem; quot = Math.DivRem(dividee, divisor, out rem); //always round down if(rem < 0) { quot--; rem += divisor; } return new DivInt{quot = quot, rem = rem}; } } Could be used in some way like: int quotient; int remainder; if (true) { var divResult = (x + y).Div(ASlowFunction()); quotient = divResult.quot; remainder = divResult.rem; } If you say it sucks that one has to declare an utility class just to be nominally object-oriented, I agree.
Re: User Stories: Funkwerk
On Wednesday, 14 March 2018 at 14:17:50 UTC, Mike Parker wrote: foreach(auto element: elements) ":" is C++ syntax
Re: Ecoji-d v1.0.0 is released - Base1024 using emojis ππ
On 15/03/2018 19:45, Anton Fediushin wrote: $ dd if=test.raw | ./ecoji-d | gzip -c | wc -c 67108864 bytes (67 MB, 64 MiB) copied, 27.9972 s, 2.4 MB/s 32178275 # 48% improvement If you can compress random data to 52% of the original data, you should repeat this step until there is a single byte left.
Re: Vision document for H1 2018
On 03/16/2018 02:35 PM, Tony wrote: 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 extension methods. Also tango uses object oriented console IO, while phobos and .net framework use procedural style for it. I thought C# was like Java and does not allow free procedures. Can you give an example of C# procedural-style IO? It doesn't (last I used it), buy you CAN mark individual member functions to be usable UFCS-like. IIRC, I think it might have to be static member function. It's been awhile, so I don't remember it exactly, but it's something like this: class Bar {} class Foo { static void SomeFunc(extention Bar bar, int num) {...} } class MyApp { static void Run() { Bar bar = new Bar(); bar.SomeFunc(2); } }
Re: Vision document for H1 2018
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 extension methods. Also tango uses object oriented console IO, while phobos and .net framework use procedural style for it. I thought C# was like Java and does not allow free procedures. Can you give an example of C# procedural-style IO?
Re: Vision document for H1 2018
On Thursday, 15 March 2018 at 10:48:45 UTC, Radu wrote: You have to remember that the really big first client of betterC(++) was DMD, porting DMD from C++ was a big undertaking. Right now both DMD and LDC use a form of betterC, so it is critical to have it finalized. This is entirely wrong. DMD and LDC rely extern(C++), but this has nothing to do with -betterC whatsoever. Both compilers link and initialise the runtime as normal (and then disable the GC at runtime). β David
Re: Vision document for H1 2018
On 3/12/18 10:57 AM, Void-995 wrote: On Monday, 12 March 2018 at 10:38:57 UTC, bachmeier wrote: On Monday, 12 March 2018 at 05:02:31 UTC, Jonathan M Davis wrote: Now, I actually understand ranges and am very glad that they're there, but as a D newbie, they were annoying, because they were unfamiliar. Ranges are D's monads. The only thing missing is the burrito tutorials. I always thought the best spice in D is UFCS. If only there would be one for local symbols (but that needs either foundation's decision or I need to write my first DIP and do something instead of just crying silently into my sleeve). alias I(alias X) = X; void main() { int y = 5; int bar(int x) { return y * x; } // auto z = 6.bar; // error auto z = 6.I!bar; // OK } https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/ -Steve
Re: Vision document for H1 2018
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 extension methods. Also tango uses object oriented console IO, while phobos and .net framework use procedural style for it.
Re: Vision document for H1 2018
On Friday, 16 March 2018 at 07:58:33 UTC, Dmitry Olshansky wrote: Playing captain the obvious but this is COPY not slice. Shh. Don't tell my customers that. D had slices since 2000s, pointing to any kind of memory. Mmm..D showing off.. as always ;-)
Re: Vision document for H1 2018
On 3/15/2018 3:48 AM, Radu wrote: Lastly, the objective is a bit vague - there is no scope attached to it, maybe this needs clarifications. Even if it means fixing all the logged bugs related to it, it is a great step, at least for me. For reference, here are all the betterC bugs: https://issues.dlang.org/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&keywords=betterC%2C%20&keywords_type=allwords&list_id=220294&query_format=advanced If there are any betterC bugs filed in Bugzilla and not listed there, please tak them with the "betterC" keyword so they will be. Any unfiled bugs => file them, of course!
Re: Ecoji-d v1.0.0 is released - Base1024 using emojis ππ
On Thursday, 15 March 2018 at 18:45:51 UTC, Anton Fediushin wrote: On Thursday, 15 March 2018 at 09:32:50 UTC, bauss wrote: Fun, but seems pretty useless in practice. I disagree. Ecoji (base1024) has bigger character set meaning that it can encode more information per emoji than base64 can encode per character. For example ecoji encoded "abcde" looks like this: "ππΈπ¦π" And base64 encoded one looks like this: "YWJjZGU=". Even though each emoji is 4 bytes long, there is a noticable difference in size when we are talking about larger chunks of data: --- $ dd if=/dev/urandom bs=4K count=16K of=test.raw 16384+0 records in 16384+0 records out 67108864 bytes (67 MB, 64 MiB) copied, 1.90423 s, 35.2 MB/s $ dd if=test.raw | ./ecoji-d | wc -c 67108864 bytes (67 MB, 64 MiB) copied, 6.7699 s, 9.9 MB/s 71591534 # Size increased just by 6% $ dd if=test.raw | base64 | wc -c 67108864 bytes (67 MB, 64 MiB) copied, 0.750174 s, 89.5 MB/s 90655837 # 35%(!) increase in size --- And if we move to real word scenarios, where web pages are gzip'ped most of the time: --- $ dd if=test.raw | gzip -c | wc -c 67108864 bytes (67 MB, 64 MiB) copied, 5.49022 s, 12.2 MB/s 67119122 # Raw files are terrible for compression $ dd if=test.raw | ./ecoji-d | gzip -c | wc -c 67108864 bytes (67 MB, 64 MiB) copied, 27.9972 s, 2.4 MB/s 32178275 # 48% improvement $ dd if=test.raw | base64 | gzip -c | wc -c 67108864 bytes (67 MB, 64 MiB) copied, 10.3381 s, 6.5 MB/s 68892893 # Pretty bad, yeah --- So yeah, ecoji is better than base64 in everything but speed. Speed will be improved. Later. If your care about size of data then you're not going to encode anyway. Same goes for speed. Besides your encoding isn't going to work with actual web-pages anyway, because your encoder doesn't have browser support. Sure you can encode your data and gzip it, but once it reaches the browser and it unzips it, then what? The browser doesn't know what to do with the data. You can't even use base64 for http headers. At most it could be used for email clients, since they do support "Content-Transfer-Encoding" but browsers don't. They only support "Content-Encoding" which at most can be compressions such as gzip.
Re: Vision document for H1 2018
On Friday, 16 March 2018 at 01:45:57 UTC, psychoticRabbit wrote: On Thursday, 15 March 2018 at 18:39:08 public static class Utils { public static T[] Slice(this T[] arr, int start, int len) { T[] slice = new T[len]; Array.Copy(arr, start, slice, 0, len); return slice; } } Playing captain the obvious but this is COPY not slice. Slices in D share underlying array, something that C# recently recognized as special Span class that may point to GC heap or off-heap memory. D had slices since 2000s, pointing to any kind of memory.