On Wednesday, 5 February 2020 at 01:06:46 UTC, rous wrote:
This is an example program that illustrates the issue:
import std.variant: Algebraic, This;
import std.stdio: writeln;
alias Foo = Algebraic!(This[], int);
void main()
{
Foo x = 5;
Foo y = 10;
Foo z = [x,y];
pragma(msg, t
On Tuesday, 4 February 2020 at 12:05:16 UTC, rikki cattermole
wrote:
On 05/02/2020 12:55 AM, rous wrote:
On Tuesday, 4 February 2020 at 11:47:49 UTC, rikki cattermole
wrote:
It did not change type.
"Algebraic data type restricted to a closed set of possible
types. It's an alias for VariantN w
On 2/4/20 10:35 AM, seany wrote:
router.post("/archive", &savedata);
router.get("/archive", &savedata); //also tested without this line
[snip]
Internal error information:
No routes match path '/a'
Did you go to /a? Looks like you only registered routes for /archive.
-Steve
On Tuesday, 4 February 2020 at 19:21:07 UTC, mark wrote:
Ah, thank you.
And if I'm doing *separate* individual projects, for an app,
dub creates source/app.d (which I rename src/app.d).
But what should it be for a library? Should it be src/package.d
along with any supporting src/one.d src/tw
On Tuesday, 4 February 2020 at 09:21:17 UTC, Andre Pany wrote:
On Tuesday, 4 February 2020 at 09:13:48 UTC, mark wrote:
Is it possible to create a dub project that has one library
and one or more executables (that use the library)? If so,
could someone point me to the docs for this since I coul
* sorry, i meant 'archive'
This is a production server. Is there anything i am doing wrong?
Please consider the code:
import vibe.vibe;
import std.conv;
import std.file;
import std.stdio;
ushort port = 5502;
void main(char[][] args)
{
auto router = new URLRouter;
router.post("/archive", &savedata);
router.get("/archive", &savedata); //also tested wit
On 05/02/2020 2:11 AM, Paul Backus wrote:
On Tuesday, 4 February 2020 at 11:45:50 UTC, rous wrote:
I'm defining an Algebraic type like this:
alias Expr = Algebraic!(This[char], string, int);
However, when I create an Expr from an associative array of chars and
Exprs, the Exprs seem to change fr
On Tuesday, 4 February 2020 at 11:45:50 UTC, rous wrote:
I'm defining an Algebraic type like this:
alias Expr = Algebraic!(This[char], string, int);
However, when I create an Expr from an associative array of
chars and Exprs, the Exprs seem to change from Algebraic to
VariantN!32LU types. This
On 05/02/2020 12:55 AM, rous wrote:
On Tuesday, 4 February 2020 at 11:47:49 UTC, rikki cattermole wrote:
It did not change type.
"Algebraic data type restricted to a closed set of possible types.
It's an alias for VariantN with an appropriately-constructed maximum
size."
https://dlang.org/p
On Tuesday, 4 February 2020 at 11:47:49 UTC, rikki cattermole
wrote:
It did not change type.
"Algebraic data type restricted to a closed set of possible
types. It's an alias for VariantN with an
appropriately-constructed maximum size."
https://dlang.org/phobos/std_variant.html#.Algebraic
O
I'm defining an Algebraic type like this:
alias Expr = Algebraic!(This[char], string, int);
However, when I create an Expr from an associative array of chars
and Exprs, the Exprs seem to change from Algebraic to
VariantN!32LU types. This is illustrated in the following error
message:
cannot pas
It did not change type.
"Algebraic data type restricted to a closed set of possible types. It's
an alias for VariantN with an appropriately-constructed maximum size."
https://dlang.org/phobos/std_variant.html#.Algebraic
On Tuesday, 4 February 2020 at 10:06:03 UTC, Johann Lermer wrote:
In C, this would not be valid. So the question for me now is:
is const char* in D different from C?
Yes, const char* in D reads as const(char*), so it is a char*
that cannot be modified.
This is similar to the C code:
char *co
Hi,
I'm just wondering about defining const pointers and if there's a
difference in C and D.
in C, this works:
const char* text = "Hello";
text = "world";
but in D it doesn't, because the char* is const. Ff I would like
tho have the same behaviour in D as in C, I need to write:
const (cha
On Tuesday, 4 February 2020 at 09:13:48 UTC, mark wrote:
Is it possible to create a dub project that has one library and
one or more executables (that use the library)? If so, could
someone point me to the docs for this since I couldn't find
this in the dub docs?
Aside: I'm learning D to give
Is it possible to create a dub project that has one library and
one or more executables (that use the library)? If so, could
someone point me to the docs for this since I couldn't find this
in the dub docs?
Aside: I'm learning D to give me something approaching the
convenience of Python with
Thanks for that thorough and careful explanation.
Since I'm trying to learn to write D in good style and want my
code to be reliable and maintainable, I've now switched to using
"" rather than null.
On Tuesday, February 4, 2020 12:52:05 AM MST JN via Digitalmars-d-learn
wrote:
> int[int] a = [5: 7];
>
> void main()
> {
> }
>
>
> This fails because apparently [5: 7] is a "non-const expression".
> How? Why?
>
> Yes, I know I can just init in a static this() section, but that
> feels like a bad
On Tuesday, 4 February 2020 at 07:52:05 UTC, JN wrote:
int[int] a = [5: 7];
void main()
{
}
This fails because apparently [5: 7] is a "non-const
expression". How? Why?
Yes, I know I can just init in a static this() section, but
that feels like a bad workaround.
AFAIK is not implemented.
On Tuesday, February 4, 2020 12:33:42 AM MST mark via Digitalmars-d-learn
wrote:
> I have just discovered that D seems to treat empty and null
> strings as the same thing:
>
> // test.d
> import std.stdio;
> import std.string;
> void main()
> {
> string x = null;
> writeln("x = \"",
21 matches
Mail list logo