Re: https://run.dlang.io/ vs All dmd compilers (2.060 - latest)

2022-02-27 Thread Mike Parker via Digitalmars-d-learn

On Monday, 28 February 2022 at 01:51:52 UTC, meta wrote:

Is the source of 'run.dlang.io' available somewhere?


The link to the github repository is at the top of the 
run.dlang.io page:


https://github.com/dlang-tour/core

Issues should be reported there.


Re: https://run.dlang.io/ vs All dmd compilers (2.060 - latest)

2022-02-27 Thread meta via Digitalmars-d-learn

Is the source of 'run.dlang.io' available somewhere?


Set output location for dub --single

2022-02-27 Thread Chris Piker via Digitalmars-d-learn

Hi D

Coming from a python background it's worked well to organize my D 
projects as a dub `sourceLibrary` and then to put top level 
programs in a directory named `scripts` that are just dub single 
file projects.  So the layout looks like this:


```
rootdir/
  |
  +- mypackage/
  ||
  |+- libfile1.d
  |+- libfile2.d
  |
  +- scripts/
  ||
  |+- prog1.d
  |+- prog2.d
  |
  +- dub.json
```
In dub.json "scripts" are ignored via 
`"excludedSourceFiles":["scripts/*"]`.  Each "script" includes 
`mypackage` via:

```d
#!/usr/bin/env dub
/+ dub.sdl:
   dependency "mypackage" version="*" path=".."
   dependency (other nonlocal packages)
+/
```

...and all seems rather familiar to a python programmer and I 
avoid the complexities of dub sub-projects.


For building the individual "scripts" as binaries, it be nice 
output the binaries to another directory, say `bin`.  Is there an 
override for the dub command line that would specify the output 
location?  Maybe something like:

```bash
dub --single -o targetPath=./bin ./script/prog1.d
```
?
(Here the mythical argument `-o` overrides a single build 
configuration setting.)


After reading over the dub documentation I don't see a general 
way to override project options via the command line, but maybe 
it's there and I couldn't understand what the dub docs were 
trying to say.




https://run.dlang.io/ vs All dmd compilers (2.060 - latest)

2022-02-27 Thread Matheus via Digitalmars-d-learn

Hi,

In "https://run.dlang.io"; is the "All dmd compilers (2.060 - 
latest)" not working anymore?


Because I always get: "Server error:"

I've been trying for like 2 weeks and I always get this "Server 
Error: " message.


I even tried with this basic example:

void main(){
import std.algorithm, std.stdio;
"Starting program".writeln;
enum a = [ 3, 1, 2, 4, 0 ];
static immutable b = sort(a);
pragma(msg, "Finished compilation: ", b);
}

After one minute I think I get:


rdmd playground.d


Server error:

Thanks,

Matheus.


Re: Simple way to handle rvalues and templates.

2022-02-27 Thread Salih Dincer via Digitalmars-d-learn

On Sunday, 27 February 2022 at 06:11:28 UTC, Ali Çehreli wrote:


I don't like the name readFrom() yet but that works. :)



It seems very delicious, can stay as read():

```d
auto read(T, Endian E = Endian.bigEndian, R)
 (R range) {
  import bop = std.bitmanip;
  return bop.read!(T, E)(range);
}

void main() {
  import std.system;

  ubyte[8] d = [ 0xFF, 0xFF, 0xFF, 0xFF,
 0xAA, 0xAA, 0xFF, 0xFF ];

  ushort us = d[4..6].read!ushort;
  assert(us == 0x);
}
```
SDB79