Re: Good repos to learn D

2020-09-19 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Sep 19, 2020 at 08:26:36AM +, Imperatorn via Digitalmars-d-learn wrote: > What are some good examples of pretty large/medium size, good > structured repos in D? I'm looking for examples to learn from [...] Phobos itself. I have to say, it's the most readable programming language

Re: create and initialise array

2020-09-19 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 19 September 2020 at 21:53:34 UTC, mw wrote: On Thursday, 20 June 2019 at 07:57:25 UTC, KnightMare wrote: imo NaN is useless, weird and unusual coz integrals and pointers are "all bits zeroes" but float and chars are "all bits ones". WTF? its strange that bool.init is false in

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 20 September 2020 at 01:51:22 UTC, wjoe wrote: Would even be more awesome if it provided a function which could be called from a custom main on top of the FancyMain. I find e.g. custom parsing of command line arguments incredibly useful. Yea, the version 2.0 stuff inside cgi.d does

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread wjoe via Digitalmars-d-learn
On Sunday, 20 September 2020 at 00:36:30 UTC, Adam D. Ruppe wrote: [...] That's it - all the html and javascript are all auto-generated. Amazing :) Would even be more awesome if it provided a function which could be called from a custom main on top of the FancyMain. I find e.g. custom

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread wjoe via Digitalmars-d-learn
On Saturday, 19 September 2020 at 20:17:06 UTC, aberba wrote: I personally (and many others in the industry... judging by popularity of express (node.js) and the plentiful third-party libraries,..do prefer the router.get() design. Also having everything abstracted in a convenient and

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread wjoe via Digitalmars-d-learn
On Saturday, 19 September 2020 at 19:27:40 UTC, Steven Schveighoffer wrote: [...] This used to be the expected way to set up vibe (using module constructors). And vibe would provide its own main function. I *think* the idea was to allow registration of different handlers in their respective

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 19 September 2020 at 20:17:06 UTC, aberba wrote: Arsd cgi.d might be what you want if you want to it your way as its more low-level interface-wise. Eh, it depends. My lib lets you do as much or as little as you want. About ten years ago, I wrote a framework on top that

Re: Building LDC runtime for a microcontroller

2020-09-19 Thread IGotD- via Digitalmars-d-learn
On Friday, 18 September 2020 at 07:44:50 UTC, Dylan Graham wrote: I use D in an automotive environment (it controls parts of the powertrain, so yeah there are cars running around on D) on various types of ARM Cortex M CPUs, I think this will be the best way to extend D to those platforms.

Re: create and initialise array

2020-09-19 Thread mw via Digitalmars-d-learn
On Thursday, 20 June 2019 at 07:57:25 UTC, KnightMare wrote: On Thursday, 20 June 2019 at 01:32:04 UTC, matheus wrote: import std.stdio; import std.array; void main(){ auto s = uninitializedArray!(float[])(100); s[] = 0.0f; writeln(s[0]); } Even with this, user has to write two

Re: Building LDC runtime for a microcontroller

2020-09-19 Thread aberba via Digitalmars-d-learn
On Friday, 18 September 2020 at 07:44:50 UTC, Dylan Graham wrote: On Monday, 7 September 2020 at 19:12:59 UTC, aberba wrote: [...] I use D in an automotive environment (it controls parts of the powertrain, so yeah there are cars running around on D) on various types of ARM Cortex M CPUs, I

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread aberba via Digitalmars-d-learn
On Saturday, 19 September 2020 at 20:17:06 UTC, aberba wrote: On Friday, 18 September 2020 at 22:31:09 UTC, mw wrote: On Friday, 18 September 2020 at 00:07:12 UTC, wjoe wrote: Are there other frameworks besides vibe that can do what I want? Personally I use vibe.d for basic side projects.

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread aberba via Digitalmars-d-learn
On Friday, 18 September 2020 at 22:31:09 UTC, mw wrote: On Friday, 18 September 2020 at 00:07:12 UTC, wjoe wrote: Are there other frameworks besides vibe that can do what I want? Just FYI, there is also: https://code.dlang.org/packages/hunt-framework I never used myself, you need to

Re: Escape this in pure members

2020-09-19 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 19 September 2020 at 18:48:31 UTC, Jacob Carlborg wrote: A nested class seems to be able to escape the `this` reference: Ahh, thanks. I just realized that it can escape into other parameters without the `scope` qualifier? This class Bar { void bar(scope Bar b) @safe pure

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread ikod via Digitalmars-d-learn
On Saturday, 19 September 2020 at 18:56:20 UTC, Steven Schveighoffer wrote: On 9/19/20 7:15 AM, ikod wrote: On Saturday, 19 September 2020 at 11:11:21 UTC, ikod wrote: On Friday, 18 September 2020 at 13:13:16 UTC, wjoe wrote: My preferable way to handle such thing is: convert incoming data

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/19/20 3:36 PM, IGotD- wrote: On Saturday, 19 September 2020 at 19:27:40 UTC, Steven Schveighoffer wrote: I used Kai's book, and yeah, you have to do things the vibe way. But most web frameworks are that way I think. Do you have a reference to this book (web link, ISBN)? Sure:

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread IGotD- via Digitalmars-d-learn
On Saturday, 19 September 2020 at 19:27:40 UTC, Steven Schveighoffer wrote: I used Kai's book, and yeah, you have to do things the vibe way. But most web frameworks are that way I think. Do you have a reference to this book (web link, ISBN)?

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/19/20 6:59 AM, wjoe wrote: Handling file uploads is one example, another is command line arguments. The presumption here is there is vibe and there can only be vibe. It takes them from Runtime.args. Duh? This didn't make sense to me until I saw example where the initialization of vibe was

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/19/20 7:15 AM, ikod wrote: On Saturday, 19 September 2020 at 11:11:21 UTC, ikod wrote: On Friday, 18 September 2020 at 13:13:16 UTC, wjoe wrote: On Friday, 18 September 2020 at 12:58:29 UTC, Steven Schveighoffer wrote: On 9/18/20 8:39 AM, Steven Schveighoffer wrote: But again, solved

Re: Question about linker errors when using slices

2020-09-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/18/20 10:45 PM, tspike wrote: If you only compile platform.d, the linker will complain about “undefined references.” This is true when using dmd and gdc, though platform.d compiles just fine when using ldc. But the file only fails to compile when the “items” member of AppData is a slice;

Re: Escape this in pure members

2020-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-09-19 18:07, Per Nordlöw wrote: If an aggregate member is pure but not scope when can it escape the `this` pointer?. Only via return? I'm not sure if returning the `this` pointer is considered escaping it. The caller already had access to it. Under the hood, the `this` pointer is

Re: Vibe.d

2020-09-19 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:31:35 UTC, Jack wrote: On Saturday, 19 September 2020 at 13:13:56 UTC, Jack wrote: Hi, I am building a webapp using vibe.d which is working well on macOS and Linux. However, when I run it on windows I get: Program exited with code -1073741701 I created a

Re: Vibe.d

2020-09-19 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 19 September 2020 at 17:57:09 UTC, Andre Pany wrote: On Saturday, 19 September 2020 at 13:31:35 UTC, Jack wrote: On Saturday, 19 September 2020 at 13:13:56 UTC, Jack wrote: Hi, I am building a webapp using vibe.d which is working well on macOS and Linux. However, when I run it

Re: Building LDC runtime for a microcontroller

2020-09-19 Thread Imperatorn via Digitalmars-d-learn
On Monday, 7 September 2020 at 22:13:20 UTC, Adam D. Ruppe wrote: On Monday, 7 September 2020 at 20:55:54 UTC, IGotD- wrote: [...] Well, -betterC existed even then, but it was *completely* useless. It didn't become useful until 2016 or 2017. [...] Cool!

Re: Vibe.d

2020-09-19 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:13:56 UTC, Jack wrote: Hi, I am building a webapp using vibe.d which is working well on macOS and Linux. However, when I run it on windows I get: Program exited with code -1073741701 I created a new default project with: dub init test -t vibe.d and get

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Kagamin via Digitalmars-d-learn
if(GetFileType(GetStdHandle(STD_OUTPUT_HANDLE))==FILE_TYPE_PIPE)setvbuf()

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Kagamin via Digitalmars-d-learn
That said, full buffering for pipes may be not all that profitable, so it makes sense to always set line buffering for pipes and leave full buffering only for file.

Re: Escape this in pure members

2020-09-19 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 19 September 2020 at 16:07:24 UTC, Per Nordlöw wrote: If an aggregate member is pure but not scope when can it escape the `this` pointer?. Or rather when and, if so, how can the member allow its `this` pointer to escape? It seems to me like the `scope` qualifier is no effect in

Escape this in pure members

2020-09-19 Thread Per Nordlöw via Digitalmars-d-learn
If an aggregate member is pure but not scope when can it escape the `this` pointer?. Only via return? In the struct and class case?

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 September 2020 at 14:08:39 UTC, Adam D. Ruppe wrote: On Saturday, 19 September 2020 at 13:56:53 UTC, Anonymouse wrote: Is there a way to detect programmatically if I'm in an environment where I need to manually set line buffering? Part of the problem is the IDE console and

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 September 2020 at 14:14:46 UTC, Paul Backus wrote: You can check the TERM environment variable [2], or you can use the POSIX uname() function [3] to see if you're running under Cygwin specifically. If there are any other environments where you need to manually set

Re: Good repos to learn D

2020-09-19 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:13:58 UTC, Jacob Carlborg wrote: On Saturday, 19 September 2020 at 08:26:36 UTC, Imperatorn wrote: [...] Here are some examples of large projects: [...] Thanks, I'll check them out! /Forsberg

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:56:53 UTC, Anonymouse wrote: On Saturday, 19 September 2020 at 13:32:07 UTC, Paul Backus wrote: http://dpldocs.info/experimental-docs/std.stdio.File.setvbuf.1.html Thanks. I don't have a clone of druntime/Phobos available to me right now, so some

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:56:53 UTC, Anonymouse wrote: Is there a way to detect programmatically if I'm in an environment where I need to manually set line buffering? Part of the problem is the IDE console and cygwin too I believe both *look* like a pipe to the program instead of

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:32:07 UTC, Paul Backus wrote: On Saturday, 19 September 2020 at 13:23:29 UTC, Anonymouse wrote: On Tuesday, 18 August 2020 at 06:25:31 UTC, Kagamin wrote: On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote: Just as a drive-by comment, the main

Re: Vibe.d

2020-09-19 Thread Jack via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:13:56 UTC, Jack wrote: Hi, I am building a webapp using vibe.d which is working well on macOS and Linux. However, when I run it on windows I get: Program exited with code -1073741701 I created a new default project with: dub init test -t vibe.d and get

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 19 September 2020 at 13:23:29 UTC, Anonymouse wrote: On Tuesday, 18 August 2020 at 06:25:31 UTC, Kagamin wrote: On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote: Just as a drive-by comment, the main stdio thing I came across that I couldn't do from within @safe was

Re: Cannot call @system funciton (stdout)

2020-09-19 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 18 August 2020 at 06:25:31 UTC, Kagamin wrote: On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote: Just as a drive-by comment, the main stdio thing I came across that I couldn't do from within @safe was stdout.flush(), which I need to call manually for Cygwin terminals and

Vibe.d

2020-09-19 Thread Jack via Digitalmars-d-learn
Hi, I am building a webapp using vibe.d which is working well on macOS and Linux. However, when I run it on windows I get: Program exited with code -1073741701 I created a new default project with: dub init test -t vibe.d and get the same error code when running it. Any suggestions what

Re: Good repos to learn D

2020-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
On Saturday, 19 September 2020 at 08:26:36 UTC, Imperatorn wrote: What are some good examples of pretty large/medium size, good structured repos in D? I'm looking for examples to learn from Thanks! Here are some examples of large projects: * DWT [1]. This is one of the largest D projects

Re: DDoc generation

2020-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
On Saturday, 19 September 2020 at 07:43:24 UTC, Russel Winder wrote: Doesn't that then make the whole DDoc system fairly useless, despite it's use in Phobos? If you use Dub, you can run `dub build -b ddox` and it will use Ddox to build the documentation. This will include an index page

Re: DDoc generation

2020-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
On Saturday, 19 September 2020 at 07:43:24 UTC, Russel Winder wrote: Doesn't that then make the whole DDoc system fairly useless, despite it's use in Phobos? Yes. The problem is that most things in D are compared with C or C++. People are praising that the built-in support for unit tests

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread wjoe via Digitalmars-d-learn
On Friday, 18 September 2020 at 22:21:52 UTC, Adam D. Ruppe wrote: On Friday, 18 September 2020 at 22:02:07 UTC, aberba wrote: [...] I actually added *exactly* this to cgi.d in... 2010 if I remember right. I even kinda documented it:

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread wjoe via Digitalmars-d-learn
On Friday, 18 September 2020 at 22:31:09 UTC, mw wrote: On Friday, 18 September 2020 at 00:07:12 UTC, wjoe wrote: Are there other frameworks besides vibe that can do what I want? Just FYI, there is also: https://code.dlang.org/packages/hunt-framework I never used myself, you need to

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread ikod via Digitalmars-d-learn
On Saturday, 19 September 2020 at 11:11:21 UTC, ikod wrote: On Friday, 18 September 2020 at 13:13:16 UTC, wjoe wrote: On Friday, 18 September 2020 at 12:58:29 UTC, Steven Schveighoffer wrote: On 9/18/20 8:39 AM, Steven Schveighoffer wrote: But again, solved with an enhancement that allows you

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread ikod via Digitalmars-d-learn
On Friday, 18 September 2020 at 13:13:16 UTC, wjoe wrote: On Friday, 18 September 2020 at 12:58:29 UTC, Steven Schveighoffer wrote: On 9/18/20 8:39 AM, Steven Schveighoffer wrote: But again, solved with an enhancement that allows you to process the data in your code. I'll file the enhancement

Re: vibe.d: How to get the conent of a file upload ?

2020-09-19 Thread wjoe via Digitalmars-d-learn
On Friday, 18 September 2020 at 22:02:07 UTC, aberba wrote: [...] That's what I was trying to answer. When Steve said meh, he probably didn't get what I said. Probably its because of my typos. This sort of convenience and productivity benefit is part of why I use Node.Js in the job when I

Re: DDoc generation

2020-09-19 Thread Mike Parker via Digitalmars-d-learn
On Friday, 18 September 2020 at 13:35:05 UTC, Russel Winder wrote: On Fri, 2020-09-18 at 09:02 -0400, Steven Schveighoffer via Digitalmars-d- learn wrote: […] it ddoc files, and compile those along with your application. https://dlang.org/spec/ddoc.html#using_ddoc_for_other_documentation

Good repos to learn D

2020-09-19 Thread Imperatorn via Digitalmars-d-learn
What are some good examples of pretty large/medium size, good structured repos in D? I'm looking for examples to learn from Thanks!

Re: DDoc generation

2020-09-19 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2020-09-18 at 20:22 -0400, James Blachly via Digitalmars-d-learn wrote: > On 9/18/20 9:35 AM, Russel Winder wrote: > > On Fri, 2020-09-18 at 09:02 -0400, Steven Schveighoffer via Digitalmars-d- > > learn wrote: > > > > […] > > > it ddoc files, and compile those along with your > > >

Re: DDoc generation

2020-09-19 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2020-09-19 at 08:12 +0200, Jacob Carlborg via Digitalmars-d-learn wrote: > On 2020-09-18 13:41, Russel Winder wrote: > > Hi, > > > > I am trying to get to grips with DDoc for documenting an application. > > Getting > > the individual module HTML files seems to be the easy bit. The

Re: Building LDC runtime for a microcontroller

2020-09-19 Thread Johan via Digitalmars-d-learn
On Friday, 18 September 2020 at 23:00:33 UTC, Adam D. Ruppe wrote: The error says something about constness being different, well, why the eff would an init symbol ever be mutable? See https://forum.dlang.org/post/edngcvtlkjpykxvxy...@forum.dlang.org for why TypeInfo is mutable. (In this

Re: Question about linker errors when using slices

2020-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-09-19 04:45, tspike wrote: I’ve been using D for personal projects for almost a year now and I really love it. I recently ran across a linker error that I’m a little confused by. Consider the following files: platform.d:     module platform;     import app;     struct

Re: Proper way to exit with specific exit code?

2020-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-09-17 16:58, drathier wrote: What's the proper way to exit with a specific exit code? I found a bunch of old threads discussing this, making sure destructors run and the runtime terminates properly, all of which seemingly concluding that it's sad that there isn't a way to do this

Re: DDoc generation

2020-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-09-18 13:41, Russel Winder wrote: Hi, I am trying to get to grips with DDoc for documenting an application. Getting the individual module HTML files seems to be the easy bit. The question is how to get an index.html (or equivalent) so as to have an application level entry point to the