Re: version(StdDoc)

2018-11-24 Thread Stanislav Blinov via Digitalmars-d-learn
On Sunday, 25 November 2018 at 07:19:50 UTC, Stanislav Blinov wrote: Granted, it may require some special syntax, i.e. enum E { a, b if version(Windows), c if version(Windows), d if version(Posix), } or something to that effect. Come to think of it, since UDAs are now

Re: version(StdDoc)

2018-11-24 Thread Stanislav Blinov via Digitalmars-d-learn
On Sunday, 25 November 2018 at 05:41:56 UTC, H. S. Teoh wrote: On Sat, Nov 24, 2018 at 05:48:16PM +, Stanislav Blinov via Digitalmars-d-learn wrote: Yup. UDAs did get in there eventually, and version should too. I think this would be a trivial DIP, by making it such that a version

Re: version(StdDoc)

2018-11-24 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Nov 24, 2018 at 05:48:16PM +, Stanislav Blinov via Digitalmars-d-learn wrote: > On Saturday, 24 November 2018 at 17:43:35 UTC, Jonathan M Davis wrote: > > On Saturday, November 24, 2018 9:28:47 AM MST Stanislav Blinov via > > Digitalmars-d-learn wrote: [...] > > > enum Foo > > > { > >

Re: version(StdDoc)

2018-11-24 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Nov 24, 2018 at 10:27:07PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: [...] > (Though a parsing thing: /// version(linux) void foo(); - is that doc > on version linux or on void foo or on both? I guess it could only > apply it in if there are {}... but eh I still don't love it.)

Re: How to iterate getSymbolsByUDA

2018-11-24 Thread bauss via Digitalmars-d-learn
On Saturday, 24 November 2018 at 08:50:59 UTC, Eko Wahyudin wrote: On Saturday, 24 November 2018 at 08:09:38 UTC, Stanislav Blinov wrote: On Saturday, 24 November 2018 at 03:48:12 UTC, Eko Wahyudin wrote: Hi all, anyone know how to iterate getSymbolsByUDA ? enum Attr; struct A { @Attr

Reading XDR data from a file

2018-11-24 Thread Chris Bare via Digitalmars-d-learn
I have a file in xdr format and I'm trying to use the xdr module from dub. After a lot of failures, I got this to work: ubyte[] b2 = cast (ubyte[]) read(fname); string n = cast (string) b2.get!string(); tracef("<%s>", n); I feel like there should be a way for the xdr get to read

Re: version(StdDoc)

2018-11-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 24 November 2018 at 16:16:08 UTC, H. S. Teoh wrote: Actually, what would be ideal is if each platform-specific version of the symbol can have its own associated platform-specific docs, in addition to the one common across all platforms, and the doc system would automatically

Re: D is supposed to compile fast.

2018-11-24 Thread welkam via Digitalmars-d-learn
On Friday, 23 November 2018 at 08:57:57 UTC, Chris Katko wrote: D is supposed to compile fast. You didnt read the fine print. It compiles simple code fast. Also compilation is separate step from linking and your program might spend half of "compilation" time in link phase.

Re: version(StdDoc)

2018-11-24 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 24 November 2018 at 17:43:35 UTC, Jonathan M Davis wrote: On Saturday, November 24, 2018 9:28:47 AM MST Stanislav Blinov via Digitalmars-d-learn wrote: On Saturday, 24 November 2018 at 07:00:31 UTC, Jonathan M Davis wrote: > [not legal] > > enum Foo > { > > a, > b, >

Re: version(StdDoc)

2018-11-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, November 24, 2018 9:28:47 AM MST Stanislav Blinov via Digitalmars-d-learn wrote: > On Saturday, 24 November 2018 at 07:00:31 UTC, Jonathan M Davis > > wrote: > > [not legal] > > > > enum Foo > > { > > > > a, > > b, > > version(linux) c = 42, > > else version(Windows)

Re: D is supposed to compile fast.

2018-11-24 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Nov 24, 2018 at 09:20:08AM +, Chris Katko via Digitalmars-d-learn wrote: > On Friday, 23 November 2018 at 10:00:17 UTC, Nicholas Wilson wrote: > > > > If you pass all the files on the command line then they all get > > (re)compiled. > > How are you supposed include files if not

Re: version(StdDoc)

2018-11-24 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 24 November 2018 at 07:00:31 UTC, Jonathan M Davis wrote: [not legal] enum Foo { a, b, version(linux) c = 42, else version(Windows) c = 54, } You're forced to version the entire enum. Not in this case, no: enum Foo { a, b, c = {

Re: How to get all modules in a package at CT?

2018-11-24 Thread Neia Neutuladh via Digitalmars-d-learn
Easiest way is to put this in your build script: find path/to/package -name '*.d' | \ xargs grep '^module ' | \ sed 's,^module,import,' \ > data/modules.d Add `-J data` to your DMD command line, or add `"stringImportPaths": ["data"]` to dub.json. Then in your file:

Re: version(StdDoc)

2018-11-24 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 23, 2018 at 09:43:01PM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: [...] > Honestly, I would argue that if you have multiple versions of the > documentation, then there's a serious problem. The documentation > shouldn't be platform-dependent even if the symbols are. Even if

Re: How to get all modules in a package at CT?

2018-11-24 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 24 November 2018 at 08:44:19 UTC, Domain wrote: I have a package named command, and many modules inside it, such as command.build, command.pack, command.help... I want to get all these modules at compile time so that I know what command is available. If you just want static if

Re: Making external types available to mixins

2018-11-24 Thread John Chapman via Digitalmars-d-learn
On Friday, 23 November 2018 at 21:49:55 UTC, Kagamin wrote: Well, just have all factories in one module and import it, then they will be visible. They're part of another library over which I have no control, but yes, I could still import them all and make life easier. import allfactories;

Re: D is supposed to compile fast.

2018-11-24 Thread Chris Katko via Digitalmars-d-learn
On Friday, 23 November 2018 at 10:00:17 UTC, Nicholas Wilson wrote: If you pass all the files on the command line then they all get (re)compiled. How are you supposed include files if not passing them to the compiler? I'm only using std.regex in one file, IIRC, so whatever the "proper"

Re: How to iterate getSymbolsByUDA

2018-11-24 Thread Eko Wahyudin via Digitalmars-d-learn
On Saturday, 24 November 2018 at 08:09:38 UTC, Stanislav Blinov wrote: On Saturday, 24 November 2018 at 03:48:12 UTC, Eko Wahyudin wrote: Hi all, anyone know how to iterate getSymbolsByUDA ? enum Attr; struct A { @Attr int a; int b; @Attr void foo() {} @Attr void foo(int) {}

How to get all modules in a package at CT?

2018-11-24 Thread Domain via Digitalmars-d-learn
I have a package named command, and many modules inside it, such as command.build, command.pack, command.help... I want to get all these modules at compile time so that I know what command is available.

Re: How to iterate getSymbolsByUDA

2018-11-24 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 24 November 2018 at 03:48:12 UTC, Eko Wahyudin wrote: Hi all, anyone know how to iterate getSymbolsByUDA ? enum Attr; struct A { @Attr int a; int b; @Attr void foo() {} @Attr void foo(int) {} } void main() { import std.traits; import std.stdio; alias