Re: function parameters: is it possible to pass byref ... while being optional at the same time ?

2021-07-17 Thread Brian Tiffin via Digitalmars-d-learn
On Sunday, 18 July 2021 at 00:00:01 UTC, zjh wrote: On Saturday, 17 July 2021 at 22:40:35 UTC, someone wrote: On Saturday, 17 July 2021 at 21:46:38 UTC, Jack Applegame wrote: This must be `Forum Oriented Programming`. It's our best hope. Self taught programming is scary. School taught prog

Re: Hello world/Web server task on RosettaCode fails

2021-07-18 Thread Brian Tiffin via Digitalmars-d-learn
On Saturday, 17 July 2021 at 04:13:53 UTC, btiffin wrote: On Friday, 16 July 2021 at 20:04:21 UTC, jfondren wrote: On Friday, 16 July 2021 at 19:25:32 UTC, btiffin wrote: Using gdc-11 and Seamonkey. https://rosettacode.org/wiki/Hello_world/Web_server#D does not compile. The `while` as you n

enum true, or 1

2021-07-21 Thread Brian Tiffin via Digitalmars-d-learn
What is the preferred syntax for simple on/off states? Did I read that D was moving to strictly 1 and 0 literals instead of true/false on/off yes/no? If so, is there an idiom for yes/no/maybe -1,0,1 less/equal/greater? Excuse the noise. For some backfill; getting used to DDoc. Frontmat

Re: enum true, or 1

2021-07-22 Thread Brian Tiffin via Digitalmars-d-learn
On Thursday, 22 July 2021 at 03:58:38 UTC, Ali Çehreli wrote: On 7/21/21 8:44 PM, Brian Tiffin wrote: > What is the preferred syntax for simple on/off states? I use std.typecons.Flag. It feels very repetitive but that's what we have: import std.typecons; void foo(Flag!"doFilter" doFilter) {

Exit before second main with -funittest

2021-07-29 Thread Brian Tiffin via Digitalmars-d-learn
Is this good, bad or indifferent (a right left choice, first one doesn't matter)? ```d module cpuiding; /+ imports +/ import std.stdio: writeln; import core.cpuid; /++ start here +/ void main(string[] args) { writeln(args); writeln(processor()); writeln(vendor()); } /++ Self Test On

Re: Exit before second main with -funittest

2021-07-29 Thread Brian Tiffin via Digitalmars-d-learn
On Friday, 30 July 2021 at 04:22:12 UTC, Mathias LANG wrote: On Friday, 30 July 2021 at 03:45:21 UTC, Ali Çehreli wrote: Almost all of my programs are in the following pattern: ```D import std.stdio; void main(string[] args) { version (unittest) { // Don't execute the main program when u

Re: Exit before second main with -funittest

2021-07-30 Thread Brian Tiffin via Digitalmars-d-learn
On Friday, 30 July 2021 at 08:26:47 UTC, Bastiaan Veelo wrote: On Friday, 30 July 2021 at 05:51:41 UTC, Brian Tiffin wrote: [... interesting account of the D experience ...] **Kudos team and contributors.** Can't really suggest that many improvements to resources needed for learning D, as a

Re: Exit before second main with -funittest

2021-07-30 Thread Brian TIffin via Digitalmars-d-learn
On Friday, 30 July 2021 at 22:51:00 UTC, Ali Çehreli wrote: On 7/30/21 3:08 PM, Brian Tiffin wrote: > Don't take to C++, never have, even while watching > cfront and Walter having the first** brain to craft a native compiler. [...] > ** I'm not sure Walter was first first, or close first, or..

Social chat in the forums

2021-08-01 Thread Brian Tiffin via Digitalmars-d-learn
Question, or suggestion. In the Community forums, there is General and Announce. Where is the preferred place to *shoot the breeze*? D adjacent, but off-topic and mostly social (with the *desirable* assumption that the audience is all D programmers and openly nerd minded). Within the forum

Re: Social chat in the forums

2021-08-01 Thread Brian Tiffin via Digitalmars-d-learn
On Sunday, 1 August 2021 at 21:35:05 UTC, rikki cattermole wrote: On 02/08/2021 9:19 AM, Brian Tiffin wrote: Question, or suggestion.  In the Community forums, there is General and Announce. Announce is only for announcements. General is used sometimes for OT stuff, like I've congratulated A

module search paths

2021-08-03 Thread Brian Tiffin via Digitalmars-d-learn
Just tried the JSON sample from the home page. It's not an all in listing, so I added an `import std.json;`. That did not include the JSONType enum. A little more looking around, a more complete listing, added ``` import std.array; import std.conv; import std.range.primitives; import std.tr

Re: module search paths

2021-08-04 Thread Brian Tiffin via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 05:01:59 UTC, Ali Çehreli wrote: On 8/3/21 9:51 PM, Brian Tiffin wrote: > I added an `import std.json;`. That did not include the > JSONType enum. It works for me: import std.json; int main() { return JSONType.null_; } > Is there a go to quick and easy way o

Re: module search paths

2021-08-04 Thread Brian Tiffin via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 09:41:45 UTC, Mathias LANG wrote: On Wednesday, 4 August 2021 at 04:51:48 UTC, Brian Tiffin wrote: With `import std.json` working for the other symbols like parseJSON? `gdc-11 (Ubuntu 11.1.0-1ubuntu1~18.04.1) 11.1.0` Have good. You are using GDC 11, which has

Re: module search paths

2021-08-04 Thread Brian Tiffin via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 05:01:59 UTC, Ali Çehreli wrote: On 8/3/21 9:51 PM, Brian Tiffin wrote: ... > Is there a go to quick and easy way of tracking down > module members? Searching for it at dlang.org usually works pretty well. Although, I hear that Adam's Phobos documentation site i

Quotes and backticks together in a raw string

2021-08-18 Thread Brian Tiffin via Digitalmars-d-learn
Google fu is failing on this one. Is there a way to have a raw multi-line string literal with both double-quotes and backticks inside? Catenation works fine, busting up the literal, but can it be a single literal with both characters? Not a biggy, just curious.

Re: Quotes and backticks together in a raw string

2021-08-18 Thread Brian Tiffin via Digitalmars-d-learn
On Wednesday, 18 August 2021 at 22:34:54 UTC, jfondren wrote: On Wednesday, 18 August 2021 at 22:18:59 UTC, Brian Tiffin wrote: Google fu is failing on this one. string docs are at https://dlang.org/spec/lex.html Is there a way to have a raw multi-line string literal with both double-quotes

modules and mains

2021-08-21 Thread Brian Tiffin via Digitalmars-d-learn
Is this wrong thinking? I'm ~~working on~~ playing with a first project. Meant to be a suite of tools, each usable from the command line, i.e. with a `main`. Then a manager program that accepts subcommands for dispatch *and other boss type things*. boss.d wants to import command1.d command

Re: modules and mains

2021-08-21 Thread Brian Tiffin via Digitalmars-d-learn
On Sunday, 22 August 2021 at 03:22:02 UTC, Brian Tiffin wrote: Is this wrong thinking? I'm ~~working on~~ playing with a first project. Meant to be a suite of tools, each usable from the command line, i.e. with a `main`. Then a manager program that accepts subcommands for dispatch *and othe

Re: modules and mains

2021-08-21 Thread Brian Tiffin via Digitalmars-d-learn
On Sunday, 22 August 2021 at 04:38:58 UTC, Ali Çehreli wrote: On 8/21/21 8:46 PM, Brian Tiffin wrote: > prompt$ cat B.d > module B; > version = boss; A cannot know about 'version' condition inside B. The solution is to provide version on the command line. This is how I do it with dmd: $ dmd

Re: modules and mains

2021-08-22 Thread Brian Tiffin via Digitalmars-d-learn
On Sunday, 22 August 2021 at 10:24:13 UTC, Mathias LANG wrote: On Sunday, 22 August 2021 at 03:22:02 UTC, Brian Tiffin wrote: ... IIUC, you want to generate multiple binaries, too ? In which case, I think you need more of a build tool solution than a language solution. Recent-ish versions o

compile time compression for associatve array literal

2021-08-22 Thread Brian Tiffin via Digitalmars-d-learn
From ~~a~~ little reading, it seems associative array literal initialization is still pending for global scope, but allowed in a module constructor? *If I understood the skimming surface reading so far*. ```d immutable string[string] things; static (this) { things = ["key1": "value 1", "ke

Re: compile time compression for associatve array literal

2021-08-23 Thread Brian Tiffin via Digitalmars-d-learn
On Monday, 23 August 2021 at 11:53:46 UTC, ag0aep6g wrote: On 23.08.21 08:14, Brian Tiffin wrote: From ~~a~~ little reading, it seems associative array literal initialization is still pending for global scope, but allowed in a module constructor?  *If I understood the skimming surface reading

Re: compile time compression for associatve array literal

2021-08-23 Thread Brian Tiffin via Digitalmars-d-learn
On Monday, 23 August 2021 at 14:49:17 UTC, jfondren wrote: On Monday, 23 August 2021 at 14:04:05 UTC, Brian Tiffin wrote: That's the goal. It's an optional goal at this point. I'm not *really* worried about size of object code, yet, but figured this would be a neat way to shrink the compiled

Re: Piping from terminal into D program

2021-09-04 Thread Brian Tiffin via Digitalmars-d-learn
On Saturday, 4 September 2021 at 15:41:51 UTC, eXodiquas wrote: Hello everyone, I created a small little D program that reads in a string from the command line and shuffles the letters of the nouns a bit around. This is pretty straight forward, but what I see now happening is a bit strange, a