On 04/08/2019 12:56 PM, Yuxuan Shui wrote:
In this example:
const(AliasSeq!(int, int)) a;
I would expect that to mean a type list (int, int) that cannot be
modified, meaning that it is not allowed to change it from (int, int).
pragma(msg, typeof(a)); // (int, int)
Makes sense
On Saturday, 6 April 2019 at 12:20:28 UTC, Alex wrote:
Error: variable
`std.traits.ParameterDefaults!(foo).Get!1u.Get` only parameters
or stack based variables can be `inout`
so i think that is a bug in the phobos library
see:
On 4/8/2019 7:39 AM, Alex wrote:
My point is that you are going ape shit over using T.stringof, you posted no
I mean, half the shit in __traits looks like it could be in std.traits and there
Please tone down both the aggressiveness and the use of cuss words, and use
professional demeanor.
On Monday, 8 April 2019 at 18:04:28 UTC, kdevel wrote:
On Sunday, 7 April 2019 at 17:16:12 UTC, Seb wrote:
---
["a": 1].byPair.array.sort!((a, b) => a.value <
a.value).release.each!writeln;
---
What's the purpose of .release? The documentation in
On Monday, 8 April 2019 at 19:54:28 UTC, WhatMeWorry wrote:
Now, I've studied the on-line documentation and even walked
through the code somewhat but I'm not making an headway.
Very relatable. My tips so far are:
- Look for projects in github with a similar structure to yours
and look at
On Monday, 8 April 2019 at 19:43:11 UTC, Julian wrote:
On Monday, 8 April 2019 at 19:29:33 UTC, 4544fa8d wrote:
It's really not possible to call functions in modules like in
any other languages? :S
What some other languages do is collect all of those calls into
an
implicit function that's
In this example:
const(AliasSeq!(int, int)) a;
pragma(msg, typeof(a)); // (int, int)
This kind of make sense, since AliasSeq is not a "single" type.
But silently dropping const seems bad, the compiler should
probably report an error/warning in this case?
I've been using DUB for several years and I've gotten it to work
generally. But I've been trying to troubleshoot a DUB issue for
two days now and I've come to the conclusion, I don't really
understand DUB and I'm tired of muddling through. (Surely it
hurts that I've never been exposed to a
On Monday, 8 April 2019 at 18:04:28 UTC, kdevel wrote:
What's the purpose of .release? The documentation in
https://dlang.org/phobos/std_range.html#.SortedRange.release is
rather monosyllabic.
The sort function returns a SortedRange, which is usually an
array wrapper with the extra type
On Monday, 8 April 2019 at 19:29:33 UTC, 4544fa8d wrote:
It's really not possible to call functions in modules like in
any other languages? :S
What some other languages do is collect all of those calls into an
implicit function that's called before main(). What D does is run
that code at
On Monday, 8 April 2019 at 19:05:33 UTC, Julian wrote:
Shorter:
string root_dir() {
static string cache;
return cache ? cache : (cache = dirName(thisExePath()));
}
This might spam readlink() syscalls if they somehow return the
It's really not possible to call functions in
On Monday, 8 April 2019 at 18:54:10 UTC, Julian wrote:
@property
string root_dir() {
static string cache;
static bool isInit = false;
if (!isInit) {
isInit = true;
cache = dirName(thisExePath());
}
return cache;
}
Shorter:
string
On Monday, 8 April 2019 at 18:47:42 UTC, 4544fa8d wrote:
On Monday, 8 April 2019 at 18:41:00 UTC, Adam D. Ruppe wrote:
Did you put your code inside a main() function?
I want to make constant with path to directory containing
executable. This line is above main():
On Monday, 8 April 2019 at 18:38:58 UTC, 4544fa8d wrote:
Hello,
I have "hello world" application. I imported std.file, executed
thisExePath() and now I have this error:
dmd -m64 -of=../../bin/manager -release ./src/manager.d
On Monday, 8 April 2019 at 18:41:00 UTC, Adam D. Ruppe wrote:
Did you put your code inside a main() function?
I want to make constant with path to directory containing
executable. This line is above main():
-
const ROOT_DIR = dirName(thisExePath());
On Monday, 8 April 2019 at 18:38:58 UTC, 4544fa8d wrote:
Whats going on? Why I cant build my executable file?
Did you put your code inside a main() function?
Hello,
I have "hello world" application. I imported std.file, executed
thisExePath() and now I have this error:
dmd -m64 -of=../../bin/manager -release ./src/manager.d
/usr/include/dmd/phobos/std/file.d(3252): Error: readlink
On Monday, 8 April 2019 at 17:13:32 UTC, Seb wrote:
On Monday, 8 April 2019 at 08:31:33 UTC, Dennis wrote:
On Monday, 8 April 2019 at 07:53:23 UTC, Robert M. Münch wrote:
Why does DMD not give a hint, that an import from the
standard lib might be missing? I find these explicit import
On Sunday, 7 April 2019 at 17:16:12 UTC, Seb wrote:
---
["a": 1].byPair.array.sort!((a, b) => a.value <
a.value).release.each!writeln;
---
What's the purpose of .release? The documentation in
https://dlang.org/phobos/std_range.html#.SortedRange.release is
rather monosyllabic.
On Monday, 8 April 2019 at 08:31:33 UTC, Dennis wrote:
On Monday, 8 April 2019 at 07:53:23 UTC, Robert M. Münch wrote:
Why does DMD not give a hint, that an import from the standard
lib might be missing? I find these explicit import statements
very annyoing.
There currently are a few
On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote:
In the subsequent sections, I show both long and short
(eponymous) forms of enum and function templates.
Forgot to say...
I'm typing in the examples as I go and so far I haven't been
lost. Even when you don't come right out and say
On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote:
You should have read further along in that chapter :-)
LOL! Actually, after reading Adam's reply, I dug back into your
book and I'm starting to get a reasonable handle on this. I must
say, I like the slow-but-steady intro you
On Monday, 8 April 2019 at 12:23:28 UTC, Ron Tarrant wrote:
First, the question...
In Michael Parker's book, "Learning D," (Packt, 2015) on page
160 he gives an example of a basic template:
template MyTemplate(T)
{
T val;
void printVal()
{
import std.stdio : writeln;
On Monday, 8 April 2019 at 13:42:31 UTC, Michal Minich wrote:
I used dmd 2.085.0 and 2.085.1 on Win 10
I followed sample at
https://vibed.org/blog/posts/a-scalable-chat-room-service-in-d
Just the beginning, where you you should compile hello word web
app.
command line: "dub"
compilation
On Monday, 8 April 2019 at 12:26:28 UTC, Adam D. Ruppe wrote:
On Sunday, 7 April 2019 at 17:42:58 UTC, Alex wrote:
That is blatantly wrong. The code works EXACTLY the same way
with and without using stringof.
In some cases, yeah. In the general case, no.
Your import hack* is only there
On Monday, 8 April 2019 at 14:27:11 UTC, JN wrote:
Java uses @ for annotations too. Pascal uses @ for "address
of", like & in D.
Just one of the many reasons I balked at Java... many MANY
reasons.
Thanks, JN.
On Monday, 8 April 2019 at 14:19:04 UTC, XavierAP wrote:
On Monday, 8 April 2019 at 11:58:49 UTC, Ron Tarrant wrote:
And while I'm asking, does an underscore have special meaning
when used either at the beginning or end of a variable name?
In D, @ is used as Adam has explained as a prefix
On Monday, 8 April 2019 at 14:19:04 UTC, XavierAP wrote:
The only other example of language using @, in an almost but
not quite completely different way, is C#. It's also a prefix
that allows you to define names that would collide with
reserved words, for example string @class = "menu"; Of
On Monday, 8 April 2019 at 11:58:49 UTC, Ron Tarrant wrote:
And while I'm asking, does an underscore have special meaning
when used either at the beginning or end of a variable name?
In D, @ is used as Adam has explained as a prefix indicating
attributes (either user-defined ones or,
Le 07/04/2019 à 19:16, Seb via Digitalmars-d-learn a écrit :
Then you can do:
---
["a": 1].byPair.array.sort!((a, b) => a.value < a.value).release.each!writeln;
---
You'll have a sorted array with key and value props.
That's what I would do: just operating on an array of {k,v} pairs.
--
I used dmd 2.085.0 and 2.085.1 on Win 10
I followed sample at
https://vibed.org/blog/posts/a-scalable-chat-room-service-in-d
Just the beginning, where you you should compile hello word web
app.
command line: "dub"
compilation finishes ok. then it prints "Linking..." and I get
window
On Monday, 8 April 2019 at 12:40:10 UTC, Adam D. Ruppe wrote:
You don't need template keyword for the majority of cases
because the compiler lets you do shortcuts.
Thanks, Adam. Good to know.
(maybe I am looking at the wrong part of the book, it is hard
to find the right section/page number
Well, that was quick!
Thanks Adam, Kagamin, and Alex.
On Monday, 8 April 2019 at 12:23:28 UTC, Ron Tarrant wrote:
But in "Programming in D," (self, 2009-2018) by Ali Çehreli,
there's no mention of the 'template' keyword in any of his
examples.
You don't need template keyword for the majority of cases because
the compiler lets you do shortcuts.
On Sunday, 7 April 2019 at 17:42:58 UTC, Alex wrote:
That is blatantly wrong. The code works EXACTLY the same way
with and without using stringof.
In some cases, yeah. In the general case, no.
Your import hack* is only there because of stringof. Using the
local symbol, there is no need to
I'm digging into templates in an attempt to understand the
signals-n-slots replacement for the observer pattern, but I've
got a question I can't seem to find an answer for and an example
for which I'm unable to solve the error.
First, the question...
In Michael Parker's book, "Learning D,"
On Monday, 8 April 2019 at 11:58:49 UTC, Ron Tarrant wrote:
Would someone please tell me what an at sign (@) means when
it's used like this:
bool isLeaf() @property
In that case, it means nothing. We just defined the word to be
`@property`, with the @ included. So it is just part of the
Maybe just use mixin template?
mixin template f(alias values)
{
static foreach(v;values)
mixin("bool " ~ v ~ " = false;");
}
int main()
{
enum string[] a=["a","b"];
mixin f!a;
return 0;
}
https://dlang.org/spec/function.html#property-functions
On Monday, 8 April 2019 at 11:58:49 UTC, Ron Tarrant wrote:
This is frustrating and makes me feel like a complete newb.
Worse, it's impossible to search for. Ever try Googling a
single character?
The D documentation also doesn't seem to explain the meaning of
this or any other token. Sure,
On Sunday, 7 April 2019 at 14:49:20 UTC, Archie Allison wrote:
The codebase is a reasonable size so too big (and proprietary)
to share.
You can reduce it to a minimal example that doesn't work. Static
variables are thread local by default in D unless they are marked
as shared or __gshared.
This is frustrating and makes me feel like a complete newb.
Worse, it's impossible to search for. Ever try Googling a single
character?
The D documentation also doesn't seem to explain the meaning of
this or any other token. Sure, most of them are obvious, but this
one eludes me. All I can
On Monday, 8 April 2019 at 07:53:23 UTC, Robert M. Münch wrote:
Why does DMD not give a hint, that an import from the standard
lib might be missing? I find these explicit import statements
very annyoing.
There currently are a few hard-coded import hints for common
functions:
On Monday, 8 April 2019 at 07:53:23 UTC, Robert M. Münch wrote:
On 2019-04-07 19:28:02 +, Dennis said:
Did you import it? import std.algorithm;
:-/ of course not...
Why does DMD not give a hint, that an import from the standard
lib might be missing?
It does do this, so the question
On 2019-04-07 19:28:02 +, Dennis said:
Did you import it? import std.algorithm;
:-/ of course not...
Why does DMD not give a hint, that an import from the standard lib
might be missing? I find these explicit import statements very
annyoing. DMD should build up a database of stuff it
45 matches
Mail list logo