On Tuesday, 5 December 2023 at 03:36:04 UTC, Steven Schveighoffer
wrote:
Are you using -checkaction=context?
Right.
[...]
For reference:
https://issues.dlang.org/show_bug.cgi?id=22374
https://issues.dlang.org/show_bug.cgi?id=22902
https://issues.dlang.org/show_bug.cgi?id=19937
You even repo
On Sunday, 24 December 2023 at 14:19:18 UTC, Renato wrote:
I was trying to use a library (fswatch) for watching the file
system
Watching for what?
[...]
My code is really basic, when the directory modified timestamp
changes, I list the directory entries with `dirEntries` and
then call `dirE
On Sunday, 24 December 2023 at 20:00:15 UTC, Renato wrote:
I asked what could be causing an Exception in my code to happen
as that was quite unexpected.
As I already wrote: Your code tries to fetch the meta-data for an
object that does not exist.
[..]
Have you ever seen a symlink like the o
On Tuesday, 26 December 2023 at 21:09:05 UTC, Renato wrote:
On Sunday, 24 December 2023 at 21:18:44 UTC, kdevel wrote:
[...]
I would have expected you asking questions like "Which program
might have generated that symlink?", "How do I get the
meta-data from the
symlink and not from the file it
On Saturday, 3 February 2024 at 02:20:13 UTC, Paul Backus wrote:
On Friday, 2 February 2024 at 23:25:37 UTC, Chris Katko wrote:
The auto solution won't work for a struct however which I'm
using:
```D
struct procTable{ //contains all the fields inside a file I'm
parsing
uint time;
int p
On Thursday, 8 February 2024 at 15:00:54 UTC, Kevin Bailey wrote:
By all means, please share with us how you would have written
that just as elegantly but "correct".
Elegant and correct is this version:
```d
import std.stdio;
int main()
{
char[] something = ['a', 'b', 'c'];
w
On Thursday, 8 February 2024 at 16:54:36 UTC, Kevin Bailey wrote:
[...]
On Thursday, 8 February 2024 at 15:26:16 UTC, kdevel wrote:
Elegant and correct is this version:
```d
import std.stdio;
int main()
{
char[] something = ['a', 'b', 'c'];
writeln("len: ", something.length);
How do I search for
i"
in the forum? I get the following errors:
i" -> Error: malformed MATCH expression: [i"] (1)
i\" -> Error: malformed MATCH expression: [i\"] (1)
'i"' -> Error: malformed MATCH expression: ['i"'] (1)
`i"` -> Error: malformed MATCH expression: [`i"`] (1)
"i
The DIP 1036e is not listed in
https://github.com/dlang/DIPs/tree/master/DIPs
is this intentional?
On Saturday, 10 September 2022 at 08:48:39 UTC, Andrej Mitrovic
wrote:
[...]
I wish the compiler would rewrite scope(failure) to use chained
exceptions. Otherwise any exceptions thrown within
scope(failure) can end up losing information about what was the
original exception that was thrown.
```d
@safe:
void foo ()
{
import std.typecons : SafeRefCounted;
SafeRefCounted!int s;
}
unittest {
import std.exception : assertNotThrown;
assertNotThrown (foo);
}
```
```
$ dmd -unittest -main -run sr.d
sr.d(6): Error: `@safe` function `sr.foo` cannot call `@system`
destructor `s
On Sunday, 24 March 2024 at 19:31:19 UTC, Csaba wrote:
I know that benchmarks are always controversial and depend on a
lot of factors. So far, I read that D performs very well in
benchmarks, as well, if not better, as C.
I wrote a little program that approximates PI using the Leibniz
formula.
```test.d
void main ()
{
int [] v = new int [10];
}
```
$ [...]linux/bin32/dmd test
$ gdb test
[...]
(gdb) r
[...]
Program received signal SIGILL, Illegal instruction.
0x0809ad14 in
_D2gc4impl12conservativeQw3Gcx10smallAllocMFNbkKkkxC8TypeInfoZPv
()
[...]
(gdb) disass
[...]
0x0809ad14
<_D2
On Thursday, 27 February 2020 at 07:44:57 UTC, Seb wrote:
On Thursday, 27 February 2020 at 00:36:49 UTC, kdevel wrote:
[...]
Program received signal SIGILL, Illegal instruction.
[...]
Does this exception relate to [1] and shall I file a bug or do
I have to decommission my PIII?
[...]
On Thursday, 27 February 2020 at 18:07:40 UTC, Rainer Schuetze
wrote:
"If this is an issue, please file a bug report."
Issue 20621 - Since DMD 2.087.0: 32 Bit Linux now uses XMM
registers: SIGILL, Illegal instruction on intel Pentium III
On Sunday, 1 March 2020 at 20:58:42 UTC, p.shkadzko wrote:
pragma(inline) static int toIdx(T)(Matrix!T m, in int i, in int
j)
{
return m.cols * i + j;
}
This is row-major order [1]. BTW: Why don't you make toIdx a
member of Matrix? It saves one parameter. You may also define
opIndex as
On Sunday, 8 March 2020 at 17:28:33 UTC, Robert M. Münch wrote:
[...]
But I have to do:
DateTime dt =
DateTime.fromISOExtString(split("2018-11-06T16:52:03+01:00",
regex("\\+"))[0]);
You don't need a regex. split (..., '+') seems to suffice here.
IMO such a string should be feedable directl
On Thursday, 27 February 2020 at 19:24:39 UTC, Johan wrote:
LDC will work fine if told what processor you have:
https://d.godbolt.org/z/5hrzgm
-m32 -mcpu=pentium3 (-mcpu=native should also work).
When I "cross compile" on an AMD 64 Bit machine for pentium3
[AMD 64 bit] $ ldc2 -m32 -mcpu=
On Monday, 13 April 2020 at 14:42:25 UTC, Marius Cristian Baciu
wrote:
[...] I am having some trouble locating a symbol referenced in
rt/sections_elf_shared.d (__tls_get_addr).
Could someone tell me where does the runtime expect to retrieve
its implementation from
$ gdb test
(gdb) b __tls_get_
Sorry for this lengthy post:
```x.d
void foo (T) ()
{
import std.experimental.checkedint;
alias CT = Checked!(T, Throw);
CT a = CT.min;
CT x;
--x;
CT b = x;
CT c = a / b;
}
void bar (T) ()
{
import std.stdio;
try foo!T ();
catch (Exception e)
writefln ("caught
On Friday, 17 April 2020 at 04:29:06 UTC, Meta wrote:
Unlike C/C++, char is not a numeric type in D; It's a UTF-8
code point:
Thanks, it's a code /unit/. main reads now:
void main ()
{
bar!ubyte;
bar!byte;
bar!ushort;
bar!short;
bar!uint;
bar!int;
bar!ulong;
bar!long;
}
On Friday, 17 April 2020 at 12:59:20 UTC, Simen Kjærås wrote:
[Deleted text makes sense]
And assigning from an int to a short may discard data, so it's
statically disallowed by Checked.
This is a deliberate design choice, and the appropriate way to
handle it is with a cast:
unittest {
im
On Saturday, 18 April 2020 at 08:39:52 UTC, tsbockman wrote:
[...]
You also get a deprecation message, about an integral
promotion not being performed. I believe the result is
correct and the warning can be ignored.
So the warning is a bug?
The deprecation message is a consequence of a (ve
On Sunday, 3 May 2020 at 15:13:48 UTC, H. S. Teoh wrote:
On Sun, May 03, 2020 at 02:53:21PM +, Baby Beaker via
Digitalmars-d-learn wrote:
How can I assign a variable in “if” condition in Dlang?
if (auto obj = someFunction(...)) {
// use obj here, it's guaranteed to
Today I came across this:
~~~id.d
import std.stdio : writeln;
T foo (T) (T s)
{
__PRETTY_FUNCTION__.writeln;
return s;
}
short foo (short s)
{
__PRETTY_FUNCTION__.writeln;
return s;
}
T id (T) (T t)
{
return t;
}
int main ()
{
foo (1);
foo (1L);
foo (id (1));
foo (i
~~~A.d
module A;
import std.stdio;
void bar (int s) { __PRETTY_FUNCTION__.writeln; }
~~~
~~~foo.d
import std.stdio;
import A;
alias bar = A.bar;
version (X) {
void bar (T) (T t) { __PRETTY_FUNCTION__.writeln; }
}
void bar (int s) { __PRETTY_FUNCTION__.writeln; }
void main ()
{
bar (1);
On Saturday, 28 November 2020 at 13:29:50 UTC, Ferhat Kurtulmuş
wrote:
On Saturday, 28 November 2020 at 12:01:59 UTC, Alex NL wrote:
Is there libs for SQLITE?
How to use it? thanks.
https://github.com/aferust/GtkD-examples-for-TreeView-and-ListBox
IMNSHO the code in example1.d
string sql
Currently as a workaround I read all the chars from stdin with
import std.file;
auto s = cast (string) read("/dev/fd/0");
after I found that you can't read from stdin. This is of course
non-portable Linux only code. In perl I frequently use the idiom
$s = join ('', <>);
that correspon
On Friday, 11 December 2020 at 11:05:59 UTC, frame wrote:
On Friday, 11 December 2020 at 02:31:24 UTC, kdevel wrote:
auto s = cast (string) stdin.byChunk(4).join;
As strace reveals the resulting program sometimes reads twice
zero
characters before it terminates:
read(0, a
On Friday, 11 December 2020 at 15:57:37 UTC, frame wrote:
On Friday, 11 December 2020 at 12:34:19 UTC, kdevel wrote:
My code cannot do that because the function byChunk has
control over the
file descriptor.
What do you mean by control?
The error happens while the cpu executes code of the D
On Friday, 11 December 2020 at 16:49:18 UTC, Adam D. Ruppe wrote:
libc-2.30.so
The bug was fixed in 2.28 IIRC.
so i guess i have the fixed libc. Can you confirm what version
you have?
Various. I tested the code on a machine running the yet EOL
CENTOS-6
having glibc 2.12.
In some situations a ] must be escaped as in
auto re = regex(`^[a\]]$`); // match a and ] only
Unfortunately dmd/phobos does not warn if you forget the
backslash:
auto re = regex(`^[a]]$`); // match a]
This leads me to the documentation [1] which says
\c where c is one of [|*+?()
~~~char2.d
void main ()
{
import std.stdio;
import std.conv;
char [2] win = [0, 'X'];
auto ne = new Exception ("A " ~ win.to!string ~ " B");
try throw ne;
catch (Exception e)
writeln ("exception caught: e.msg = <", e.msg, ">");
throw ne;
}
~~~
Output:
exception caught:
On Sunday, 13 December 2020 at 20:25:06 UTC, KapyoniK wrote:
Is it really a bug ? \0 truncates the string, as mentionned on
this page :
https://en.wikipedia.org/wiki/Null-terminated_string
I thought the D runtime is written in D (with D strings)?!?
On Sunday, 13 December 2020 at 20:58:42 UTC, rikki cattermole
wrote:
[...]
String literals are null terminated by the compiler. It is very
useful for communicating with C.
Sure, but in the example given there is an embedded NUL which as
part
of an exception msg. If caught everything works a
On Sunday, 13 December 2020 at 22:40:53 UTC, Paul Backus wrote:
This is definitely a bug.
filed as Issue 21480
On Monday, 16 November 2020 at 18:34:14 UTC, Max Haughton wrote:
[...] Probably should be a bug.
filed as Issue 21481
~~~json.d
void main ()
{
import std.stdio;
import std.json;
string [] json = [
`{
"range": [
{"x": "iks"}
],
"range": "variable"
}`,
`{
"range": "variable",
"range": [
{"x": "iks"}
]
}`
];
foreach (js; json) {
auto jv = parseJSON (js, JSONOptions
On Saturday, 19 December 2020 at 12:52:54 UTC, Виталий Фадеев
wrote:
Goal:
size_t pos = findRegexBackward( r"abc"d );
assert( pos == 4 );
module LastOccurrence;
size_t findRegexBackward_1 (dstring s, dstring pattern)
{
import std.regex : matchAll;
auto results = matchAll (s, pat
I would expect the unittest below to pass. Could not find
any explanation in [1].
~~~typeid.d
class A {}
class B : A {}
class C : B {}
interface Q {}
class R : Q {}
class S : R {}
unittest {
import std.stdio : writeln;
void runtest (X, Y) ()
{
X x = new Y ();
writeln ("X =
~~~Private.d
module Private;
class A {}
private class B {}
package class Private {
void foo () { __PRETTY_FUNCTION__.writeln; }
}
~~~
~~~main.d
void main ()
{
import Private: A; // okay
// import Private: B; // main.d(4): Error: module Private
member B
// is not
On Saturday, 26 December 2020 at 17:48:17 UTC, Mike Parker wrote:
On Saturday, 26 December 2020 at 15:58:30 UTC, kdevel wrote:
package class Private {
void foo () { __PRETTY_FUNCTION__.writeln; }
}
import Private;
auto p = new Private; // works, but Private.Private is
private ?!?
On Saturday, 26 December 2020 at 18:43:19 UTC, kdevel wrote:
$ dmd main.d
$ dmd -i main
On
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=87915 I found in Issue 1441 there is PHP source code shown instead of the message. Must `
bugreport filed https://issues.dlang.org/show_bug.cgi?id=21508
Why is the enum to!string conversion so slow?
~~~slowenumtostringconversion.d
private enum S { A, B, C, D, };
version (fast) {
string resolve (E) (E e)
{
static foreach (m; __traits (allMembers, E))
if (e == __traits (getMember, E, m))
return m;
assert (fal
~~~tsnf.d
import std.stdio: writeln;
struct S {
string s;
string toString ()
{
return __PRETTY_FUNCTION__ ~ `: ` ~ s;
}
string toString () const // def #1
{
return __PRETTY_FUNCTION__ ~ `: ` ~ s;
}
const string toString () // def #2
{
return __PRETTY_F
On Tuesday, 5 January 2021 at 03:36:47 UTC, Paul Backus wrote:
On Tuesday, 5 January 2021 at 02:02:39 UTC, kdevel wrote:
[...]
If you try to call .toString directly on a const(S), you get
the following error:
onlineapp.d(27): Error: onlineapp.S.toString called with
argument types () const
Here a condensed version of the problem I encountered after
updating to
msgpack-d 1.0.3 and not merging a local patch of this [1] line:
```sub.d
module sub;
import l2;
void foo ()
{
import std.stdio: writeln;
bar();
auto fn = &isDir!string;
writeln (`isDir fn ptr = `, fn);
}
unittes
On Friday, 8 January 2021 at 20:43:37 UTC, Andrey wrote:
[...]
2. Or how to pass "row" correctly?
Drop the "const" before "ref".
Why does dirEntries in std/file.d do that (POSIX version)?:
for (dirent* fdata; (fdata = readdir(_stack[$-1].h))
!= null; )
{
// Skip "." and ".."
if (core.stdc.string.strcmp(&fdata.d_name[0],
".") &&
core.stdc.string.
On Sunday, 10 January 2021 at 20:39:56 UTC, Anonymouse wrote:
On Saturday, 9 January 2021 at 18:44:10 UTC, kdevel wrote:
There seems to be no switch to disable the skip of "." and
"..".
So the original position of these dir entries is lost. ☹
I imagine dirEntries returning an entry for ".."
On Tuesday, 19 January 2021 at 11:42:17 UTC, Per Nordlöw wrote:
I want to convert a double to a long if conversion is lossless
(without fractional part, non-nan, non-inf, within long-range,
etc).
And then? I mean: What do you want to do with the long what could
not
be done with the double in
~~~gotoskip.d
int main ()
{
string[string] aa;
goto A; // line 4
aa["X"] = "Y";// line 5
A:
return 0;
}
~~~
$ dmd gotoskip.d
gotoskip.d(4): Error: goto skips declaration of variable
gotoskip.main.__aaval2 at gotoskip.d(5)
What's wrong here? Only found Issue 11
On Thursday, 21 January 2021 at 13:55:48 UTC, kdevel wrote:
goto A; // line 4
aa["X"] = "Y";// line 5
A:
Creating a scope
{ aa["X"] = "Y"; } // line 5
works around the issue.
On Thursday, 21 January 2021 at 13:55:48 UTC, kdevel wrote:
[...]
created https://issues.dlang.org/show_bug.cgi?id=21571
In § 19.18.7 [1] it is said that
Nested functions always have the D function linkage type.
Why and for what application is that important? As this example
~~~znested.d
void foo () { }
unittest {
void nested () { }
import std.stdio;
writeln (typeof (nested).stringof);
writeln (typ
Today I moved some functions to a new module within the same
package
and ran
dmd -g -i -unittest -checkaction=context -main -run .
dmd reported
5 unittests passed
I would have expected that only the one unittest in
would
have been compiled. After inserting print statements into the
o
On Thursday, 28 January 2021 at 20:03:34 UTC, H. S. Teoh wrote:
[...]
5 unittests passed
Which version of dmd is this?
$ dmd --version
DMD64 D Compiler v2.093.1
Copyright (C) 1999-2020 by The D Language Foundation, All Rights
Reserved written by Walter Bright
In the latest releases, thi
```p.d
module pp;
void foo ()
{
import std.stdio: writeln;
__PRETTY_FUNCTION__.writeln;
}
```
```x.d
import p;
```
```main.d
import x;
unittest {
import pp: foo; // wrong name is accepted if x is imported
// import p: foo;
foo;
}
```
$ dmd -i -unittest -main -run main
void pp.foo()
On Saturday, 6 February 2021 at 14:52:57 UTC, Adam D. Ruppe wrote:
[...]
That one `import p;` is kinda weird, it should probably
complain then you imported one thing and got another, but
generally the name not matching is no problem at all.
```main.d (version 2)
// import x;
unittest {
//
On Friday, 19 February 2021 at 08:37:50 UTC, Imperatorn wrote:
Does your iopipe handle... Pipes? 😀
BTW: What about SIGPIPE?
In an experimental code I have this
:
fout.rawWrite (buf);
fout.rawWrite ("\n");
writeln ("flushing");
fout.flush ();/
On Friday, 19 February 2021 at 13:42:46 UTC, Steven Schveighoffer
wrote:
[...]
ignoring SIGPIPE is a process-wide thing, and so it's not
appropriate for Phobos to make that decision for you. But it's
trivial to ignore it.
Sure.
I've never been a fan of SIGPIPE. If you look around on the
I
On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote:
On Friday, 19 February 2021 at 15:39:25 UTC, kdevel wrote:
[...]
Fortunately the D runtime /does/ take care and it throws---if
the signal
is ignored beforehand. I filed issue 21649.
[...]
Perhaps a bit late,
It's never to
On Saturday, 6 March 2021 at 01:53:15 UTC, Jesse Phillips wrote:
[...]
I think this post is going to answer your need.
https://dev.to/jessekphillips/piping-process-output-1cai
I haven't read all the replies, so maybe you have it working
and this will benefit someone else.
If I understand you
After replacing dmd with ldmd2 (LDC 1.25.1) I get tons of link
errors all of
the form mentioned in the subject. Any idea what can be done
about it?
(With a handcrafted single compile/link statement using ldc2
everything compiles
but ideally I want to reuse my Makefile).
On Sunday, 7 March 2021 at 01:29:50 UTC, Preetpal wrote:
[...]
Can you post more information? Like the full error that you are
seeing,
[link cmd]
/usr/bin/ld.gold: error: pointless.o: multiple definition of
'_D3ldc10attributes10assumeUsedySQBeQBd11_assumeUsed'
/usr/bin/ld.gold: localscop.o: p
On Sunday, 7 March 2021 at 11:50:45 UTC, z wrote:
[...]
I think i had a similar error, can you try adding
version(LDC) pragma(LDC_no_moduleinfo)
to the affected modules? At the line just after the module
declaration, particularly in all package.d files and the file
that contains the main funct
On Sunday, 7 March 2021 at 12:47:45 UTC, kinke wrote:
[...]
./dmd -i -of=pointless.o -g -c pointless/package.d
"dmd" is a symlink to /opt/ldc2/bin/ldmd2
Ah, try using `-i=-ldc` instead of `-i` alone to manually
exclude the ldc.* modules from being included.
Solved the issue. Many thanks!
In order to watch out for lost bytes in a pipe I encountered this
segfault.
It seems that the readEnd is already closed when rawRead = fread
is
called (uncomment the eof line).
How do I keep the pipe open?
```piperawreadsegfault.d (linux)
import std.stdio;
import std.process;
void main ()
{
On Thursday, 18 March 2021 at 07:55:01 UTC, Imperatorn wrote:
[...]
Have you tried "scope(exit) wait(" instead?
Yes. Does not make a difference. For the segfault I have filed
Issue 21728
On Wednesday, 17 March 2021 at 23:08:07 UTC, kdevel wrote:
[...]
How do I keep the pipe open?
Having the readEnd and writeEnd closed in the parent is usually
the right thing to to. spawnProcess closes the ends which is
documented:
| Note that if you pass a File object that is not one of the
s
Why does this code
```d
import std.stdio,std.typecons;
struct EC {
Exception [] ex;
auto opAssign (X: void) (lazy X f)
{
writeln (__PRETTY_FUNCTION__);
try return f (); catch (Exception e) ex ~= e;
}
}
class E : Exception { this (string s) { super (s); } }
void bar (int
On Sunday, 4 April 2021 at 18:05:04 UTC, tsbockman wrote:
```
[...]
You cannot assign void returned from bar() as parameter to
opAssign(). The lazy keyword creates some internal delegate,
thus opAssign() works instead.
[...]
auto bar (int i) {
return () {
if (i == 1)
th
On Monday, 5 April 2021 at 20:59:34 UTC, tsbockman wrote:
However, `=` and `~=` should not treat `lazy void` parameters
differently. They should either both work, or neither. I
checked and this is actually a very old regression; both worked
way back in DMD 2.061. So, I've filed a front-end bug
On Sunday, 11 April 2021 at 20:41:35 UTC, Bastiaan Veelo wrote:
[...]
What am I doing wrong here? Is it the 'for' loop?
Yes, there is a `7` where there should be an `i` on this line:
```d
for(int i=7;7>=0;i--)
```
This will go on forever, so you get a range error as soon as `i
< 0`.
Can't
On Monday, 12 April 2021 at 18:13:38 UTC, Imperatorn wrote:
[...]
Yup
D can be so much fun!
```d
import std.stdio;
enum Color {none = " n ", red = " r ", black = " b "};
enum sColor {black= " b ", white= " w "};
class Square {
public:
this(Color color, sColor Scolor) {
this.color
On Sunday, 11 April 2021 at 09:10:22 UTC, tchaloupka wrote:
we're using vibe-d (on Linux) for a long running REST API
server [...]
[...] lot of small allocations (postgresql query, result
processing and REST API json serialization).
I am wondering about your overall system design. Are there
dmd since 2.096.0 with ``t.d``
```t.d
module t;
class t {
}
```
and ``x.d``
```x.d
module x;
import t;
void main ()
{
t x = new t;
}
```
reports
$ dmd -i x.d
x.d(6): Error: import `x.t` is used as a type
x.d(6): Error: import `x.t` is used as a type
Could not find this Chang
On Friday, 30 April 2021 at 19:17:14 UTC, user1234 wrote:
[...]
Likely a side effect of https://github.com/dlang/dmd/pull/12178
but
according to me the new behavior is correct.
It breaks my code. I have files named $C containing struct or
class $C plus some other stuff. Using the workaround m
On Saturday, 1 May 2021 at 16:32:32 UTC, Basile B. wrote:
Hard breakage is not acceptable, even if the goal is to
introduce a more correct behavior.
I still wonder why module names are taken as a candidates for
types and functions in the first place. Isn't there a symbol
table for module name
On Sunday, 2 May 2021 at 18:36:25 UTC, Basile B. wrote:
[...]
BTW during the PR review the problem you encounter [was
anticipated](https://github.com/dlang/dmd/pull/12178#issuecomment-773886263) si I guess you're stuck with [the author answer](https://github.com/dlang/dmd/pull/12178#issuecomment-
On Thursday, 13 May 2021 at 16:40:29 UTC, Imperatorn wrote:
Wouldn't this just this do that? 🤔
```d
string dequote(string s)
{
return s[1..$-1];
}
```
1. Your code throws Range errors if s.length < 2.
2. assert(dequote(`"fo\"o"`) == `fo"o`) fails
3. dequote(`"fo"o"`) does not throw.
On Thursday, 13 May 2021 at 13:45:50 UTC, Adam D. Ruppe wrote:
On Thursday, 13 May 2021 at 13:30:29 UTC, Alain De Vos wrote:
Or have I a wrong understanding of pure or the compiler.
pure means it doesn't depend on any mutable info outside its
arguments.
You are only working on the arguments
On Thursday, 13 May 2021 at 21:41:48 UTC, Imperatorn wrote:
[...]
[1] https://en.wikipedia.org/wiki/Pure_function
Just fyi:
https://dlang.org/articles/safed.html
Replied to the wrong post?
On Thursday, 3 June 2021 at 01:22:14 UTC, Paul Backus wrote:
auto tmp = File(filename).byLine();
`File.byLine` overwrites the previous line's data every time it
reads a new line. If you want to store each line's data for
later use, you need to use [`byLineCopy`][1] instead.
a) What is the rationale behind not making byLineCopy the
default?
byLine was the original implementation. byLineCopy was added
later after the need for it became apparent.
See:
https://forum.dlang.org/post/lg4l7s$11rl$1...@digitalmars.com
THX. BTW byLineCopy defaults to immutable char. Th
On Thursday, 17 June 2021 at 19:14:28 UTC, Steven Schveighoffer
wrote:
On 6/17/21 12:26 PM, JG wrote:
However, what I *have* wanted is to have attribute values
support `Nullable!T` such that they are only included if the
item is non-null. See
[here](https://github.com/rejectedsoftware/diet-ng
Today I stumbled across three issues with partial initialization
of "static" arrays:
~~~i1.d
void main ()
{
char [7] b = [ 1: 'x' ]; // okay
char [7] a = [ 0: 'x' ]; // i1.d(4): Error: mismatched array
lengths, 7 and 1
}
~~~
~~~i2.d
import std.stdio;
void main ()
{
char [7] c7 = [ 1
On Saturday, 14 August 2021 at 13:01:13 UTC, frame wrote:
I would say case [...] 3 is not [a bug]. It's just the element
type conversion and mismatched lengths of the ranges.
~~~
char [7] d7 = "x"; // okay
string s = "x";
char [7] c7 = s; // throws RangeError
~~~
What justifies that
On Saturday, 14 August 2021 at 14:18:57 UTC, Tejas wrote:
On Saturday, 14 August 2021 at 14:04:47 UTC, kdevel wrote:
On Saturday, 14 August 2021 at 13:01:13 UTC, frame wrote:
I would say case [...] 3 is not [a bug]. It's just the
element type conversion and mismatched lengths of the ranges.
~
On Saturday, 14 August 2021 at 23:09:14 UTC, Paul Backus wrote:
On Saturday, 14 August 2021 at 14:04:47 UTC, kdevel wrote:
~~~
char [7] d7 = "x"; // okay
string s = "x";
char [7] c7 = s; // throws RangeError
~~~
What justifies that the compiler behaves differently on two
terms ('s',
On Thursday, 4 November 2021 at 11:26:30 UTC, Andrey Zherikov
wrote:
I have the following code example:
[...]
A[5] a;
ulong[] idx = [1,3,4];
[...]
return idx.map!(_ => a[_]);
How can one make the type of idx's elements portable (compile
with -m32 to see what the problem is)? This s
On Thursday, 4 November 2021 at 00:53:11 UTC, jfondren wrote:
On Wednesday, 3 November 2021 at 20:36:08 UTC, russhy wrote:
Keeping things simple helps debugging!
I'd still have to run your program to be sure of its simple
logic, though. The real star d feature that would help with
debugging
On Saturday, 6 November 2021 at 13:48:59 UTC, jfondren wrote:
On Saturday, 6 November 2021 at 13:27:55 UTC, kdevel wrote:
On Thursday, 4 November 2021 at 00:53:11 UTC, jfondren wrote:
On Wednesday, 3 November 2021 at 20:36:08 UTC, russhy wrote:
Keeping things simple helps debugging!
As simpl
In previous versions I used the linux32/dmd with the -m64 switch
in order to generate 64-bit code. But this does not work anymore:
$ linux/bin32/dmd
linux/bin32/dmd: /lib/libc.so.6: version `GLIBC_2.28' not found
(required by linux/bin32/dmd)
The reason for presence of these symbol version
On Tuesday, 9 November 2021 at 00:22:35 UTC, jfondren wrote:
On Monday, 8 November 2021 at 23:55:02 UTC, kdevel wrote:
In previous versions I used the linux32/dmd with the -m64
switch in order to generate 64-bit code. But this does not
work anymore:
$ linux/bin32/dmd
linux/bin32/dmd: /lib/
On Thursday, 11 November 2021 at 22:30:12 UTC, forkit wrote:
[...]
for(int i = 0; i < sizeof(numbers) / sizeof(int); ++i) //
is so much safer - in C style
I made it even safer:
for (int i = 0; i < sizeof numbers / sizeof *numbers; ++i)
Maybe the type of numbers is changed in the futur
On Wednesday, 8 December 2021 at 13:01:32 UTC, BoQsc wrote:
[...]
I'm not getting used to the syntax and that leads to poor
readability.
It depends on what you expect when you read source code. I don't
want to read how seats in the memory are assigned to bits and
bytes. Instead I want to read
On Wednesday, 8 December 2021 at 14:16:16 UTC, bauss wrote:
[...]
string b = a.replace(";", "");
👍
101 - 200 of 367 matches
Mail list logo