On Thursday, 17 September 2020 at 03:16:42 UTC, Paul Backus wrote:
On Thursday, 17 September 2020 at 03:14:08 UTC, JG wrote:
Perhaps there are other ways, but you can use enumerate. For
example
---
import std.algorithm;
import std.range;
import std.stdio;
void main() {
string s = "he
On Thursday, 17 September 2020 at 03:06:45 UTC, realhet wrote:
Anyone can help me telling how to decode these please?
so here's a cool trick to get hte other demanglers to help.
Just prepend
_D4name
to the string. so like:
$ ./ddemangle
_D4nameFAyaZE3het8keywords10KeywordCat
het.keywords.K
On Thursday, 17 September 2020 at 03:14:08 UTC, JG wrote:
Perhaps there are other ways, but you can use enumerate. For
example
---
import std.algorithm;
import std.range;
import std.stdio;
void main() {
string s = "hello";
s.enumerate.each!(x=>writeln(x[0],":",x[1]));
}
Worth knowi
On Thursday, 17 September 2020 at 03:06:45 UTC, realhet wrote:
I'm trying to get information from the JsonFile produced by
LDC2, but having no clue how to decode this:
For example:
header: KeywordCat kwCatOf(int k)
"deco" : "FAyaZE3het8keywords10KeywordCat",
That's a D mangle but just of on
On Thursday, 17 September 2020 at 00:51:54 UTC, dangbinghoo wrote:
hi,
is there any way to get the index for an element when iteration
using each!(x)?
I know I can do this using foreach statement, but I prefer
using the each template.
---
string s = "hello";
foreach(i, c; s) {
}
-
Hello,
I'm trying to get information from the JsonFile produced by LDC2,
but having no clue how to decode this:
For example:
header: KeywordCat kwCatOf(int k)
"deco" : "FAyaZE3het8keywords10KeywordCat",
The "deco" field contains the full name of the return type
het.keywords.KeywordCat, but
On Thursday, 17 September 2020 at 00:32:40 UTC, Cecil Ward
So can the result of declaring certain things with enum ever
have an _address_ then? (According to legit D code that is,
never mind the underlying implementation details, which may not
be observable)
No. Think of it as a named liter
hi,
is there any way to get the index for an element when iteration
using each!(x)?
I know I can do this using foreach statement, but I prefer using
the each template.
---
string s = "hello";
foreach(i, c; s) {
}
--
how can I get to ?
Thanks!
binghoo dang
On Wednesday, 16 September 2020 at 17:19:13 UTC, Adam D. Ruppe
wrote:
On Wednesday, 16 September 2020 at 17:12:47 UTC, Cecil Ward
wrote:
then is there any downside to just using enum all the time?
For a non-string array, enum may give runtime allocations that
static immutable won't.
General
On Wednesday, 16 September 2020 at 19:04:24 UTC, Vladimirs
Nordholm wrote:
Ah, I guess it boils down to this then. Doesn't really make it
"neater", but thank you for the tip!
IMO, just keep it as `version(Windows) {} else { ... }` if you
HAVE to instead of one of the workarounds people suggest
On Wednesday, 16 September 2020 at 19:04:24 UTC, Vladimirs
Nordholm wrote:
On Wednesday, 16 September 2020 at 18:54:45 UTC, Jacob Carlborg
wrote:
version (Windows)
enum windows = true;
else
enum windows = false;
static if (!windows)
{
// ... my code
}
Ah, I guess it boils down to
On Wednesday, 16 September 2020 at 18:54:45 UTC, Jacob Carlborg
wrote:
On 2020-09-16 19:53, Vladimirs Nordholm wrote:
Hello.
I wonder if there is a better way to compile something if the
current operating system is _not_ a specific platform.
For example, I only want some code to compile if t
On Wednesday, 16 September 2020 at 18:07:25 UTC, Ferhat Kurtulmuş
wrote:
On Wednesday, 16 September 2020 at 17:53:31 UTC, Vladimirs
Nordholm wrote:
Hello.
I wonder if there is a better way to compile something if the
current operating system is _not_ a specific platform.
For example, I only
On 2020-09-16 19:53, Vladimirs Nordholm wrote:
Hello.
I wonder if there is a better way to compile something if the current
operating system is _not_ a specific platform.
For example, I only want some code to compile if the operating system is
not Windows. Currently I do this:
version
On Wednesday, 16 September 2020 at 17:59:41 UTC, Remi wrote:
I tried to modify the hello.d example from your blog post. It
works without changes but when I tried to do a string
concatenation
Yeah, concatenation is one of the features that uses druntime,
and specifically, it is done through Ty
On Wednesday, 16 September 2020 at 17:53:31 UTC, Vladimirs
Nordholm wrote:
Hello.
I wonder if there is a better way to compile something if the
current operating system is _not_ a specific platform.
For example, I only want some code to compile if the operating
system is not Windows. Current
On Monday, 7 September 2020 at 22:13:20 UTC, Adam D. Ruppe wrote:
On Monday, 7 September 2020 at 20:55:54 UTC, IGotD- wrote:
I guess this was written before betterC existed.
Well, -betterC existed even then, but it was *completely*
useless. It didn't become useful until 2016 or 2017.
But ar
Hello.
I wonder if there is a better way to compile something if the
current operating system is _not_ a specific platform.
For example, I only want some code to compile if the operating
system is not Windows. Currently I do this:
version (Windows)
{
}
else
{
//
On Wednesday, 16 September 2020 at 17:12:47 UTC, Cecil Ward wrote:
then is there any downside to just using enum all the time?
For a non-string array, enum may give runtime allocations that
static immutable won't.
Generally think of enum as being replaced with the literal
representation and
A really stupid question, I fear.
If I have some kind of declaration of some ‘variable’ whose value
is strictly known at compile time and I do one of the following
(rough syntax)
either
enum foo = bar;
or
const foo = bar;
or
immutable foo = bar;
then is there any downside to just us
On Tuesday, 15 September 2020 at 01:49:13 UTC, James Blachly
wrote:
I wish to write a function including ∂x and ∂y (these are
trivial to type with appropriate keyboard shortcuts - alt+d on
Mac), but without a unicode byte order mark at the beginning of
the file, the lexer rejects the tokens.
On Wednesday, 16 September 2020 at 13:36:22 UTC, 60rntogo wrote:
except that I tried doing this in foo.d and then the compiler
yelled at me.
Yeah, this is the one case where the compiler is picky about the
directory structure and filename. It *must* be package.d.
(blargh.)
On Wednesday, 16 September 2020 at 13:33:34 UTC, Adam D. Ruppe
wrote:
They define an additional file
std/package.d
Thanks for a quick answer. I suspected it must have been
something like that, except that I tried doing this in foo.d and
then the compiler yelled at me.
On Wednesday, 16 September 2020 at 13:30:57 UTC, 60rntogo wrote:
then saying "import foo : Bar;" yields an error "module foo is
in file 'foo.d' which cannot be read". I'm curious, how is this
behavior achieved in the standard library?
To expand on Adam's reply:
https://dlang.org/spec/modul
I have noticed that if I want to import
std.algorithm.searching.find, each of the following will work:
---
import std.algorithm.searching : find;
import std.algorithm : find;
import std : find;
---
(Although, the last one is probably not the greatest idea.)
However, if I write my own module:
On Wednesday, 16 September 2020 at 13:30:57 UTC, 60rntogo wrote:
I'm curious, how is this behavior achieved in the standard
library?
They define an additional file
std/package.d
(and std/algorithm/package.d btw)
that lists off
module std;
public import std.algorithm;
public import std.ever
On Wednesday, 16 September 2020 at 07:38:26 UTC, Dominikus Dittes
Scherkl wrote:
We only need to define which properties a character need to be
allowed in an identifier.
I think the following change in the grammar would be sufficient:
Identifier:
IdentifierStart
IdentifierStart Identif
On Wednesday, 16 September 2020 at 09:59:59 UTC, Jan Hönig wrote:
I have toyed with the compose template in std.functional and
ran into some problems.
rikki_cattermole on discord helped me a lot to solve my problem.
However, what still remains (for me) to understand is why.
Source code for `co
On Wed, Sep 16, 2020 at 12:50 PM Daniel Kozak wrote:
>
>
> On Wed, Sep 16, 2020 at 12:00 PM Jan Hönig via Digitalmars-d-learn <
> digitalmars-d-learn@puremagic.com> wrote:
>
>> ...
>>
>> My main question is why? Is there something, which I am missing,
>> that explains, why it is beneficial to ret
On Wednesday, 16 September 2020 at 10:50:06 UTC, Daniel Kozak
wrote:
On Wed, Sep 16, 2020 at 12:00 PM Jan Hönig via
Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote:
...
My main question is why? Is there something, which I am
missing, that explains, why it is beneficial to retu
On Wed, Sep 16, 2020 at 12:00 PM Jan Hönig via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> ...
>
> My main question is why? Is there something, which I am missing,
> that explains, why it is beneficial to return a templated
> function?
>
> (maybe, because I might want to comp
I have toyed with the compose template in std.functional and ran
into some problems.
rikki_cattermole on discord helped me a lot to solve my problem.
However, what still remains (for me) to understand is why.
Source code for `compose`:
https://github.com/dlang/phobos/blob/master/std/functional
On Wednesday, 16 September 2020 at 00:22:15 UTC, Steven
Schveighoffer wrote:
Someone should verify that the character you want to use for a
symbol name is actually considered a letter or not. Using
phobos to prove this is kind of self-defeating, as I'm pretty
sure it would be in league with D
33 matches
Mail list logo