Re: Passing $ as a function argument

2018-10-10 Thread crimaniak via Digitalmars-d
On Wednesday, 10 October 2018 at 23:04:46 UTC, James Japherson wrote: The whole point is not to use $ as an identifier but to specify to the compiler of that it can rewrite it. It's called 'alias'. // compile time int foo(alias index)(int[] a) { return a[index(a.length)]; } // run t

Re: D mentioned in Infoworld

2018-03-26 Thread crimaniak via Digitalmars-d
On Monday, 26 March 2018 at 15:52:11 UTC, Jean-Louis Leroy wrote: https://www.infoworld.com/article/3263395/application-development/the-programming-languages-you-should-learn-now.html Looks like R advertising.

Re: A pattern I'd like to see more of - Parsing template parameter tuples

2018-05-21 Thread crimaniak via Digitalmars-d
On Monday, 21 May 2018 at 07:10:34 UTC, rikki cattermole wrote: alias DocumentType = SomeDocument!( ObjectVersion._1_0, ObjectEncoding.PlainASCII ); alias DocumentType2 = SomeDocument!( ObjectEncoding.UTF8, ObjectVersion._2_0 ); typedef basic_stringstring; typedef basic_string wstring;

Re: Parenthesis around if/for/while condition is not necessary

2018-06-23 Thread crimaniak via Digitalmars-d
On Saturday, 23 June 2018 at 09:19:45 UTC, user1234 wrote: ...Forcing Curly braces is nice, logic and natural imo. The operator brackets themselves are a separate construction. In addition, the more structured the code, the less they are needed. In my code, most of the loops and branches con

Re: Compilation is taking a ton of memory

2018-06-28 Thread crimaniak via Digitalmars-d
On Wednesday, 27 June 2018 at 16:00:37 UTC, Mario Silva wrote: Hello, Our code base has been growing steadily and it's currently at a point where my 16GB machine just freezes when we're compiling our code. This happens because DMD just consumes all my memory for a while. Also, it's taking a

Re: Compilation is taking a ton of memory

2018-06-28 Thread crimaniak via Digitalmars-d
On Thursday, 28 June 2018 at 16:24:07 UTC, H. S. Teoh wrote: On Thu, Jun 28, 2018 at 04:11:57PM +, crimaniak via Digitalmars-d wrote: [...] The problem is aggravated by the fact that DUB compiles all the sources in one DMD launch. Doesn't dub have an option to compile packages

Re: Sutter's ISO C++ Trip Report - The best compliment is when someone else steals your ideas....

2018-07-11 Thread crimaniak via Digitalmars-d
On Tuesday, 10 July 2018 at 22:59:08 UTC, Jonathan M Davis wrote: Or aside from that strawman that RangeError shouldn't be an Error even... I suspect that we're going to have to agree to disagree on that one. ... ... continuing to execute the program is risky by definition. ... This error ha

Re: Sutter's ISO C++ Trip Report - The best compliment is when someone else steals your ideas....

2018-07-11 Thread crimaniak via Digitalmars-d
On Wednesday, 11 July 2018 at 18:27:33 UTC, Brad Roberts wrote: ... application exiting asserts in production.  Yes, you kill the app.  You exit as fast and often as the errors occur.  You know what happens?  You find the bugs faster, you fix them even faster, and the result is solid software.

Re: Sutter's ISO C++ Trip Report - The best compliment is when someone else steals your ideas....

2018-07-11 Thread crimaniak via Digitalmars-d
On Wednesday, 11 July 2018 at 13:19:01 UTC, Joakim wrote: ... Sounds like you're describing the "Let it crash" philosophy of Erlang: https://ferd.ca/the-zen-of-erlang.html I never program Erlang, but I think yes, something like this. The people who developed Erlang definitely have a lot of

Re: Need some vibe.d hosting advice

2017-08-11 Thread crimaniak via Digitalmars-d
On Friday, 11 August 2017 at 13:06:54 UTC, aberba wrote: So I'm into this platform with a vibe.d api server + back-end and I'm confused/curious to know the hosting package to use. I will have a lot of images uploaded by users. 2. Get an EC2 instance from Amazon or Vultr and install everything

Re: Templates, D way

2017-09-05 Thread crimaniak via Digitalmars-d
On Tuesday, 5 September 2017 at 11:08:57 UTC, Void-995 wrote: @property mixin(DataList!("firstSublist", MyBinarySubStructAForA, firstSublistMembersCount, firstSublistMembersOffset)); I don't think string mixins are required here. It seems just template is more simple. T[] getBytesAs(T, alia

Re: Templates, D way

2017-09-05 Thread crimaniak via Digitalmars-d
On Tuesday, 5 September 2017 at 12:41:45 UTC, Computermatronic wrote: I find it very strange that this works, ... I'm too. :) In any case, it's not a big deal. It's possible to modify this template to transfer `this` as the first parameter and modify its usage accordingly.

Re: Templates, D way

2017-09-05 Thread crimaniak via Digitalmars-d
On Tuesday, 5 September 2017 at 12:54:20 UTC, Void-995 wrote: Thanks, that definitely working and doesn't require mixin with strings. But while waiting for response I've tried another thing, and I doubt I would able do to that without string now: ... int %sCount;

Re: Templates, D way

2017-09-05 Thread crimaniak via Digitalmars-d
On Tuesday, 5 September 2017 at 14:43:19 UTC, John Colvin wrote: On Tuesday, 5 September 2017 at 12:41:45 UTC, Computermatronic wrote: On Tuesday, 5 September 2017 at 12:20:14 UTC, crimaniak wrote: [...] I find it very strange that this works, as a non-mixin template should not be able to ca

Re: Templates, D way

2017-09-05 Thread crimaniak via Digitalmars-d
On Tuesday, 5 September 2017 at 14:55:21 UTC, Void-995 wrote: Using unions? Count and Offset are different depending on input data, so the address where they are is varying depending on which file I've loaded. Or I didn't get what you meant. Yes, so you need separate union type for every type

Re: Templates, D way

2017-09-06 Thread crimaniak via Digitalmars-d
On Tuesday, 5 September 2017 at 22:51:45 UTC, Void-995 wrote: The whole thing is that I don't know either padding nor elements count. Those values are read from file. ... Sorry, I was not attentive enough. Yes, you can't use unions in this case.

Re: Why Physicists Still Use Fortran

2017-10-17 Thread crimaniak via Digitalmars-d
On Sunday, 15 October 2017 at 22:09:21 UTC, Walter Bright wrote: http://moreisdifferent.com/2015/07/16/why-physicsts-still-use-fortran/ Some good information there! Especially comments: George Michaelson • a day ago One of the saddest moments of my career in computer centre helpdesk was talk

Re: Project Elvis

2017-10-30 Thread crimaniak via Digitalmars-d
On Monday, 30 October 2017 at 15:04:32 UTC, Steven Schveighoffer wrote: https://issues.dlang.org/show_bug.cgi?id=13489 ... I'm in the camp that nan should be evaluated as false. I don't think I like the idea that !nan is also false, because this makes !!nan true! The problem of converting

Re: String import an entire directory

2017-11-12 Thread crimaniak via Digitalmars-d
On Saturday, 11 November 2017 at 14:11:50 UTC, Neia Neutuladh wrote: I can make a prebuild script to generate code for this, but I'm wondering: do other people find themselves needing this periodically? If so, I can write a DIP for it, or at least publish a codegen tool that other people can us

Re: Answers needed from those using D for Web Development, Web APIs and Services

2017-12-18 Thread crimaniak via Digitalmars-d
On Friday, 15 December 2017 at 08:13:25 UTC, aberba wrote: I'm going to do a writeup on the state of D in Web Development, APIs and Services for 2017. I need the perspective of the community too along with my personal experience. Please help out. More details the better. I think some questions

Re: Answers needed from those using D for Web Development, Web APIs and Services

2017-12-21 Thread crimaniak via Digitalmars-d
On Thursday, 21 December 2017 at 19:58:44 UTC, WebFreak001 wrote: yes, I can see each response and export them to csv. I wanted I think if you can make csv with only answers related to WEB development it will be data relevant to what aberba wants. to make a summary of the results but I don't

dip1000 info web address

2017-12-21 Thread crimaniak via Digitalmars-d
Hi all! There is a string in DMD help message: -dip1000 implement http://wiki.dlang.org/DIP1000 (experimental) But in fact page http://wiki.dlang.org/DIP1000 is empty, and DIP100 information resides at the address https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md Wrote it

Re: dip1000 info web address

2017-12-21 Thread crimaniak via Digitalmars-d
On Friday, 22 December 2017 at 04:15:14 UTC, Mike Franklin wrote: https://github.com/dlang/dmd/pull/7489 It was fast :)

Re: vibe.d Error only with Firefox

2018-01-06 Thread crimaniak via Digitalmars-d
On Friday, 5 January 2018 at 16:30:07 UTC, Martin Tschierschke wrote: ... Failed to listen on 127.0.0.1:8030 Failed to listen on 10.0.0.1:8030 ... The strange thing is now, that when using Chromium http://10.0.0.1:8030 works! But with Firefox http://10.0.0.1:8030 gives the long Error: 400 - B

Re: mysql user definde functions (UDF) in D

2017-01-13 Thread crimaniak via Digitalmars-d
On Thursday, 12 January 2017 at 09:49:08 UTC, Martin Tschierschke wrote: I am wondering has anybody tried to do it with D? http://dev.mysql.com/doc/refman/5.5/en/adding-udf.html By looking on the processing chain for rendering a web page, based on mysql data, I thought it would be very efficie

Re: mysql user definde functions (UDF) in D

2017-01-14 Thread crimaniak via Digitalmars-d
On Friday, 13 January 2017 at 12:30:51 UTC, Martin Tschierschke wrote: My thought was that the main benefit of using the DB engine to do the layout rendering, would be that you do not need to convert db values to serialized data, and than convert them to values before you convert them to stin

Re: Workaround for DIP 1005

2017-02-04 Thread crimaniak via Digitalmars-d
On Friday, 3 February 2017 at 21:23:22 UTC, Daniel Nielsen wrote: I just had to try one more thing. It never ceases to amaze me what is possible in D today. Yes, all except of good IDE and tooling. template imp(string mod) { mixin("import imp = " ~ mod ~ ";"); } ... because of string mixin

Re: Automatic imports?

2017-02-04 Thread crimaniak via Digitalmars-d
On Saturday, 4 February 2017 at 00:43:14 UTC, Walter Bright wrote: On 2/3/2017 4:01 PM, Ali Çehreli wrote: void foo(std.datetime.Duration dur) { // ... } Can the compiler automatically import std.datetime for both the implementation above and the user? Or, too much beer at work on this Fri

Re: Workaround for DIP 1005

2017-02-04 Thread crimaniak via Digitalmars-d
On Saturday, 4 February 2017 at 11:56:52 UTC, Stefan Koch wrote: please refrain from insulting string-mixins. they are by far the most understandable of meta-programming facilities. Most understandable don't mean "good to use". We can do many things with it but it's really hack and easy way t

Re: Proposal: Exceptions and @nogc

2017-04-02 Thread crimaniak via Digitalmars-d
On Sunday, 2 April 2017 at 05:16:23 UTC, Walter Bright wrote: Using a ref counted solution brings with it a host of problems because the compiler is not set up to ref count class object references, nor is any existing code set up to deal with that. Please describe in more detail the problems in

Re: CTFE Status 2

2017-04-08 Thread crimaniak via Digitalmars-d
Hi! Is it hard to implement some way to access symbol from UDA constructor of symbol? ``` class uda { this() { // Iterate by Foo members foreach (member; __traits(allMembers, __SYMBOL__)) ... } } @uda struct Foo { } ```

Re: CTFE Status 2

2017-04-08 Thread crimaniak via Digitalmars-d
On Saturday, 8 April 2017 at 09:14:17 UTC, Stefan Koch wrote: This is a question for D.Learn. please post there. Yes, I did it already and know, it is not possible for now: https://forum.dlang.org/post/crkxlbtfhsplxfila...@forum.dlang.org This is exact reason why I asked, how hard _to implemen

Re: CTFE Status 2

2017-04-09 Thread crimaniak via Digitalmars-d
On Sunday, 9 April 2017 at 00:25:45 UTC, Stefan Koch wrote: ... I assume that what you want will quite expensive in terms of compiler performance. ... Thanks for your answer!

Re: Dlang forum: some feature requests

2017-04-10 Thread crimaniak via Digitalmars-d
On Sunday, 9 April 2017 at 12:58:30 UTC, Vladimir Panteleev wrote: _Someone_ should write Markdown rendering plugins for popular news readers. What mime type will the Markdown enhanced messages use? text/plain or text/markdown as per https://de.wikipedia.org/wiki/Markdown ? text/plain because

Re: Dlang Features You Would Like To Share

2017-04-13 Thread crimaniak via Digitalmars-d
On Thursday, 13 April 2017 at 05:51:27 UTC, Dukc wrote: auto use(alias F, T)(T t){return F(t);} void main() { import std.stdio; foreach(i; 1 .. 11) { foreach(j; 1 .. 11) write((i * j).use!(x => x*x), " "); writeln; } } This way, you can avoid writing long expressions twi

Re: Interpolated strings

2017-04-15 Thread crimaniak via Digitalmars-d
On Saturday, 15 April 2017 at 20:04:13 UTC, Jonas Drewsen wrote: The compiler will basically lower the $"..." string to a mixin that concatenates the expression parts of the (inside the {}) and the plain text parts. It's easy implementable as a library (see https://github.com/Abscissa/scriptlik

Re: Interpolated strings

2017-04-17 Thread crimaniak via Digitalmars-d
On Sunday, 16 April 2017 at 16:10:15 UTC, Nick Sabalausky (Abscissa) wrote: Yea, and note, I'm still open to the idea of better names than "interp". I'm still not entirely happy with that name. I'm even half-tempted to use "_". When I needed interpolation, I did not know about this library. So

Re: Default-valued nothrow @nogc std.conv:to

2017-04-23 Thread crimaniak via Digitalmars-d
On Saturday, 22 April 2017 at 12:14:26 UTC, Nordlöw wrote: Have anyone tried to implement a variant of `std.conv.to` that can be `nothrow @nogc` if the exception handling is replaced by an extra second parameter (`defaultValue`) returned iff the call to `to` throws? There is common ifThrown t

Re: Expressing range constraints in CNF form

2017-06-11 Thread crimaniak via Digitalmars-d
On Sunday, 11 June 2017 at 00:28:58 UTC, Andrei Alexandrescu wrote: enum bool isInputRange(R) = is(typeof((ref R r) => r)) && "must be copyable" Regardless of the implementation method, this will require the previously proposed Phobos refactoring. Independent special definitions have to b

Re: Isn't it about time for D3?

2017-06-13 Thread crimaniak via Digitalmars-d
On Tuesday, 13 June 2017 at 17:57:14 UTC, Patrick Schluter wrote: I haven't the impression that the *language* itself suffer from so big flaws that it would warrant to fork it in a way that will lead to a lot frustration and bewilderment. I have the same opinion. Raw libraries, poor documentat

Re: Checked vs unchecked exceptions

2017-06-26 Thread crimaniak via Digitalmars-d
On Sunday, 25 June 2017 at 17:38:14 UTC, mckoder wrote: I am disappointed that D doesn't have checked exceptions. Warning, Google translate is used! (sorry) I fully support mckoder with regard to exceptions. This is a great advantage of Java. I think, the problem with the introduction of ver

Re: Checked vs unchecked exceptions

2017-06-26 Thread crimaniak via Digitalmars-d
On Monday, 26 June 2017 at 19:31:53 UTC, Moritz Maxeiner wrote: And the good *way* to achieve this result would be the following: - When visiting `startFoo`, the compiler automatically aggregates all different exceptions it may throw and stores the resulting set - If `startFoo` is going to be

Re: Checked vs unchecked exceptions

2017-07-06 Thread crimaniak via Digitalmars-d
On Thursday, 6 July 2017 at 01:31:44 UTC, Moritz Maxeiner wrote: --- void foo() throws AException throws BException { ... } vod bar() { foo(); } --- works and bar's exception is inferred by the compiler to contain AException and BException. But to be clear (and the title and description of an

Re: proposed @noreturn attribute

2017-07-08 Thread crimaniak via Digitalmars-d
On Sunday, 9 July 2017 at 00:16:50 UTC, Walter Bright wrote: I assume there is a standard jargon for this - does anyone know Type Theory? I'm afraid it's perpendicular to type theory - every type including Nothing can be returned. Most simple solution - just to remove '@' and call this type 'no

Re: Safely extend the size of a malloced memory block after realloc

2015-08-18 Thread crimaniak via Digitalmars-d
On Tuesday, 18 August 2015 at 05:51:36 UTC, Benjamin Thaut wrote: I specifically asked for the case where the pointer doesn't change. Obvisouly the case where it does change is easy, you first add the new range and then remove the old one. But if you do this and the pointer didn't change, the

Re: IMAP library

2016-02-17 Thread crimaniak via Digitalmars-d
On Wednesday, 17 February 2016 at 09:01:18 UTC, Mengu wrote: hello everyone i have checked code.dlang.org and github but i have not encountered an IMAP library. .. https://github.com/Laeeth/d_etpan

Re: std.xml2 (collecting features)

2016-02-20 Thread crimaniak via Digitalmars-d
On Sunday, 3 May 2015 at 17:39:48 UTC, Robert burner Schadek wrote: Please post you feature requests... - the ability to read documents with missing or incorrectly specified encoding - additional feature: relaxed mode for reading html and broken XML documents Some time ago I worked for Ac

Re: std.xml2 (collecting features)

2016-02-21 Thread crimaniak via Digitalmars-d
On Saturday, 20 February 2016 at 19:16:47 UTC, Adam D. Ruppe wrote: On Saturday, 20 February 2016 at 19:08:25 UTC, crimaniak wrote: - the ability to read documents with missing or incorrectly specified encoding - additional feature: relaxed mode for reading html and broken XML documents fyi,

Re: std.xml2 (collecting features)

2016-02-25 Thread crimaniak via Digitalmars-d
On Sunday, 21 February 2016 at 23:57:40 UTC, Adam D. Ruppe wrote: On Sunday, 21 February 2016 at 23:01:22 UTC, crimaniak wrote: I will use it in my experiments, but getElementsBySelector() selector language need to be improved I think. What, specifically, do you have in mind? Where is only a

Re: [OT] Some neat ideas from the Kotlin language

2016-02-26 Thread crimaniak via Digitalmars-d
On my experience programming using Optional's functional interfaces is more reliable then explicit logic, so in case when we have value semantic and Optional then Kotlin's approach is not very useful. My old experiments about this (obviously java-inspired): optional.d import std.typecons; imp

Re: My whereabouts

2016-03-13 Thread crimaniak via Digitalmars-d
On Friday, 11 March 2016 at 08:25:12 UTC, Nordlöw wrote: On Thursday, 10 March 2016 at 15:25:54 UTC, Andrei Alexandrescu wrote: What ever happened to that Big O library you were writing? Does this mean the container-library? If so what does the "Big O" stand for? Thread related: https://fo

Re: emit: generalizes map, filter, joiner [proposal + implementation]

2016-03-23 Thread crimaniak via Digitalmars-d
On Monday, 21 March 2016 at 11:48:52 UTC, Seb wrote: On Monday, 21 March 2016 at 11:35:49 UTC, Timothee Cour wrote: assert(9.iota.emit!(int,(put,a){if(a%2) put(a*a);}).equal([1, 9, 25, 49])) I support idea to have such feature, sometimes it really need. Could you try to point out whats wrong

Re: Tristate - wanna?

2016-03-26 Thread crimaniak via Digitalmars-d
On Saturday, 26 March 2016 at 22:39:58 UTC, Alex Parrill wrote: ... If we're going down that route, might as well use state tables. ... For Boolean, Ternary, and N-state logic: a && b == min(a, b) a || b == max(a, b) ~a == N-1-a why to optimize it more?

Re: Tristate - wanna?

2016-03-27 Thread crimaniak via Digitalmars-d
On Sunday, 27 March 2016 at 02:36:47 UTC, Alex Parrill wrote: ... a && b == min(a, b) a || b == max(a, b) ~a == N-1-a why to optimize it more? That's incorrect for the `unknown` value. Lets say you represented true as 1f, false as 0f, and unknown as NaN... std.algorithm.max(0, 0f/0f) = 0,

Re: Areas of D usage

2016-06-16 Thread crimaniak via Digitalmars-d
On Wednesday, 15 June 2016 at 20:01:09 UTC, Seb wrote: ... The initial version is online now & please feel invited to improve upon this document: http://dlang.org/areas-of-d-usage.html As engineer I don't like gears in the 'Embedded applications' paragraph: they are not match.

Re: Is Anything Holding you back?

2015-10-02 Thread crimaniak via Digitalmars-d
Full-featured PDF library (with JBIG2 and Jpeg2000 support and so on...)

Re: Here's looking at you, kid

2015-11-20 Thread crimaniak via Digitalmars-d
Library reference is not very good too. In my previous try with D I even made a browser extension to show classes, functions, variables, etc. in 'jump to' section with different backgrounds. The reference should definitely be more fine grained and is equipped with user comments, which are extre

Re: Here's looking at you, kid

2015-11-20 Thread crimaniak via Digitalmars-d
On Friday, 20 November 2015 at 13:57:16 UTC, David DeWitt wrote: The "New Library Reference Preview" under Resources is much cleaner and has comments. I personally prefer the look of that resource. It isn's updated and is on 2.067.1. Don't works for me now, problem with http://dlang.org/libr

Re: Here's looking at you, kid

2015-11-26 Thread crimaniak via Digitalmars-d
On Monday, 23 November 2015 at 15:16:49 UTC, Sönke Ludwig wrote: Don't works for me now, problem with http://dlang.org/library/symbols.js both Chromium and Firefox. I couldn't reproduce this with either Chrome/Firefox/Opera on ... Could this be something local getting in the way, such as a

about visitors

2015-12-30 Thread crimaniak via Digitalmars-d
Most of the audience of the site can be roughly divided into two categories: beginners and experienced users of D. for beginners: Looking to this sketch I think it will be useful to add some simple installation instruction for detected user's OS right here (to appreciate the complexity of the D

Re: Evolutionary Programming!

2016-01-06 Thread crimaniak via Digitalmars-d
On Tuesday, 5 January 2016 at 20:11:10 UTC, Ola Fosheim Grøstad wrote: But I think the most powerful concept now is _software synthesis_. The basic idea being that you specify the constraints and let the computer write the actual code, or some variation over that. It's called Prolog. Subj

Re: New __FILE_DIR__ trait?

2016-07-27 Thread crimaniak via Digitalmars-d
On Wednesday, 27 July 2016 at 13:59:23 UTC, Jonathan Marler wrote: For others who may see this thread, the __FULL_FILE_PATH__ special trait was added to the dmd compiler with this PR: https://github.com/dlang/dmd/pull/5959 __DIR__ will be useful, I think. Just directory name, without file na

Re: Self Optimizing Code

2016-08-04 Thread crimaniak via Digitalmars-d
On Tuesday, 2 August 2016 at 22:06:38 UTC, Mark "J" Twain wrote: Instead, a better solution would be to use variables: if (n*length > m*capacity) expand(l*length) Some time ago I played with self-optimizing cache layer. Problem: Time to obtain cache items is unknown and server dependant. For

Re: DIP 1002 (TryElseExpression) added to the queue

2016-09-30 Thread crimaniak via Digitalmars-d
On Thursday, 29 September 2016 at 10:51:01 UTC, Nick Treleaven wrote: Assuming for a minute that we want some form of DIP1002, we might be able to extend the `try` scope in an interesting way: try { auto f = foo(); } catch (Exception) { ... } finally (bool ok) { // true if no exception