On Friday, 4 December 2020 at 06:51:32 UTC, MGW wrote:
string[] m = stdin.byLineCopy.array;
How to make strip() for each line in an expression ...
To apply a function to each element of a range, use the `map`
algorithm:
import std.algorithm: map;
string[] m = stdin.byLineCopy.map!strip.arr
On Thursday, 3 December 2020 at 00:30:06 UTC, Kyle Ingraham wrote:
// EDSDKTypes.h
typedef struct __EdsObject* EdsBaseRef;
typedef EdsBaseRef EdsCameraListRef;
//
[...]
// edsdk.d
struct EdsBaseRef;
alias EdsBaseRef EdsCameraListRef;
You've dropped a level of indirection here. In the C hea
On Wednesday, 2 December 2020 at 05:25:09 UTC, Ben Jones wrote:
This seems like very surprising behavior to me. Is it a bug?
import std.typecons;
alias NT = Nullable!(Tuple!(int, double));
pragma(msg, isTuple!NT); //prints true!
No, this is not a bug, because Nullable!T currently has an
impl
On Thursday, 26 November 2020 at 00:17:26 UTC, Q. Schroll wrote:
One of the issues is, I don't know what DRuntime really is. As
far as I understand on the surface-level, it's functionality
one would expect to be implemented by the compiler, but
actually implemented in plain D code. A low-leve
On Wednesday, 25 November 2020 at 21:16:06 UTC, Q. Schroll wrote:
On Wednesday, 25 November 2020 at 21:11:24 UTC, Paul Backus
wrote:
On Wednesday, 25 November 2020 at 20:58:20 UTC, Q. Schroll
wrote:
My setup:
* A fresh DMD installed a few minutes ago.
* Clone of my Phobos fork with up-to-date c
On Wednesday, 25 November 2020 at 20:58:20 UTC, Q. Schroll wrote:
My setup:
* A fresh DMD installed a few minutes ago.
* Clone of my Phobos fork with up-to-date changes from
dlang/phobos/master.
Do you have clones of dmd and druntime too? If not, try following
these instructions:
https://wi
On Wednesday, 25 November 2020 at 18:44:52 UTC, NonNull wrote:
How good is optimization in ldc2, gdc, dmd at compiling chained
jumps into one jump each time?
The easiest way to find the answer to a question like this is to
use the compiler explorer:
https://d.godbolt.org/
On Wednesday, 25 November 2020 at 11:13:24 UTC, ddcovery wrote:
Months ago I read an Andrei article explaining why Ranges
(comparing with C++). I remember article introduction included
a python "false" quick-sort algorithm.
I'm really interested in a more detailed read of the article,
but I c
On Saturday, 21 November 2020 at 00:26:03 UTC, Marcone wrote:
// Função receive()
char[] receive(Socket socket, int size = 8192) nothrow {
try {
char[] buffer;
buffer.length = size;
int rq = socket.receive(buffer);
return buf
On Friday, 20 November 2020 at 14:08:23 UTC, jmh530 wrote:
Doing something like below fails because I don't seem to be
able to make a templated lambda that just takes types. Is the
only way to do something similar to create a separate function
to handle the condition, or is there some other way
On Wednesday, 18 November 2020 at 22:29:17 UTC, Steven
Schveighoffer wrote:
I have a struct like this:
struct S
{
int x;
int y;
}
and I want a default comparison. The problem is, that
comparison doesn't have a default, and requires I implement
opCmp. While this is useful for the compile
On Tuesday, 17 November 2020 at 19:07:42 UTC, Vino wrote:
auto pid = execute(["/usr/bin/aws ec2 describe-images --filters
'Name=state,Values=available' --query 'Images[*].[ImageId]'"]);
[...]
auto pid = execute(["/usr/bin/aws ec2 describe-images --filters
'Name=state,Values=available' --query '
On Saturday, 14 November 2020 at 17:55:13 UTC, WhatMeWorry wrote:
I was poking around the dmd code just to "learn from the best"
and I came across some files that ended with the .d extension
which did not have the module statement. (I was under the naive
impression that all .d files must have
On Wednesday, 11 November 2020 at 01:05:21 UTC, SealabJaster
wrote:
Please see the code at https://run.dlang.io/is/Yjidek
As I understand the error is caused by trying to provide a
delegate when there's no context to provide. Not complaining
about that.
However what I am complaining about is
On Tuesday, 10 November 2020 at 20:32:40 UTC, Paul Backus wrote:
alias isOrderingComparableWith(T, U) = __traits(compiles,
(T t, U u) => t < u);
My bad, should be `enum`, not `alias`.
On Tuesday, 10 November 2020 at 17:19:09 UTC, Ola Fosheim Grøstad
wrote:
Interesting, so "auto ref T" is the go-to type specifier for
generic code then? I guess I also should conditionally add
things like pure, nogc, nothrow... I assume I would have to
test the comparison operator. I actuall
On Tuesday, 10 November 2020 at 16:55:11 UTC, Ola Fosheim Grøstad
wrote:
I want to implement a generic function for "a < f(x) < b" that
will give the same result as "(a < f(x)) && (f(x) < b)" for any
conceivable mix of types. Except if that "f(x)" should only be
evaluated once.
Is it sufficie
On Tuesday, 10 November 2020 at 01:00:50 UTC, Mark wrote:
Anyone have any thoughts how C++ and D compare?
Broadly speaking: D has a better core language, and C++ has a
much better library and tooling ecosystem.
On Monday, 9 November 2020 at 22:04:55 UTC, kdevel wrote:
It appears to me that the overload resolution may depend on the
/value/ of the function argument. According to [1] the type of
1 is int and that of 1L is long. Thus I would have expected
foo!int and foo!long being called in those cases.
On Saturday, 7 November 2020 at 18:02:26 UTC, Jan Hönig wrote:
I have a simple question.
How exactly does Tuple work?
In detail, I am interested in expand and opSlice.
A Tuple is a struct whose members are generated by type sequence
instantiation:
https://dlang.org/articles/ctarguments.html
On Friday, 6 November 2020 at 15:01:21 UTC, Andrey Zherikov wrote:
But how can I achieve the same result if S1 is a template
"struct S1(T) {}" and S2 should be convertible to S1!T with any
T?
Also why neither "opCast"
struct S2 { S1 opCast(T)() const if(is(T == S1)) { return
S1(); } }
On Friday, 6 November 2020 at 10:51:20 UTC, Andrey Zherikov wrote:
I can make it work if I add a type to `failure` function but
this remove brevity in usage:
-
auto failure(T)(string error)
{
return Result!T(Result!T.Failure(error));
}
auto f(int i)
{
return i > 0 ? succe
On Friday, 30 October 2020 at 19:07:20 UTC, Vino wrote:
Requirement: parse the json string and store the output to a
container.
From,
Vino.B
Here's a working version of the code from your original post:
import asdf : parseJson;
import std.algorithm;
import std.container.array;
import std.s
On Friday, 30 October 2020 at 10:23:22 UTC, Vino wrote:
Hi,
Request your help on the below code
[...]
.filter!(a => a.(["items"].byElement))
What exactly are you trying to accomplish with this `a.(stuff)`
syntax? As I'm sure you've discovered, it is not valid D, but it
appea
On Thursday, 29 October 2020 at 18:10:28 UTC, IGotD- wrote:
Is this what you are looking for?
https://dlang.org/phobos/std_container_dlist.html
I'm pretty sure the post you replied to is spam.
On Thursday, 29 October 2020 at 09:06:21 UTC, Jan Hönig wrote:
On Thursday, 29 October 2020 at 09:01:12 UTC, Jan Hönig wrote:
This would mean, that this one should work as well.
It does not work as I intended, as `() => {}` has not the
return type of `void`.
(I don't know how to print: `Ret
On Wednesday, 28 October 2020 at 15:15:40 UTC, Paul wrote:
per the D sample wc2.d
size_t[string] dictionary; <-is printed by...
.
foreach (word1; dictionary.keys.sort) writef etc
I want to print the dictionary sorted by value not key. I can
write an algorithm but is there a librar
On Friday, 23 October 2020 at 00:53:19 UTC, Bruce Carneal wrote:
When you write functions, the compiler helps you out with fully
automated constraint checking. When you write templates you
can write them so that they look like simple functions, in
which case you're on pretty solid ground. You
On Thursday, 22 October 2020 at 19:24:53 UTC, Bruce Carneal wrote:
On a related topic, I believe that type functions enable a
large amount of code in the "may be hard to prove decidable"
category (templates) to be (re)written as clearly decidable
code. Easier for the compiler to deal with and,
On Wednesday, 21 October 2020 at 19:23:43 UTC, Simon van Bernem
wrote:
The only explanation I can think of is that D memcmps the
entire struct including the padding. Is this correct?
If so, what can I do about this? Why doesn't the opEquals get
modified appropriately even though the struct is
On Monday, 19 October 2020 at 14:07:38 UTC, matheus wrote:
On Sunday, 18 October 2020 at 19:24:28 UTC, Ferhat Kurtulmuş
wrote:
I plan to start a project in reasonable size, I wonder if I
should really use betterC... if I encounter a bug like this,
will I be stuck at it?
The bug report says, i
On Sunday, 18 October 2020 at 16:04:55 UTC, Koro wrote:
I'm writing a 'betterC' program and the compiler is generating
a call to '_memset64' if I have an array literal where the
elements are the same.
It's a known bug:
https://issues.dlang.org/show_bug.cgi?id=17778
My guess is that the reaso
On Saturday, 17 October 2020 at 00:06:31 UTC, Steven
Schveighoffer wrote:
Appender is ref counted IIRC.
-Steve
It's not; it uses the GC.
On Friday, 16 October 2020 at 15:19:51 UTC, Paul Backus wrote:
On Friday, 16 October 2020 at 13:12:04 UTC, tchaloupka wrote:
So when the exception is thrown within Foo destructor (and
it's bad on it's own but can easily happen as destructors
aren't nothrow @nogc by default).
Is this behavior
On Friday, 16 October 2020 at 13:12:04 UTC, tchaloupka wrote:
So when the exception is thrown within Foo destructor (and it's
bad on it's own but can easily happen as destructors aren't
nothrow @nogc by default).
Is this behavior expected?
This is a compiler/language bug. It was fixed in DMD
On Friday, 16 October 2020 at 13:27:57 UTC, Imperatorn wrote:
https://forum.dlang.org/post/e5ghnv$2bns$1...@digitaldaemon.com
On Tuesday, 30 May 2006 at 04:29:51 UTC, BCS wrote:
Does anyone have a link to a definition of universal alpha as
used in the DMD docs?
(see: http://www.digitalmars.co
On Thursday, 15 October 2020 at 22:02:11 UTC, Jack wrote:
can I make it work? the code (see below) result in link error:
lld: error: wasm.o: undefined symbol: _D4wasm1C7__ClassZ
lld: error: wasm.o: undefined symbol: _d_allocclass
Error: linking with LLD failed
command line:
ldc2 --d-debug -m
On Thursday, 15 October 2020 at 06:39:00 UTC, Patrick Schluter
wrote:
On Wednesday, 14 October 2020 at 20:32:51 UTC, Max Haughton
wrote:
On Wednesday, 14 October 2020 at 20:27:10 UTC, Jack wrote:
What was the reasoning behind this decision?
Andrei's std::allocator talk from a few years ago at
On Wednesday, 14 October 2020 at 20:15:39 UTC, Jack wrote:
What's the difference between:
import core.stdc.stdlib : malloc;
auto x = malloc(s)[0..s];
and
auto x = cast(T)malloc(s);
?
I have been using the last but I saw in some code examples,
like this[1] the first being used. What's the d
On Wednesday, 7 October 2020 at 16:25:33 UTC, DMon wrote:
Can isType be used as a condition in an if statement with
arrays?
import std.stdio;
import std.traits;
void main()
{
int[5] a = [1,2,3,4,5];
// Something like this:
if (a == isType!(int[5]))
{
write("true");
}
On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote:
Dear all,
Sorry for the potentially stupid question, but I'm a complete
newbie to D. Why does compiling the following trivial code fail?
import std.stdio;
void main()
{
writeln(3.14);
}
Works fine for me using DMD 2.094.0 on Lin
On Saturday, 3 October 2020 at 14:17:45 UTC, tspike wrote:
On Saturday, 3 October 2020 at 14:12:21 UTC, Paul Backus wrote:
https://issues.dlang.org/show_bug.cgi?id=18439
Perfect! Thanks for getting back to me so quickly.
FYI I am not Timon Gehr, the person who originally replied to
you, but
On Saturday, 3 October 2020 at 14:02:08 UTC, tspike wrote:
On Saturday, 3 October 2020 at 12:43:01 UTC, Timon Gehr wrote:
It's a compiler bug, the same as this one:
@nogc:
void main(){
static immutable x = { int[] a; a~=1; return a; }();
}
Ah, thank you for the quick reply! Do you know i
On Tuesday, 29 September 2020 at 01:46:56 UTC, Ruby The Roobster
wrote:
I thought alias could work like this with classes:
alias test = MyClass(3,"H",9.1); //Assume the constructor
parameters for MyClass are (int,string,double).
Can anybody fix this code?
`alias` lets you create a new name
On Monday, 28 September 2020 at 13:45:30 UTC, Ruby The Roobster
wrote:
On Monday, 28 September 2020 at 13:00:43 UTC, Paul Backus wrote:
Can you give some examples of inputs and corresponding outputs
for this, like you would for a unit test? I don't understand
exactly what you're asking, and it
On Monday, 28 September 2020 at 11:11:13 UTC, Ruby The Roobster
wrote:
For example:
class test {}
class T {
auto c = new test();
}
Any way to tell if an object of type test is a member of object
T? I don't want to use the name of the member variable. I just
want to know if this works in gener
On Sunday, 27 September 2020 at 18:54:11 UTC, tastyminerals wrote:
This is rather a generic implementation question not
necessarily related to D but I'd like to get some opinions.
I have a collection of functions that all have the same input,
a string. The output however is different and dependi
On Wednesday, 23 September 2020 at 04:15:51 UTC, mw wrote:
On Saturday, 27 October 2012 at 01:08:12 UTC, Jonathan M Davis
wrote:
Yes. But using core.memory.GC.free is unsafe for the same
reasons that delete is. It's just that it's a druntime
function instead of a part of the language, so it's l
On Monday, 21 September 2020 at 19:16:17 UTC, JN wrote:
I am trying to use bindbc-sdl and bindbc-wgpu at the same time.
The error is:
Unresolvable dependencies to package bindbc-loader:
bindbc-sdl 0.19.1 depends on bindbc-loader ~>0.3.0
bindbc-sdl 0.19.1 depends on bindbc-loader ~>0.3.0
b
On Saturday, 19 September 2020 at 13:56:53 UTC, Anonymouse wrote:
On Saturday, 19 September 2020 at 13:32:07 UTC, Paul Backus
wrote:
http://dpldocs.info/experimental-docs/std.stdio.File.setvbuf.1.html
Thanks.
I don't have a clone of druntime/Phobos available to me right
now, so some follow-
On Saturday, 19 September 2020 at 13:23:29 UTC, Anonymouse wrote:
On Tuesday, 18 August 2020 at 06:25:31 UTC, Kagamin wrote:
On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote:
Just as a drive-by comment, the main stdio thing I came
across that I couldn't do from within @safe was
stdo
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 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 Sunday, 13 September 2020 at 18:24:01 UTC, mw wrote:
But, I'd reflect on my experience so far on compile-time
meta-programming in D as a novice user, the big problems are:
-- in D, there are too many choices, with no clear guideline
which one is *THE* one to use for a particular purpose:
l
On Sunday, 13 September 2020 at 17:23:42 UTC, Steven
Schveighoffer wrote:
On 9/13/20 12:55 PM, James Blachly wrote:
```
/// Add a single line to an existing header
auto addLine(T...)(RecordType type, T kvargs)
if(kvargs.length > 0 && isSomeString!(T[0]))
{
static as
On Sunday, 13 September 2020 at 13:35:15 UTC, Martin wrote:
Hi,
i would like to create a function which takes the first
parameter as a reference to a struct - but assure the calle
that the reference is read-only. Can this be done?
Yes, you can do this with `ref const`.
On Sunday, 13 September 2020 at 07:00:36 UTC, mw wrote:
Here it is: D wrapper for https://ta-lib.org/
https://github.com/mingwugmail/talibd
I end up using C macro to generate D functions, the single
template is this one:
https://github.com/mingwugmail/talibd/blob/master/source/talibd.h#L117
On Saturday, 12 September 2020 at 19:31:57 UTC, mw wrote:
(I'm asking for a more general solution, e.g. what if we have
3, or N sets of variadic parameters?)
Looks like we can only pass 1 variadic parameters, then the
question is what's the best way to divide it?
Is there any special mark
On Saturday, 12 September 2020 at 18:16:51 UTC, mw wrote:
Now, let me expand this challenge: suppose we need to add a new
set of variable length extra parameters in parallel to the
arrays, i.e:
[...]
Now the question is how to pass & handle 2 sets of variadic
parameters?
void fun(Args...)(
On Saturday, 12 September 2020 at 03:19:23 UTC, mw wrote:
I.e. I want to learn the generic meta-programming way to
assemble such parameter list (&(x[i], &(y[j])) at compile time,
it is possible?
It's possible if you use a helper function. Here's how:
import std.meta: allSatisfy;
import std.tr
On Tuesday, 8 September 2020 at 13:28:22 UTC, Cecil Ward wrote:
I wonder if there is any way in which we could combine this
with strong typing of some sort (how?) to detect errors such as
int xcoord;
int ycoord;
myfunc( x : ycoord, y : xcoord, color : blue )[3]
where the
On Tuesday, 8 September 2020 at 14:18:14 UTC, Cecil Ward wrote:
I assumed I would have to create a struct type definition and
handle various operators. How many will I have to handle? I
would of course make it a template so I can reuse this
otherwise horribly repetitive code.
You can see a fu
On Monday, 7 September 2020 at 11:25:15 UTC, wjoe wrote:
It's easy to declare the entire module @safe and functions
which can't be can be declared @system.
However there is const, immutable, pure, @nogc and nothrow but
no mutable, impure, @gc and throws.
Why is that ?
Mostly because nobody's
On Friday, 4 September 2020 at 18:23:09 UTC, H. S. Teoh wrote:
On Fri, Sep 04, 2020 at 07:36:00PM +0200, Jacob Carlborg via
Digitalmars-d-learn wrote: [...]
It's useful for serialization and, as you can see in your
example, for debugging as well. `writeln` will print the
values of the fields in
On Tuesday, 1 September 2020 at 18:20:17 UTC, Jesse Phillips
wrote:
This is going to be a hard one for me to argue but I'm going to
give it a try.
Today if you attempt to access a key from an associative array
(AA) that does not exist inside the array, a RangeError is
thrown. This is similar
On Tuesday, 1 September 2020 at 02:08:54 UTC, JG wrote:
Is there anyway to remove the boilerplate code of dealing with
tuples:
I find myself having to write things like this fairly often
auto someRandomName = f(...); //where f returns a tuple with
two parts
auto firstPart = someRandomName[0
On Tuesday, 1 September 2020 at 02:48:08 UTC, Ben Jones wrote:
Thanks all.
I tried using alias this at first and then I get errors trying
to construct AliasType objects:
auto pi = Payload!int(5);
auto pe = ParseError("error");
alias PRType = ParseResult!(Payload!int, ParseError);
auto pr =
On Tuesday, 1 September 2020 at 01:11:35 UTC, Ben Jones wrote:
I have an alias that looks like
static if(...){
alias AliasType = SumType!(...);
}
which I use in a template constraint for a function template:
bool func(T: AliasType!Args, Args...)(T t){ ... }
When I try to call func with an
On Wednesday, 26 August 2020 at 15:57:37 UTC, Cecil Ward wrote:
Ah! That’s the vital missing piece - I didn’t realise it was
like a template - I just thought it was an ordinary plain
anonymous function, not a generic. All makes sense now.
Fun fact: you can see the "de-sugared" version of man
On Saturday, 22 August 2020 at 21:45:35 UTC, data pulverizer
wrote:
Hi all,
just wandering if this is a bug, I certainly didn't expect the
output:
```d
alias AliasSeq(T...) = T;
alias Nothing = AliasSeq!();
template MyTemplate(S, Args...)
{
pragma(msg, "Args: ", Args);
}
void main()
{
a
On Thursday, 20 August 2020 at 02:21:15 UTC, data pulverizer
wrote:
```
double[] y;
y ~= x[0..5];
y ~= x[9..14];
```
But the act of appending results in array copying - breaks the
reference with the original array. The only other thing I have
considered is creating an array of references to ea
On Sunday, 16 August 2020 at 20:53:41 UTC, JN wrote:
Related to this thread:
https://forum.dlang.org/post/xtjzhkvszdiwvrmry...@forum.dlang.org
I don't want to hijack it with my newbie questions. What is
autodecode and why is it such a big deal? From what I've seen
it's related to handling Uni
On Thursday, 6 August 2020 at 21:50:06 UTC, Per Nordlöw wrote:
I just discovered that the is-operator can be used as in
template ElementType(R)
{
static if (is(typeof(R.init.front.init) T))
alias ElementType = T;
else
alias ElementType = void;
}
. Very powerful. Is this
On Friday, 31 July 2020 at 17:02:46 UTC, Andy Balba wrote:
The above code, compiles and runs ok .. but sometimes I get
run runtime errors using the same paradym, which disappear when
I substitute (img.p)[i]
Any explanation for this ?
Can you show an example where it doesn't work?
On Sunday, 26 July 2020 at 21:18:19 UTC, powerboat9 wrote:
I have an existing rust project, and I'm trying to rewrite part
of it in D. However, I'm not sure how to get rust -> dlang
interop working. I've looked into rust -> c -> dlang interop,
but I'm not sure how to get c -> dlang interop work
On Saturday, 25 July 2020 at 18:06:51 UTC, powerboat9 wrote:
Does dlang have an analog to Result or Option types from rust?
In addition to Nullable in the standard library, there are some
packages on dub you might find useful:
* optional: an option type that can also function as a range, for
On Monday, 20 July 2020 at 17:59:06 UTC, Marcone wrote:
On Sunday, 19 July 2020 at 23:05:45 UTC, Marcone wrote:
How spand array for use with functions arguments like tuple?
expand*
If the array is a compile-time constant, you can use aliasSeqOf
[1]. Otherwise, you can't.
[1] http://dpldoc
On Monday, 20 July 2020 at 21:44:31 UTC, Steven Schveighoffer
wrote:
I think you might be right. I don't know how it's accessing my
terminal, but clearly it can keep doing so even without any
handles open.
Probably /dev/tty
On Sunday, 19 July 2020 at 16:00:28 UTC, Basile B. wrote:
On Sunday, 19 July 2020 at 15:00:59 UTC, Paul Backus wrote:
On Sunday, 19 July 2020 at 12:42:47 UTC, Carl Sturtivant wrote:
On Sunday, 19 July 2020 at 12:08:07 UTC, Paul Backus wrote:
Easiest workaround:
ref inout(long) Second() inout
On Sunday, 19 July 2020 at 12:42:47 UTC, Carl Sturtivant wrote:
On Sunday, 19 July 2020 at 12:08:07 UTC, Paul Backus wrote:
Easiest workaround:
ref inout(long) Second() inout { return second.one; }
Was trying to avoid this for performance reasons. In fact what
are the performance implicatio
On Saturday, 18 July 2020 at 18:46:16 UTC, Carl Sturtivant wrote:
Here's a toy version of a problem in the wild.
struct S {
long first;
union T {
long one;
double two;
}
T second;
alias First = first;
alias Second = second.one;
}
void main() {
S x;
On Tuesday, 14 July 2020 at 13:40:44 UTC, Steven Schveighoffer
wrote:
The whitespace separator doesn't get to your program. args is:
["sample", "--modelicalibs", "a", "b"]
There is no separator in the parameter to --modelicalibs, it's
just "a".
What you need to do is:
dmd -run sample.d --m
On Thursday, 9 July 2020 at 18:02:02 UTC, IGotD- wrote:
Static arrays are great because as already mentioned, they are
allocated on the stack (unless it is global variable something,
then it ends up in the data segment or TLS area).
As C/C++ now allows dynamically sized static arrays (for st
On Thursday, 9 July 2020 at 18:16:58 UTC, CraigDillabaugh wrote:
So is Vibe-d still being actively maintained? I noticed there
have been no new releases in a while, and the forums are a bit
of a disaster (unless you love porn I suppose):
https://forum.rejectedsoftware.com/groups/rejectedsoft
On Thursday, 9 July 2020 at 16:16:53 UTC, Quantium wrote:
I have one more question. I tested the programm, as you said,
it worked rarely because of OS restrictions. If I compile that
code to dll, and run it through dll launcher, should it work?
The OS restrictions don't care whether your progr
On Wednesday, 8 July 2020 at 19:48:07 UTC, Quantium wrote:
I'm learning now memory usage in D, and I have the problem that
I can't solve.
The problem is (The third step):
1) Programm gets number (In int format) as input data.
2) Integer is converted to HEX
3) Programm gets the data in 0x
memory
On Tuesday, 7 July 2020 at 00:20:40 UTC, solidstate1991 wrote:
See implementation of data structure here:
https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/treemap.d#L565
If I try to compile this code, it'll fail, limiting it's
usecase:
@safe pure unittest {
On Saturday, 4 July 2020 at 17:11:47 UTC, Arafel wrote:
On 4/7/20 17:42, Rainer Schuetze wrote:
Indeed, this is Windows only. Visual Studio Code is a
different platform
than Visual Studio. Not sure why Microsoft named them so that
they are
easily confused.
(Moving to the learn forum, sinc
On Friday, 26 June 2020 at 13:53:46 UTC, Johannes Loher wrote:
Am 26.06.20 um 15:35 schrieb ag0aep6g:
`isInputRange!R` fails because it has no knowledge of your
free `empty` function. Without `empty`, `R` is obviously not a
range.
Ah, OK, that makes sense. It's kind of sad though because it
On Thursday, 25 June 2020 at 18:47:42 UTC, repr-man wrote:
struct ChunksOf(R)
{
Chunks!R iter;
this(R r, size_t width)
{
this.iter = r.chunks(width);
assert(is(typeof(iter) == Chunks!R));
}
}
This works, only if I change the declaration of x in main() to:
au
On Tuesday, 23 June 2020 at 16:14:20 UTC, Denis wrote:
by presenting an interface that only compiles when both cases
are covered, like fun().match((T t) => t, () => Error()).
A complete solution wrapped in a tidy package -- I like it.
Thanks for sharing.
If you're open to using Dub packages,
On Tuesday, 23 June 2020 at 03:52:23 UTC, Jonathan M Davis wrote:
It is extremely common to wrap ranges in other ranges (and in
fact, you basically have to in order to have lazy ranges). That
really doesn't work very well - if at all - if you can't copy
the range. It might be possible with a
On Monday, 22 June 2020 at 21:33:08 UTC, H. S. Teoh wrote:
Jonathan is coming from the POV of generic code. The problem
with move leaving the original range in its .init state isn't
so much that it will crash or anything (even though as you said
that does indicate a flaw in the range's imple
On Saturday, 20 June 2020 at 01:35:56 UTC, Denis wrote:
THE OBJECTIVE
The objective is to read a file one line at a time (reading
each line into a string), while checking for human-readable
text character by character. Invalid characters (control and
UTF-8) should generate an exception.
Un
On Friday, 19 June 2020 at 16:16:55 UTC, SealabJaster wrote:
If you take a look at this code here:
https://godbolt.org/z/4T3uLh
You can see that when using a templated alias, the compiler
fails to infer the T template parameter, but only when using
the function that also asks for the alias, i
On Friday, 12 June 2020 at 14:56:41 UTC, Arafel wrote:
Hi all,
I'm hitting a problem that it's making crazy... is there any
way to find out if the return of an `auto ref` function is
actually ref or not?
So, according to the documentation [1] it depends on the return
expressions... however
On Thursday, 11 June 2020 at 05:41:25 UTC, H. S. Teoh wrote:
Ironically, just today I ran into this corner case where
@property actually became a solution to a real problem:
//-module1.d--
auto someGenericFunc(T)(T t) {
...
static if (is
On Wednesday, 10 June 2020 at 23:03:21 UTC, Adam D. Ruppe wrote:
On Wednesday, 10 June 2020 at 22:50:17 UTC, Paul Backus wrote:
static assert(isInputRange!S); // passes
isInputRange doesn't check it but others do.
std.random.isSeedable requires @property on front for example.
Nope:
struct
On Wednesday, 10 June 2020 at 23:26:35 UTC, Paul Backus wrote:
On Wednesday, 10 June 2020 at 23:03:21 UTC, Adam D. Ruppe wrote:
On Wednesday, 10 June 2020 at 22:50:17 UTC, Paul Backus wrote:
static assert(isInputRange!S); // passes
isInputRange doesn't check it but others do.
std.random.isSe
On Wednesday, 10 June 2020 at 21:41:54 UTC, H. S. Teoh wrote:
There are a few places where it's needed (like satisfying the
range API, which implicitly checks for it)
That may have been true at one point, but it isn't true now:
struct S {
bool empty() { return false; }
int front() { re
501 - 600 of 853 matches
Mail list logo