digitalmars.D.learn - module search paths
- Brian Tiffin (22/22) Aug 03 2021 Just tried the JSON sample from the home page. It's not an all
- =?UTF-8?Q?Ali_=c3=87ehreli?= (11/15) Aug 03 2021 It works for me:
- Brian Tiffin (5/22) Aug 04 2021 Cool, thanks, Ali. I'll track through some source. I may have
- Brian Tiffin (21/31) Aug 04 2021 Just adding; here's some technical details for a Ubuntu 18.04
- Mathias LANG (14/18) Aug 04 2021 You are using GDC 11, which has an older version of the frontend.
- Brian Tiffin (28/49) Aug 04 2021 Thanks, Mathias. So it's a trailing edge / leading edge thing.
- kdevel (8/16) Apr 16 2022 alias JSONType = JSON_TYPE;
- kdevel (3/4) Apr 16 2022 GCC 12.
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.traits; ``` from the listing in phobos lib docs. Still no joy. Is there a go to quick and easy way of tracking down module members? ``` jsoning.d:40:27: error: undefined identifier ‘JSONType’ 40 | if (code.type() == JSONType.integer) | ^ ``` 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.
Aug 03 2021
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 of tracking down module members?Searching for it at dlang.org usually works pretty well. Although, I hear that Adam's Phobos documentation site is better. (I don't use it just because I don't have a habit of it yet.) Finally, I sometimes grep under /usr/include/dmd. Ultimate truth! :) Ali
Aug 03 2021
On Wednesday, 4 August 2021 at 05:01:59 UTC, Ali Çehreli wrote:On 8/3/21 9:51 PM, Brian Tiffin wrote:Cool, thanks, Ali. I'll track through some source. I may have blended some local files, (I did quite a few `dmd` installs during a flailing phase). Have good.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 of tracking down module members?Searching for it at dlang.org usually works pretty well. Although, I hear that Adam's Phobos documentation site is better. (I don't use it just because I don't have a habit of it yet.) Finally, I sometimes grep under /usr/include/dmd. Ultimate truth! :) Ali
Aug 04 2021
On Wednesday, 4 August 2021 at 05:01:59 UTC, Ali Çehreli wrote:On 8/3/21 9:51 PM, Brian Tiffin wrote:...Just adding; here's some technical details for a Ubuntu 18.04 32bit laptop, with gdc-11.1.0, dmd 2.097.1, ldc 1.8.0 (have yet to explore the LLVM options), and vibe out of current dub as of early Aug 2020+1, when looking for standard library ultimate truths. *JSON in particular, but these paths are going to be the go to paths for now*. ``` /usr/include/d/vibe/vibe/data/json.d /usr/include/dmd/phobos/std/json.d /usr/lib/gcc/i686-linux-gnu/11/include/d/std/json.d /usr/lib/gcc/i686-linux-gnu/9/include/d/std/json.d /usr/lib/ldc/i386-linux-gnu/include/d/std/json.d ``` I have not done any builds from source yet, only `apt` package installs from main repos and gcc leading edge, so `/usr/local...` is not a complicating factor on this laptop. `/usr/lib/gcc/i686-linux-gnu/11/include/d/...` is where I have been finding truth for gdc-11 D. Cheers, and another thanks.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 is better. (I don't use it just because I don't have a habit of it yet.) Finally, I sometimes grep under /usr/include/dmd. Ultimate truth! :) Ali
Aug 04 2021
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 an older version of the frontend. GDC is pretty great for targeting a variety of platform and having a very stable compiler, but it comes with the downside that it is updated less frequently (tied to GCC releases) and the docs may get outdated. JSONType used to be named `JSON_TYPE`, and this was changed in v2.082.0. I think GDC-11 is somewhere around v2.076.0 (with a lot of backport for bugs, but no feature / Phobos backport). Since v2.082.0 was released 2018-09-02 (almost 3 years ago), the documentation has long moved. TL;DR: Use `JSON_TYPE`. Note that you can quickly get LDC / DMD setup with the install script, or d-apt (https://d-apt.sourceforge.io/).
Aug 04 2021
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:Thanks, Mathias. So it's a trailing edge / leading edge thing. Ok with that. I just got a workable install of DMD a few days ago, with 2.097.1. Previous packages did not work on the old laptop I'm using to explore D. Getting a workable DMD package was a boon too, adding dub and rdmd, which helps out a lot with other learning materials found on the web. I'm not at the level where I build these tools from source yet. That's a few steps ahead. And then the slow build of a mental knowledge base to know where and when to look for things that change or where articles may be ahead or behind in gdc D development details. Being a GNU maintainer for a COBOL compiler, I was a GDC fanboy before I even tried it. Willing to put up with a few edge cases while things build out and will always reach for gdc before trying the other 2 options. ;-) A life goal has been to see GnuCOBOL envelope all in it's path, via the C ABI. gdc makes that easier with integrating all new things D with all the old things COBOL. :-) The last few weeks has seen a definite shift to D over C as a personal first choice for system and utility level programming, leading to a *lesser* shift to D over COBOL for application programming. Learning more and more D makes it seems like it will be a first choice for most programming; low, mid and high level, in the small and in the large. I may end up growing very spoiled in my old age. Have good, make well.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 an older version of the frontend. GDC is pretty great for targeting a variety of platform and having a very stable compiler, but it comes with the downside that it is updated less frequently (tied to GCC releases) and the docs may get outdated. JSONType used to be named `JSON_TYPE`, and this was changed in v2.082.0. I think GDC-11 is somewhere around v2.076.0 (with a lot of backport for bugs, but no feature / Phobos backport). Since v2.082.0 was released 2018-09-02 (almost 3 years ago), the documentation has long moved. TL;DR: Use `JSON_TYPE`. Note that you can quickly get LDC / DMD setup with the install script, or d-apt (https://d-apt.sourceforge.io/).
Aug 04 2021
On Wednesday, 4 August 2021 at 09:41:45 UTC, Mathias LANG wrote: [...]JSONType used to be named `JSON_TYPE`, and this was changed in v2.082.0. I think GDC-11 is somewhere around v2.076.0 (with a lot of backport for bugs, but no feature / Phobos backport). Since v2.082.0 was released 2018-09-02 (almost 3 years ago), the documentation has long moved. TL;DR: Use `JSON_TYPE`.alias JSONType = JSON_TYPE; That does not suffice: jsr.d:56:12: Fehler: no property »string« for type »JSON_TYPE« 56 | case JSONType.string: | ^Note that you can quickly get LDC / DMD setup with the install script, or d-apt (https://d-apt.sourceforge.io/).Will that be corrected in GCC 11.3 or not until GCC 12?
Apr 16 2022
On Saturday, 16 April 2022 at 13:45:17 UTC, kdevel wrote: [...]Will that be corrected in GCC 11.3 or not until GCC 12?GCC 12.
Apr 16 2022