Re: Concatenating compile time sequences

2019-03-01 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Mar 02, 2019 at 02:16:22AM +, Victor Porton via Digitalmars-d-learn wrote: > I try to split a compile time sequence of types and names into a > sequence consisting of two-element subsequences (each of type and > name). > > That is, I want to transform: > > (int, "x", float, "y",

Re: How to cast arrays?

2019-03-01 Thread Matheus via Digitalmars-d-learn
On Saturday, 2 March 2019 at 02:14:01 UTC, Murilo wrote: How do I cast a ubyte[] into uint[]? It keeps raising an error, I have read the documentation saying there are restrictions for that concerning the length of the arrays. By the way here is how: void foo(){ ubyte[] x = [1,2]; auto

Re: How to cast arrays?

2019-03-01 Thread Matheus via Digitalmars-d-learn
On Saturday, 2 March 2019 at 02:14:01 UTC, Murilo wrote: How do I cast a ubyte[] into uint[]? It keeps raising an error, I have read the documentation saying there are restrictions for that concerning the length of the arrays. https://dlang.org/spec/expression.html#cast_expressions "Casting

Re: How to cast arrays?

2019-03-01 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Mar 02, 2019 at 02:14:01AM +, Murilo via Digitalmars-d-learn wrote: > How do I cast a ubyte[] into uint[]? It keeps raising an error, I have > read the documentation saying there are restrictions for that > concerning the length of the arrays. That depends on what you're trying to

Concatenating compile time sequences

2019-03-01 Thread Victor Porton via Digitalmars-d-learn
I try to split a compile time sequence of types and names into a sequence consisting of two-element subsequences (each of type and name). That is, I want to transform: (int, "x", float, "y", double, "z") into (AliasSeq!(int, "x"), AliasSeq!(float, "y"), AliasSeq!(double, "z")) I am

How to cast arrays?

2019-03-01 Thread Murilo via Digitalmars-d-learn
How do I cast a ubyte[] into uint[]? It keeps raising an error, I have read the documentation saying there are restrictions for that concerning the length of the arrays.

Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread Cym13 via Digitalmars-d-learn
On Friday, 1 March 2019 at 11:38:51 UTC, BoQsc wrote: On Friday, 1 March 2019 at 09:27:33 UTC, Cym13 wrote: On Friday, 1 March 2019 at 09:00:43 UTC, BoQsc wrote: I've installed D compiler, and when i try to run a D script with filename without an extension/file type named: program via:

Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread Cym13 via Digitalmars-d-learn
On Friday, 1 March 2019 at 14:50:45 UTC, Jesse Phillips wrote: On Friday, 1 March 2019 at 11:38:51 UTC, BoQsc wrote: "And indeed rdmd won't call your script if it doesn't have the proper extension." Then why does Dlang Tour includes shebang: #!/usr/bin/env rdmd Instead of the one you

Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread Seb via Digitalmars-d-learn
On Friday, 1 March 2019 at 11:38:51 UTC, BoQsc wrote: On Friday, 1 March 2019 at 09:27:33 UTC, Cym13 wrote: On Friday, 1 March 2019 at 09:00:43 UTC, BoQsc wrote: [...] In such questions it's important to show your shebang since that's what runs your script. Given your symptoms I guess

Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread Seb via Digitalmars-d-learn
On Friday, 1 March 2019 at 16:45:38 UTC, Seb wrote: On Friday, 1 March 2019 at 14:50:45 UTC, Jesse Phillips wrote: I don't know what value it brings with the -i switch existing. Almost none, except that it's twice as slow as DMD because it needs to run DMD twice to learn about all the

Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread Seb via Digitalmars-d-learn
On Friday, 1 March 2019 at 14:50:45 UTC, Jesse Phillips wrote: I don't know what value it brings with the -i switch existing. Almost none, except that it's twice as slow as DMD because it needs to run DMD twice to learn about all the dependencies. It's only useful for a few small things

Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 1 March 2019 at 11:38:51 UTC, BoQsc wrote: "And indeed rdmd won't call your script if it doesn't have the proper extension." Then why does Dlang Tour includes shebang: #!/usr/bin/env rdmd Instead of the one you mentioned, that is fool proof. (#!/bin/dmd -run) Is that an

Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread BoQsc via Digitalmars-d-learn
On Friday, 1 March 2019 at 09:27:33 UTC, Cym13 wrote: On Friday, 1 March 2019 at 09:00:43 UTC, BoQsc wrote: I've installed D compiler, and when i try to run a D script with filename without an extension/file type named: program via: ./program I'm getting and error:

Re: How to attach function attributes to delegate type?

2019-03-01 Thread Vijay Nayar via Digitalmars-d-learn
On Wednesday, 27 February 2019 at 20:45:33 UTC, Alex wrote: On Wednesday, 27 February 2019 at 20:03:15 UTC, Q. Schroll wrote: For any type constructors like const, I can use ConstOf!T to get `T` with const attached. For a delegate/function type DG, e.g. int delegate(int), how can I get the

Re: My template tuple code does not compile

2019-03-01 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 27 February 2019 at 22:45:03 UTC, Victor Porton wrote: I rewrote it again: https://github.com/vporton/struct-params-dlang/blob/f50f7e5919f90b1d06bf0cc08e3055548aad1797/source/struct_params.d But it does not work :-( What is my error? source/struct_params.d(43,60): Error:

Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread Cym13 via Digitalmars-d-learn
On Friday, 1 March 2019 at 09:00:43 UTC, BoQsc wrote: I've installed D compiler, and when i try to run a D script with filename without an extension/file type named: program via: ./program I'm getting and error: vaidas@SATELLITE-L855:~/Desktop$ ./program Error: module `program` is in file

Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread BoQsc via Digitalmars-d-learn
I've installed D compiler, and when i try to run a D script with filename without an extension/file type named: program via: ./program I'm getting and error: vaidas@SATELLITE-L855:~/Desktop$ ./program Error: module `program` is in file './program.d' which cannot be read import path[0] = .