News for hackers. Stuff that matters.
Re:C++ Modules Might Be Dead-On-Arrival by WalterBright on Monday January 28, 2019 @12:38AM (#19015521)
D made the decision at the beginning to have filename==modulename specifically to avoid this problem. So:

    import std.stdio;
means look for:

    std/stdio.d
Re:C++ Modules Might Be Dead-On-Arrival by slavik81 on Monday January 28, 2019 @12:47AM (#19015539)
Have there been any downsides or annoyances with that approach?
Re:C++ Modules Might Be Dead-On-Arrival by WalterBright on Monday January 28, 2019 @01:01AM (#19015573)
1. The filename characters have to be valid D identifier characters. This annoys some people.

2. Because Windows has case-insensitive filenames, and Linux, etc., have case sensitive filenames, we recommend that path/filenames be in lower case for portability. This annoys some people.

3. There are command line switches to map from module names to filenames for special purposes. They're very rarely needed, but invaluable when they are.

Overall, it's been very successful.

Re:C++ Modules Might Be Dead-On-Arrival by mort96 on Monday January 28, 2019 @04:47AM (#19016244)
> 2. Because Windows has case-insensitive filenames, and Linux, etc., have case sensitive filenames, we recommend that path/filenames be in lower case for portability. This annoys some people.

That's also a problem in most other languages; just a couple of days ago, someone else's C++ code didn't compile on my machine because they had accidentally included <something/whatever.h> when the file was actually named <something/Whatever.h>, because macOS is case insensitive. I had the same experience with JavaScript some months ago, that time because they were running Windows.

On the "filenames must be valid identifiers" thing; I really wish more languages would start allowing kebab-case in identifiers. That's also absolutely not a D thing, more of a common complaint about most languages.

Re:C++ Modules Might Be Dead-On-Arrival by giornogiovanna on Monday January 28, 2019 @07:03AM (#19016821)
Kebab-case is, in my opinion, the most beautiful of identifier cases, but how would you get around the ambiguity with subtraction, short of going full Lisp or adding whitespace sensitivity?
Re:C++ Modules Might Be Dead-On-Arrival by mort96 on Monday January 28, 2019 @07:35AM (#19016960)
I don't think requiring whitespace around operators is such a bad thing. My personal coding style generally looks like `int foo = 10 + (something - 20);` anyways, and I think that style is a lot more readable than `int foo=10+(something-20);`. If you require whitespace around almost all operators, you open up the possibility of naming identifiers basically anything, which lets you have conventions like naming predicates or boolean members with a question mark at the end. In my opinion, `myObject.whatever?` looks a lot better than `myObject.isWhatever`.

Exactly which operators should require whitespace and which don't is up for debate, but in my personal opinion, requiring space around infix operators and letting prefix/postfix operators not require a space would be appropriate. Nobody wants to have to write `myArray [i]`, but I think most people would be willing to give up `i-1` and instead write `i - 1`.

Re:C++ Modules Might Be Dead-On-Arrival by sacado2 on Tuesday January 29, 2019 @05:33AM (#19025286)
I like to be able to remove spaces in complex expressions, for readability issues. For instance, this :

    t[x] = t[x-1] + t[x-2]
looks more readable to me than this :

    t[x] = t[x - 1] + t[x - 2]
Another example :

    y = a*x1 + b*x2 + c
Re:C++ Modules Might Be Dead-On-Arrival by wtetzner on Monday January 28, 2019 @07:41AM (#19016982)
> adding whitespace sensitivity?

Would adding whitespace sensitivity really be a problem? You already need whitespace to separate identifiers, so it's not a totally foreign concept in mainstream languages.

It seems like we've been making a weird trdeoff, by disallowing kebab-case just so we can smash our operators together with our operands.

Re:C++ Modules Might Be Dead-On-Arrival by phkahler on Monday January 28, 2019 @08:06AM (#19017118)
>> It seems like we've been making a weird trdeoff, by disallowing kebab-case just so we can smash our operators together with our operands.

Some people don't want to bother putting a space between operators and operands, and proponents of kebab-case just don't want to push the shift key to get an underscore.

Re:C++ Modules Might Be Dead-On-Arrival by wtetzner on Monday January 28, 2019 @01:18PM (#19019685)
To get kebab-case, the restriction that identifiers cannot start or end with '-' gets you pretty far. The only whitespace change is that you sometimes need whitespace around an infix '-'. Other operators are still fine, and it still works fine for prefix and postfix operators.

Also, the reason to prefer kabab-case for me has nothing to do with avoiding a keypress. It's that I find kebab-case easier to read.

Re:C++ Modules Might Be Dead-On-Arrival by ModernMech on Monday January 28, 2019 @08:38AM (#19017299)
As the other poster mentioned, you gain more than just the dash when forcing white space; you get forced readability and characters like / ? and ^ in identifiers. Then you can name things like foo/bar or e^x
Re:C++ Modules Might Be Dead-On-Arrival by mikepurvis on Monday January 28, 2019 @08:59AM (#19017423)
I suppose I could get used to that, but it sounds like a nightmare at first blush.
Re:C++ Modules Might Be Dead-On-Arrival by plopz on Monday January 28, 2019 @09:18AM (#19017552)
I don't think I could handle i ++ instead of i++
Re:C++ Modules Might Be Dead-On-Arrival by mort96 on Monday January 28, 2019 @10:25AM (#19018098)
You wouldn't have to require whitespace around all operators; you could, for example, decide that infix math/bitwise/logic operators must have a space around them, while other operators (like the infix operators `.` and `->`, and the prefix/suffix `++`, `--`, `[...]`, and `!`) wouldn't require whitespace.

I agree that nobody would want to write `i ++` or `foo [10]` or `myvar . mymember`, but I think a lot of people could get behind `10 - 20` and `foo && bar` instead of `10-20` and `foo&&bar`.

Re:C++ Modules Might Be Dead-On-Arrival by m48 on Monday January 28, 2019 @01:38PM (#19019869)
Does one actually need whitespace to separate identifiers? This is something that's always bugged me a bit.

Aside from C-style type declarations ("unsigned int x;"), C-style syntaxes seem to always have ways other than whitespace to separate identifiers.

Like (using some JavaScript in a hypothetical example) I can't think of many concrete reasons why this is easier to parse:

  let first_number=2, second_number=2, answer=first_number-second_number;
...than this:

  let first number=2, second number=2, answer=first number-second number;
Although, of course, some languages—most Lisps, Tcl, and Red/REBOL come to mind—actually do rely on whitespace and whitespace alone to separate identifiers in many situations, and something like this would likely be unworkable there.
Re:C++ Modules Might Be Dead-On-Arrival by lispm on Monday January 28, 2019 @03:12PM (#19020625)
Though one can use whitespace in Common Lisp identifiers, by quoting symbols:

  CL-USER 115 > (let ((first| |number 10)
                      (second\ number 20))
                  (+ first\ number |SECOND NUMBER|))
  30
Re:C++ Modules Might Be Dead-On-Arrival by m48 on Monday January 28, 2019 @06:10PM (#19022005)
Oh, I never noticed that. That's pretty interesting—although unfortunately, that syntax does not look terribly convenient to write, which is the main thing I'm after here.

I think the best way to get identifiers with whitespace to work in a Lisp would be contrive a syntax for S-expressions that uses something other than whitespace to separate things. Perhaps letting (first rest-1 rest-2 ...) be written as as (first: rest 1, rest 2, ...) or (first, rest 1, rest 2, ...), so that example could be written as:

  (let: ((first number: 10), 
         (second number: 20)), 
        (+: first number, second number))
I imagine it would be possible to write a macro in Common Lisp to transform this into runnable code, or a language in Racket to do so—although, I'm not sure how many people would actually want to make or use something like this.
Re:C++ Modules Might Be Dead-On-Arrival by kazinator on Tuesday January 29, 2019 @11:41AM (#19027697)
Not all whitespace you see in Lisp code is strictly necessary:

TXR Lisp:

  1> (list 1"a"'(b(c)d(e)))
  (1 "a" (b (c) d (e)))
Here we just have one space that prevents list 1 from being list1.
Re:C++ Modules Might Be Dead-On-Arrival by mkl on Monday January 28, 2019 @03:01PM (#19020545)
TikZ allows whitespace in identifiers. At first it was pretty strange, but I actually really like it now. I don't think parsing it is much of a problem, and I would quite like to be able to use it in other languages.
Re:C++ Modules Might Be Dead-On-Arrival by m48 on Monday January 28, 2019 @05:51PM (#19021857)
Well, thinking about it more, I did realize there's a pretty nasty edge case with my hypothetical JavaScript syntax:

  let let x = 5;
  let x = 6; 
  // should this set the variable "let x"?
  // or define a variable named "x"?
One could potentially design around situations like this, but allowing whitespace in identifiers likely does require being much more meticulous about treatment of reserved words, identifiers, and whitespace than more traditional syntaxes, and this is likely why not many people attempt this.

I think the idea is worth experimenting with, though, and that a good implementation of it could be convenient enough for end-users to outweigh the implementation inconvenience.

Re:C++ Modules Might Be Dead-On-Arrival by blt on Monday January 28, 2019 @01:08PM (#19019609)
I generally separate operands, but in dense math expressions it's not always the best for readability.

   x = (-b + sqrt(b**2 + 4*a*c) / (2*a)
   
   x = (- b + sqrt(b ** 2 + 4 * a * c) / (2 * a)
... Although, one could argue that allowing tightened multiplication and division are enough.
Re:C++ Modules Might Be Dead-On-Arrival by AnimalMuppet on Monday January 28, 2019 @01:11PM (#19019635)
Not to be that guy, but...

  x = (-b + sqrt(b**2 - 4*a*c) / (2*a)
Re:C++ Modules Might Be Dead-On-Arrival by blt on Thursday January 31, 2019 @07:43PM (#19050631)
lol, thank you.
Re:C++ Modules Might Be Dead-On-Arrival by wtetzner on Monday January 28, 2019 @01:15PM (#19019668)
Well, if you're only interested in kebab-case, then specifying that identifiers can't start or end with hyphens solves most of the problem. The only restriction would be that you'd need whitespace around '-' only when used as an infix operator.
Re:C++ Modules Might Be Dead-On-Arrival by tzs on Monday January 28, 2019 @10:19AM (#19018052)
Use +- for subtraction, where + is binary plus and - is unary minus.
Re:C++ Modules Might Be Dead-On-Arrival by a1369209993 on Monday January 28, 2019 @12:50PM (#19019437)
Not sure if it's a good idea, but maybe try:

  foo-bar # kebab-case
  foo−bar # subtraction
  foo minus bar # subtraction? (infix identifier "minus")
  foo - bar # subtraction (infix identifier "-")
  foo − bar # subtraction (operator symbol)
using \u2212 as a explicit subtraction operator for people who really can't stand having 'extra' whitespace?
Re:C++ Modules Might Be Dead-On-Arrival by slobotron on Monday January 28, 2019 @01:46PM (#19019953)
Perl6 allows it, and it's the preferred convention to boot.

Small Intro: https://perl6advent.wordpress.com/2015/12/05/day-5-identifie...

Re:C++ Modules Might Be Dead-On-Arrival by kps on Monday January 28, 2019 @11:33AM (#19018775)
Use ‘−’ for subtraction, allow ‘–’ and ‘‐’ in identifiers, and report an error for ‘-’.
Re:C++ Modules Might Be Dead-On-Arrival by mort96 on Monday January 28, 2019 @12:32PM (#19019278)
Sure, just make everyone replace their keyboard with one which has two `-` buttons and make everyone understand why they need two buttons for something which looks like the same letter and you can safely use – for one thing and — for the other.
Re:C++ Modules Might Be Dead-On-Arrival by xyproto on Monday January 28, 2019 @03:07AM (#19015913)
Those people are easily annoyed.
Re:C++ Modules Might Be Dead-On-Arrival by afiori on Monday January 28, 2019 @05:26AM (#19016385)
> 1. The filename characters have to be valid D identifier characters. This annoys some people.

this could be solved by allowing strings in qualified imports

  import "illegal identifier"."some more weird unicode" as someLib;
Re:C++ Modules Might Be Dead-On-Arrival by AnIdiotOnTheNet on Monday January 28, 2019 @08:13AM (#19017153)
Which, incidentally, is how Zig does it:

  const thing = @import("relative/path/to/thing.zig");
  const package = @import("packagename");
Re:C++ Modules Might Be Dead-On-Arrival by gpm on Monday January 28, 2019 @10:41AM (#19018265)
And rust

`extern crate foo`

`extern crate "foo-bar" as foo_bar`

This is all legal identifiers but

`use std::path::Path;`

`use std::path::Path as int; // For maximum confusion`

And not that anyone uses this part but:

`mod bazz;`

`#[path = "bazz-bar.rs"] mod bazz_bar;`

Re:C++ Modules Might Be Dead-On-Arrival by coldtea on Monday January 28, 2019 @03:28AM (#19015983)
>The filename characters have to be valid D identifier characters. This annoys some people.

I'd say "valid X language identifier characters" should always be ASCII.

I never understood the BS fad for unicode identifiers.

Wanna allow some math symbols? Maybe. The full unicode gamut, so that you can have a variable named shit emoji? Yeah, no.

Re:C++ Modules Might Be Dead-On-Arrival by enedil on Monday January 28, 2019 @03:32AM (#19015992)
But that's not only about Unicode. You can't start your filename with digit or a dash.
Re:C++ Modules Might Be Dead-On-Arrival by ZiiS on Monday January 28, 2019 @03:38AM (#19016012)
This stops most of the world naming things in their native language.
Re:C++ Modules Might Be Dead-On-Arrival by ckastner on Monday January 28, 2019 @04:49AM (#19016253)
As a non-native English speaker, I understand the desire to name things in my native language (German), but for all but languae francae, naming things in a native language presents an obstacle to sharing these things with others.

Compare итератор and 迭代器, which are complete mysteries to me produced by Google Translate. If my intention were to reach as many people as possible, I'd use "iterator" (which, coincidentally, works for English and my native German).

Re:C++ Modules Might Be Dead-On-Arrival by johannes1234321 on Monday January 28, 2019 @06:58AM (#19016788)
There are technical terms and there is domain terminology.

If once worked in finance and there is a difference between GAAP accounting and German accounting rules. If my algorithms used English terminology to be consistent with technical terms this would be confusing inneach review. Using German terms (even combined with English "get" or "set", like "getBetriebsertrag") there was beneficial, even though it always confussed new members of the team.

Re:C++ Modules Might Be Dead-On-Arrival by beaconstudios on Monday January 28, 2019 @07:00AM (#19016807)
funnily enough, the Russian also spells "iterator", just in Cyrillic. But your point stands nonetheless.
Re:C++ Modules Might Be Dead-On-Arrival by kungtotte on Monday January 28, 2019 @04:01AM (#19016090)
Speaking as someone who doesn't have English as their first language I think programming should be in English and ASCII. This includes identifiers and filenames. Strings on the other hand should be 100% valid Unicode, never ASCII.

This means the code can be read by anyone anywhere in the world on any operating system and that string payloads can similarly be read by anyone anywhere in the world.

Re:C++ Modules Might Be Dead-On-Arrival by ptx on Monday January 28, 2019 @04:53AM (#19016271)
Since keywords and APIs are usually in English, continuing to follow that convention in your variable names is often the most natural option.

But in cases where the program will be dealing with some concept that doesn't exist in English, being able to refer to things by their actual name, in the native language (assuming that's also the native language of the customer and development team), is much better than inventing a confusing and unnatural English translation.

Re:C++ Modules Might Be Dead-On-Arrival by lifthrasiir on Monday January 28, 2019 @04:32AM (#19016185)
> This means the code can be read by anyone anywhere in the world on any operating system and that string payloads can similarly be read by anyone anywhere in the world.

Uh, no? You are not supposed to be able to read this valid Unicode string literal in Korean: `"그뤼고 이 문좌열은 일부려 기ㅖ버역을 어럽게하러고 오타비문이 산개해 있구먼요."`

Also a significant portion (and possibly the majority) of codes would be ever read and written by a small group of people, often sharing a common language other than English, so non-English code is just fine for them. If you are saying that a public library should be written in English, I almost agree---there would be some exceptions though.

Re:C++ Modules Might Be Dead-On-Arrival by yarosv on Monday January 28, 2019 @03:43PM (#19020891)
Do you mean you want like C#?

    public class 그뤼고
    {
      private 이 이 {get;set;}

      public 그뤼고()
      {
        var 문좌열은 = 이.문좌열은;
        var 기ㅖ버역을 = Enumerable.Range(0, 10);
        var 오타비문이 = 기ㅖ버역을.Select(요 => 요);
      }
    }

    public class 이
    {
      public int 문좌열은 {get;set;}
    }
Re:C++ Modules Might Be Dead-On-Arrival by lifthrasiir on Monday January 28, 2019 @06:34PM (#19022202)
Sometimes, though my example was intentionally obscured to prevent machine translation and you were not aware of Korean conjugations (usually omitted in identifiers) ;-)

I have seen numerous instances of pseudo-English when it comes to naming. It is hard to name things in non-native tongues. When reasonable, reducing that overhead can be indeed beneficial.

Re:C++ Modules Might Be Dead-On-Arrival by yarosv on Wednesday February 06, 2019 @11:18AM (#19096400)
Oops (yes, I don't know what it meant). I mean I speak Ukrainian and Russian. If I saw the code like that in my native tongue, I would be upset.

Plus it is pain to alt+shift between languages all the time.

Re:C++ Modules Might Be Dead-On-Arrival by coldtea on Monday January 28, 2019 @04:46AM (#19016238)
That's the main benefit.

A programming language's identifiers is not the place to express one's national identity. They should be utilitarian, and easily understood by programmers across countries.

Since you're already supposed to understand the syntax of every major programming language (which is based on english) you can make do with english keywords too. Nothing worse than opening some code to find bizarro foreign language identifiers.

(And I'm no native english speaker, so I'm not speaking as someone who's ok with this because english is their language or ASCII fits their default keyboard layout: it just makes sense).

Re:C++ Modules Might Be Dead-On-Arrival by scrollaway on Monday January 28, 2019 @06:35AM (#19016666)
I see what you're saying, but then again, this is exactly how many chinese programmers feel all the time.

> Nothing worse than opening some code to find bizarro foreign language identifiers.

Re:C++ Modules Might Be Dead-On-Arrival by lultimouomo on Monday January 28, 2019 @06:56AM (#19016779)
So we should live in a world where Chinese programmers share knowledge only with Chinese programmes, Americans share among them and with Brits, Aussies and Canadians, and Mexicans share with Spaniards?

I'm not a native English speaker, and I have only to loose in this scenario.

Re:C++ Modules Might Be Dead-On-Arrival by scrollaway on Monday January 28, 2019 @07:28AM (#19016936)
Look, I worked for years in localization and I'm actually a proponent of English as a worldwide-spoken language. But I'm pointing out the irony in saying "Nothing worse than opening some code to find bizarro foreign language identifiers." when that is exactly how CJKHT(...) programmers, many of who do not speak a word of any western language, feel. Closer to the west, even people in countries that use cyrillic or greek alphabets are not necessarily familiar with latin transliteration and forcing it on them is dubious.

I mean, yeah, this can be made a requirement of programming languages: After all, it was such a requirement for a long, long time. But it doesn't have to be anymore.

BTW, full disclosure, I'm French and I find code written in french completely fucking unreadable. And that's 100% ASCII. As I said I believe code should be written in English, but I also don't think we should have essentially-artificial barriers for people to enter something as important as programming; those barriers only end up eroding the culture in question.

Re:C++ Modules Might Be Dead-On-Arrival by krapp on Monday January 28, 2019 @07:11AM (#19016858)
No one is claiming Chinese programmers should only code in Chinese, but to assert that they or anyone must code in American English for the convenience of Western programmers seems absurd. Should they also be forced to write all of their novels and perform all of their movies and music in English as well?

We live in a multicultural world, one for which English as a default doesn't make sense in every context. Yes, it may be the case that Chinese, Spanish, Greek, German, Arabic, or other non-American ideogram using programmers write code primarily meant to be used and understood within their own culture. I see nothing wrong with that.

Re:C++ Modules Might Be Dead-On-Arrival by kungtotte on Monday January 28, 2019 @11:54AM (#19018974)
Chinese programmers using ASCII and English names for things would also be of great help to all other East Asian programmers that aren't Chinese.

Also what about the fact that while Mandarin is the largest language/dialect it's far from the only one in China? Using English/ASCII means all the programmers in China can understand each others code...

Re:C++ Modules Might Be Dead-On-Arrival by detaro on Monday January 28, 2019 @07:00AM (#19016804)
There are languages that allow more than ASCII, and that's not what happens in them.
Re:C++ Modules Might Be Dead-On-Arrival by yorwba on Monday January 28, 2019 @07:16AM (#19016886)
For that matter, there are human languages besides English that can be written using only ASCII (sometimes by transliterating) and that's not what happens in them.

Just like people know they have to write in English on HN to communicate, they also write their code in English when they plan to open-source it and share with the rest of the world. As for closed-source projects ... if your company doesn't conduct its business in English, why force the code to be in English? The only people whom that'd benefit are never going to see it.

Re:C++ Modules Might Be Dead-On-Arrival by zozbot123 on Monday January 28, 2019 @05:56AM (#19016489)
This is something that only humans care about, not computers. And humans can be accommodated by prettyprinting - or, in a pinch, by roundtrip conversion from an ASCII-only format to a "rich", Unicode-based one, and back. But let computers have their simple, ASCII-based identifier names. E.g. https://en.wikipedia.org/wiki/Punycode is a thing, and is routinely used for "native-language" domain names. But guess what, these domain names are still ASCII under the hood!

(Indeed, we should arguably move away from the notion of a single character string as the only human-facing semantics that an identifier is associated with-- there should be a higher layer, perhaps with multiple choices of e.g. native language, formatting and the like. Human facing semantics are closer to "literate" documentation than to anything that compilers should have to deal with. Yes, the "native", underlying representation should still be something that we can somehow make sense of - I'm not saying that our identifiers should be GUIDs or anything like that! But it will only be resorted to in a pinch.)

Re:C++ Modules Might Be Dead-On-Arrival by Sharlin on Monday January 28, 2019 @03:47AM (#19016040)
That's a false dichotomy. If you were talking about restricting identifiers to codepoints in the Unicode "letter" categories, you might have a point. (Nb. there are approximately 160,000 "letter" codepoints in Unicode, the vast majority of which being CJK ideograms.)
Re:C++ Modules Might Be Dead-On-Arrival by WalterBright on Monday January 28, 2019 @04:07AM (#19016117)
D allows the same Unicode codepoints as identifier characters as does C and C++.
Re:C++ Modules Might Be Dead-On-Arrival by coldtea on Monday January 28, 2019 @04:48AM (#19016246)
No, I'm saying restricting identifiers to AZaz09_.

I don't see a dichotomy (much less a false one). What are the two options I separate artificially?

I'm saying just don't impose regional alphabets (other than AZaz that's already par for the course with the syntax of all major programming languages anyway) and regional words into source code.

Re:C++ Modules Might Be Dead-On-Arrival by Sharlin on Monday January 28, 2019 @08:03AM (#19017100)
You disregarded 99.99% of Unicode as "math symbols and poop emoji". That's just a ridiculously biased Anglocentric viewpoint. It's 2019; there's zero reason to force people to stick to either a subset of their native script, or a completely foreign one, when naming identifiers in a programming language.
Re:C++ Modules Might Be Dead-On-Arrival by ketzu on Monday January 28, 2019 @03:37AM (#19016007)
Valid characters are usually not the full ASCII set at all, so why not pick and chose from unicode as well?

Or why not full unicode text support? Is there any real reason besides "some people might want emoji and I don't like that"?

Re:C++ Modules Might Be Dead-On-Arrival by SiempreViernes on Monday January 28, 2019 @05:02AM (#19016294)
They might use their native language too!

But no, the totality of the argument always reduces to: "I'm not used to this and would find it inconvenient"

Re:C++ Modules Might Be Dead-On-Arrival by kccqzy on Monday January 28, 2019 @02:22AM (#19015792)
I haven't used D, but in Haskell we have the same module name == file name thing. The only time I don't like it is when we have nested modules, the parent and children modules are not in the same directory:

    import A      -- compiler reads A.hs
    import A.B    -- compiler reads A/B.hs
Thus, two semantically related modules are now in different directories.

Python, IMO, handles this correctly by having __init__.py support inside directories. It's theoretically less elegant because of the special name, but in practice leads to better file organization.

Same for Rust, but even better, because one can define nested modules in the same file. So you can either define a new module in the same file, put it in a different file named by the module, or put it in the file `mod.rs` inside the directory named by the module.

Re:C++ Modules Might Be Dead-On-Arrival by ben-schaaf on Monday January 28, 2019 @04:33AM (#19016189)
D also has package.d for the same effect as python. It works quite well as package is a keyword and thus can't be used as a regular module anyway.
Re:C++ Modules Might Be Dead-On-Arrival by p0nce on Monday January 28, 2019 @09:07AM (#19017480)
But package.d could lead you to overdepend on too many modules too :) it's mostly great for end applications rather than internal to libraries.
Re:C++ Modules Might Be Dead-On-Arrival by ben-schaaf on Monday January 28, 2019 @09:46AM (#19017745)
Sure, but that's not specific to package.d. See the earlier convention of all.d or d.d. That's the trade-off with having public imports. I don't see how this is related to my comment though?
Re:C++ Modules Might Be Dead-On-Arrival by JoshTriplett on Monday January 28, 2019 @07:40AM (#19016980)
> The only time I don't like it is when we have nested modules, the parent and children modules are not in the same directory:

> import A -- compiler reads A.hs

> import A.B -- compiler reads A/B.hs

That has to happen at some level, assuming subdirectories; otherwise, what would "import A.B.C" refer to?

Re:C++ Modules Might Be Dead-On-Arrival by andrewmcwatters on Monday January 28, 2019 @09:02AM (#19017442)
For readers, Lua does this in the form:

    require( "engine.shared.entities" )
or

    require "engine.shared.entities"
Which means look for:

    engine/shared/entities.lua
Additionally, with the `package` module, `require` can also be modified to look for:

    engine/shared/entities/init.lua`
which is a common Lua practice.
Re:C++ Modules Might Be Dead-On-Arrival by sephoric on Monday January 28, 2019 @11:34AM (#19018788)
Lua can also be modified to have "engine.shared.entities" look for a file named "/engine-shared-entities.lua" and similar things. The creators have cited that Lua is sometimes used in environments where directories do not exist, only files.
Re:C++ Modules Might Be Dead-On-Arrival by agumonkey on Monday January 28, 2019 @05:18AM (#19016356)
what were your inspirations ? python ? others ?