On Saturday, 4 September 2021 at 09:42:46 UTC, Per Nordlöw wrote:
Yes, but they are lexed and parsed, right?
Right, but that's the case regardless of `version(StdUnittest)`.
On Saturday, 21 August 2021 at 08:14:22 UTC, Виталий Фадеев wrote:
Any more ?
CPP2D
https://github.com/lhamot/CPP2D
On Tuesday, 17 August 2021 at 13:46:22 UTC, z wrote:
Is it possible to set a "position" on a union member?
You can use anonymous `struct` and `union` blocks.
```D
union UnionExample{
uint EAX;
struct {
//upper
union {
ushort EAHX;
struct {
Thanks for this solution as well.
On Tuesday, 10 August 2021 at 13:10:23 UTC, Paul Backus wrote:
Would definitely be nice to have this in the language, though.
Do you know more use cases for this?
Thanks! I was considering turning the static array into an
AliasSeq directly, but casting it to a struct and doing tupleof
on that is pretty smart.
On Tuesday, 10 August 2021 at 12:50:55 UTC, jfondren wrote:
And I don't see very many static-array-generic functions in
Phobos.
Indeed, static a
```D
struct Vec {
float x, y, z;
}
void setPosition(float x, float y, float z) {
}
void main() {
Vec posS = Vec(10, 20, 30);
setPosition(posS.tupleof); // pass
float[3] posA = [10, 20, 30];
setPosition(posA.tupleof); // Error: no property `tupleof`
for type `float[3]`
}
`
On Sunday, 8 August 2021 at 01:37:42 UTC, SealabJaster wrote:
Could this be fixed? Or is this intentional?
Of course it *could*, anyone can go to [the dlang
wiki](https://wiki.dlang.org/LDC) and add a page for it. Johan
Engelen is still working on [improving the
feature](https://github.com/l
On Friday, 6 August 2021 at 12:30:16 UTC, JG wrote:
I guess this means that tracy has been integrated?
If this is so is it documented anywhere how to use it?
Stefan Koch's WIP tracy integration in DMD is completely separate
from Johan Engelen's time tracing added to LDC in 1.25.0. Note
that t
On Friday, 23 July 2021 at 18:53:06 UTC, JG wrote:
Any suggestion on how to try and improve the build time. I am
currently using dub.
You can try profiling it with LDC 1.25 or later. Add this to
dub.sdl:
```
dflags "--ftime-trace" platform="ldc"
dflags "--ftime-trace-file=./my-trace.json" pl
On Saturday, 17 July 2021 at 12:05:44 UTC, ag0aep6g wrote:
Hm, as far as I understand, "strongly pure" doesn't require
`immutable` parameters. `const` should be enough. The spec
says: "A strongly pure function has no parameters with mutable
indirections" [1].
I just took the description from
On Saturday, 17 July 2021 at 05:44:24 UTC, ag0aep6g wrote:
I tried doing that, but `-preview=dip1000` causes trouble. This
fails:
(...)
I'm not sure what's going on.
I'm not completely caught up, but from what I see, pure and
immutable have a history of issues:
[Issue 11503 - Type system br
On Friday, 16 July 2021 at 20:45:11 UTC, H. S. Teoh wrote:
Have you tried `pure`?
The code in question is all `@safe pure nothrow`.
On Friday, 16 July 2021 at 20:39:41 UTC, Ali Çehreli wrote:
So to me, newly created data should be mutable for the most
usability.
It's clear that I stripped away too much context with the toy
examples, so let me try to add some back. I don't like forcing
the use of `immutable` in general, bu
I like passing around immutable data, but I don't like creating
it. Here are some toy examples to illustrate:
```D
immutable(int)[] positive(int[] input) @safe
{
return input.filter!(x => x > 0).array;
}
```
Error: cannot implicitly convert expression
`array(filter(input))` of type `int[]`
On Friday, 9 July 2021 at 15:11:38 UTC, Steven Schveighoffer
wrote:
But reading/writing, closing these file descriptors is always
the same.
For sockets you'd typically use `recv` and `send` instead or
`read` and `write` because the former give extra options and the
latter don't work on Window
On Wednesday, 7 July 2021 at 01:44:20 UTC, Steven Schveighoffer
wrote:
But it got me thinking, how often do people roll their own vs.
trying to compose using existing Phobos nuggets?
When there's not an obvious/simple way to do something by
composing ranges, I tend to just give up and write pr
On Friday, 9 July 2021 at 10:19:59 UTC, Виталий Фадеев wrote:
It possible in current version 2.097 ?
If you `import std.typecons` you can do:
```D
element.border = tuple(1, solid).expand;
```
But it's not pretty. I suggest either calling the function
regularly, or combing all settings in a si
On Friday, 9 July 2021 at 08:08:57 UTC, rempas wrote:
I just wonder if I'm able to do system calls directly from D or
If I have to create bindings from "unistd.h" from C
If with directly means 'without calling any C function' you can
use inline assembly:
```D
version(linux)
void rt_sigreturn(
On Thursday, 8 July 2021 at 23:31:57 UTC, Antonio wrote:
"It works as described in the manual, not as expected" (from
MySQL haters club :-p) .
Yeah, 50/285 people answering the question "What language
features do you miss?" chose "UFCS for local symbols" in the
[State of D survey
(2018)](htt
On Thursday, 8 July 2021 at 22:24:26 UTC, Antonio wrote:
I supossed that ```mfp(c,20)``` and ```c.mfp(20)``` should be
equivalent because UFCS in second example, but it is not... why?
UFCS does not work for nested functions.
Functions declared in a local scope are not found when
searching fo
On Thursday, 8 July 2021 at 14:20:16 UTC, Виталий Фадеев wrote:
Has dub flag for disable "warnings are treated as errors" ?
You have to edit the package file to include `buildRequirements
"allowWarnings"`, see
https://dub.pm/package-format-sdl.html#build-requirements
On Thursday, 8 July 2021 at 13:51:51 UTC, Виталий Фадеев wrote:
I searching trivial simple D/OpenGL working in 2021 year
example.
https://github.com/dkorpel/glfw-d/tree/master/examples/triangle-gl
Uses bindbc-opengl + glfw-d (my package), example uses OpenGL
3.3. Should works on Windows and L
On Tuesday, 6 July 2021 at 10:06:11 UTC, Jack Applegame wrote:
How to disable `register.clock = 10;` but allow
`register.clock(1) = 10;`?
I want to get a compilation error on `register.clock = 10;`
We're [still awaiting formal assessment on
dip1038](https://forum.dlang.org/thread/sojvxakgruzf
On Saturday, 3 July 2021 at 17:20:47 UTC, Luis wrote:
scope(exit) inside of a anonymous functions, it's never called.
I think the compiler infers the function `nothrow` since you
don't throw any `Exception`, only an `Error`. Errors represent
unrecoverable bugs, after which the program is in a
On Wednesday, 30 June 2021 at 03:52:51 UTC, someone wrote:
at least I can do nulls with strings since it a class :)
A `string` is not a class but an array, an `immutable(char)[]`.
For arrays, `null` is equal to an empty array `[]`.
```D
void main() {
string s0 = null;
string s1 = [];
On Thursday, 24 June 2021 at 14:06:11 UTC, seany wrote:
void f() {
a[] * rd;
// DO SOME WORK HERE
this.dataSet = & rd_flattened;
rd = cast (a [] *) dataSet;
write("length of rd is : "); writeln((*rd).length); // <---
this works..
// do some work on
On Friday, 18 June 2021 at 09:05:38 UTC, Mike Brown wrote:
im doing this in a compile time function as well.
If it's a compile time string you can use mixin()
On Thursday, 17 June 2021 at 21:41:28 UTC, Steven Schveighoffer
wrote:
Any ideas on better ways to handle this?
I've had such a situation before too where I want to switch over
enums I read from an ELF file which can't be assumed to be
correct, but I also don't want to forget one. For a tight
On Wednesday, 16 June 2021 at 16:27:13 UTC, Dennis wrote:
It has to be a linker error, dmd cannot know at the time of
compiling project A how project B is going to be compiled and
vice versa.
Well I suppose you could use a specific dub configuration, maybe
giving 'hostname' a targetType "sour
On Wednesday, 16 June 2021 at 14:38:10 UTC, jfondren wrote:
What do I change to
1. a script like this that uses hostname
2. the hostname module
so that both can be built with -betterC when and only when
the script is using -betterC?
That's currently the situation: you can only build when both
On Tuesday, 15 June 2021 at 12:18:26 UTC, VitaliiY wrote:
It's simple with STARTDATA as mixin, but STOREBITS and ADDBITS
use variables defined in STARTDATA scope, so I can't understand
how to do mixin template with it.
If the code duplication isn't too bad, consider just expanding
the C macro
On Friday, 11 June 2021 at 08:30:29 UTC, Moth wrote:
what's going on?
It's a bug:
[Issue 19178 - Static initialization of 2d static arrays in
structs produces garbage or doesn't compile
sometimes](https://issues.dlang.org/show_bug.cgi?id=19178)
On Thursday, 10 June 2021 at 19:37:36 UTC, seany wrote:
However, i sometimes see, that the results are _radically_
different.
Are you using uninitialized memory or multi-threading?
On Monday, 31 May 2021 at 03:44:15 UTC, btiffin wrote:
Is there a way to make that less codey, more jokey, *but still
compile and execute the hip hip array*?
```D
import std;
alias cheer = each!writeln;
void main() { D(); }
void
D() { cheer = ["hip", "hip"].array; }
```
On Thursday, 27 May 2021 at 10:27:42 UTC, Tariq Siddiqui wrote:
Thanks for your answer, -betterC works well with simple code
but when using templates in code -betterC compilation failed.
Templates are supported in -betterC, what's not supported can be
found here:
https://dlang.org/spec/better
On Thursday, 27 May 2021 at 08:47:50 UTC, Tariq Siddiqui wrote:
- What are these additional lines?
D generates extra symbols per module for things like module
constructors, unittests and class introspection (I think).
- How can I remove these lines from being generated?
Pass the `-bette
On Sunday, 23 May 2021 at 14:13:36 UTC, Alain De Vos wrote:
This one compiles without any problem.
You annotated main `@trusted`, which means you want the compiler
to assume it to be `@safe` without checking it. Mark it `@safe`
and it reports:
Error: address of variable `a` assigned to `q`
On Saturday, 15 May 2021 at 17:55:17 UTC, Alain De Vos wrote:
Feature request, a function old which does the opposite of new,
allowing deterministic,real-time behavior and memory
conservation.
You can use
[object.destroy](https://dlang.org/phobos/object.html#.destroy)
to destruct, and
[GC.f
On Saturday, 15 May 2021 at 11:38:22 UTC, Adam D. Ruppe wrote:
* rdmd runs the program too, dmd -i just compiles. You run the
program separately.
You can do `dmd -i -run main.d`
On Saturday, 8 May 2021 at 09:05:18 UTC, Alain De Vos wrote:
I must doing something wrong ?
Did you define the `SFML_Graphics` version like in the README of
bindbc-sfml?
On Friday, 7 May 2021 at 08:52:13 UTC, Dennis wrote:
If you want to use it on Windows as well, this is a code
snippet I wrote for that:
For completeness, the imports it uses:
```D
version(Windows) {
import core.sys.windows.windows;
import core.sys.windows.psapi: PROCESS_MEMORY_COUNTERS
On Friday, 7 May 2021 at 08:25:43 UTC, Andre Pany wrote:
Is there some equivalent function in Phobos to get the cpu time
on linux?
I don't think so, but you can use `core.sys.posix.sys.resource:
rusage`.
If you want to use it on Windows as well, this is a code snippet
I wrote for that:
```
On Wednesday, 5 May 2021 at 15:03:16 UTC, Blatnik wrote:
Is there any way to check for multiple conditions in a
`version` statement?
No, and that's by design to discourage complex version logic.
The recommended approach is:
```D
version (Version_A) version = Cool_Feature_Supported;
version (Ve
On Friday, 16 April 2021 at 17:50:13 UTC, Alain De Vos wrote:
The following very simple low level C-function simply sets the
mixer volume. How to convert this simple function to dlang ?
```
void mixer_setlevel_stereo(int mixfd,int dev,int left,int right)
{
left+=256*right;
#int_ioctl(int fd, uns
On Friday, 12 March 2021 at 05:53:40 UTC, Preetpal wrote:
This is not an important issue to me but I was just curious to
see if anyone actually tests for portability issues related to
endianness by compiling their D Lang code for a big endian
architecture and actually running it on that system.
On Thursday, 11 March 2021 at 12:56:34 UTC, Виталий Фадеев wrote:
What right way to call function directly with selecting one of
two ?
If they are not nested functions, you can also do:
```
// Separate names
void processKey (ref MouseKeyEvent event) {...}
void processMove(ref MouseMoveEvent eve
On Wednesday, 24 February 2021 at 19:38:53 UTC, Mark wrote:
Is there a way to obtain a list, at compile-time, of all the
exception types that a function might throw (directly or
through a call to another function)?
No, since this is not known at compile-time.
See:
https://forum.dlang.org/pos
On Thursday, 28 January 2021 at 18:37:37 UTC, Ruby The Roobster
wrote:
object.Error@(0): Integer Divide by Zero
Why is this happening? Does anybody know?
data[0] = (new egg(0,0,"a"));
Here you set data[0].y to 0
tempb = data[x].y;
In the first iteration, this equals data[0].y which equal
On Tuesday, 19 January 2021 at 22:26:52 UTC, Tim wrote:
I need to be able to check in a template whether the type given
is an array type so that I can do some different logic. How can
I do this?
`if(is(T == E[], E))` or `isDynamicArray!T` is you `import
std.traits;`
On Thursday, 14 January 2021 at 18:24:44 UTC, ddcovery wrote:
If it's not a bother, I'd like to know how you usually approach
it
Usually I don't deal with null because my functions get primitive
types, slices, or structs. `ref` parameters can be used to
replace pointers that may not be null.
On Wednesday, 13 January 2021 at 14:04:52 UTC, dog2002 wrote:
I could use extern(c) and Process Walking (Process32First,
Process32Next), but maybe there is a way to get the list by
means of D?
I don't think this is part of the standard library.
Here's a piece of code I wrote a while ago if tha
On Saturday, 12 December 2020 at 18:14:31 UTC, Paul Backus wrote:
IMO this is one of the stupider design decisions in D, but it's
unlikely it will ever be fixed. The easiest workaround is to
use string mixins instead, which work the way you'd expect them
to.
If issue 19365 got fixed, it could
On Wednesday, 25 November 2020 at 16:27:41 UTC, Jan Hönig wrote:
What is the "easiest" way to parse D code?
(...)
libdparse seems to do it as well with `parseModule` function.
https://github.com/dlang-community/libdparse/blob/master/src/dparse/parser.d
I recommend libdparse.
dmd has to do it s
On Wednesday, 4 November 2020 at 11:15:33 UTC, Vladimirs Nordholm
wrote:
Is there a "best practice" of what the source folder should be
called?
`dub init` creates a folder named `source`, so I would stick with
that.
On Thursday, 22 October 2020 at 17:25:44 UTC, Bruce Carneal wrote:
Is type checking in D undecidable? Per the wiki on dependent
types it sure looks like it is.
It is indeed undecidable. Imagine you had a decider for it.
Because CTFE is clearly turing-complete, you can express that in
a D fun
On Saturday, 17 October 2020 at 14:50:47 UTC, NonNull wrote:
I have inherited an open source C project that assumes that the
size of a long and the size of a pointer are the same, and I
have translated it into very similar D just like
https://dlang.org/blog/2018/06/11/dasbetterc-converting-make
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 Tuesday, 4 August 2020 at 19:52:47 UTC, Andy Balba wrote:
i.e. D equivalent to C++ command system("MyExe")
Apart from std.process, you can also call the C function in D
after importing core.stdc.stdlib:
https://dlang.org/library/core/stdc/stdlib/system.html
On Friday, 31 July 2020 at 14:17:14 UTC, jeff thompson wrote:
dlib.lib(dlib.audio.io.wav.obj) : error LNK2019: unresolved
external symbol
_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv
referenced in function
_D3std6format__T10printFloatTfTaZQrFNaNfNkAafSQBsQBr__T10FormatSpecTaZQ
On Wednesday, 22 July 2020 at 21:58:16 UTC, Cecil Ward wrote:
I need to then work out what is the size of the internal units
within the 128-bit value, size in bytes,1 or 2, at compile time.
You can use the .sizeof property on the type.
```
import core.simd;
void main() {
ubyte16 a;
ush
On Saturday, 18 July 2020 at 18:46:16 UTC, Carl Sturtivant wrote:
Is there any way to avoid the duplication of the entries in the
anonymous union, aside from using a mixin template?
I think this would be fixed if
https://github.com/dlang/dmd/pull/11273 gets merged.
On Wednesday, 1 July 2020 at 19:33:08 UTC, JN wrote:
Bit off-topic, but if you can use them, debug contexts offer
much better OpenGL error-checking experience.
https://www.khronos.org/opengl/wiki/Debug_Output . Instead of
checking glGetError() after each call, you can setup a C
callback that w
On Wednesday, 1 July 2020 at 18:54:55 UTC, Dennis wrote:
It sort of works, but it seems it does not start at the right
stack frame, the top item is this:
??:? void rt.dmain2._d_run_main2(char[][], ulong, extern (C)
int function(char[][])*).runAll().__lambda1() [0x55c19a09c1fa]
So dmd skips t
On Wednesday, 1 July 2020 at 18:44:10 UTC, Stanislav Blinov wrote:
void assertNoOpenGLErrors(string file = __FILE__, int line =
__LINE__, string func = __PRETTY_FUNCTION__)
{
if (glGetError() != GL_NO_ERROR) {
print(file, ":", line, ":", func, ": blah");
exit();
}
}
:)
On Wednesday, 1 July 2020 at 18:05:09 UTC, Jacob Carlborg wrote:
[1]
https://dlang.org/phobos/core_runtime.html#.Runtime.traceHandler
Thanks, but I don't want to re-implement the default trace
handler, I want to use it on a specific location and capture its
output. I'll be more specific in wh
On assertion failure, the default error handler prints a stack
trace that looks like this
[library functions]
[application functions]
[druntime start-up functions]
I'm only interested in application functions, the rest is noise.
I could easily filter unwanted lines out if I had the stack trace
On Saturday, 20 June 2020 at 13:32:22 UTC, Vinod K Chandran wrote:
I would like to know how to get & set text in clipboard. I am
using windows machine.
This is an example of setting the clipboard using the Windows API
in D:
```
/// Returns: true on success
bool setClipboard(string str) {
On Wednesday, 27 May 2020 at 17:33:33 UTC, Vinod K Chandran wrote:
I am saving this enum values as string in database. So, when i
retrieve them from the database, how can i parse the string
into TestEnum ?
Use `to` from `std.conv`.
```
import std.conv: to;
void main() {
assert("Received".
On Wednesday, 27 May 2020 at 09:56:07 UTC, wjoe wrote:
The problem with catch(Exception) is that it's run time whereas
I'd like to know compile time which exception may possibly be
thrown.
Note that this is impossible in general due to the nature of
classes.
A function could at runtime find t
On Friday, 15 May 2020 at 19:19:59 UTC, H. S. Teoh wrote:
Here's how to do it:
int add(int[] args...) {
... // access `args` here as an array
}
Beware that that language feature, typesafe variadic functions,
might become deprecated:
https://github.com/dlang/dm
On Thursday, 14 May 2020 at 06:08:17 UTC, Vinod K Chandran wrote:
On Thursday, 14 May 2020 at 06:05:00 UTC, Vinod K Chandran
wrote:
Hi all,
I wrote a class and in VS Code, DScanner says that the class
is undocumented. How can i document a class ?
Never mind, i found the answer myself. Just li
On Thursday, 7 May 2020 at 10:21:07 UTC, Dukc wrote:
Is there some way to measure the performance of a function so
that the results will be same in different computers (all x86,
but otherwise different processors)? I'm thinking of making a
test suite that could find performance regressions
aut
On Thursday, 9 April 2020 at 19:27:16 UTC, Quantium wrote:
I see this code imports drivers and does it depend on processor
architecture? Would it work only on 64-bit or 32-bit or some
special architechtures?
kernel32.dll and psapi.dll should be present on any normal
Windows 10 installation.
On Thursday, 9 April 2020 at 17:23:19 UTC, Quantium wrote:
Ok. For training example, we're using Windows 10 Por. We can
use WinAPI. Are there any D libs to use WinAPI?
I have used the Windows API to read/write into a different
process before. Here is some example code in case it's useful: (I
On Thursday, 2 April 2020 at 13:23:29 UTC, Dennis wrote:
writeln recognizes b and h as ranges, and prints them by
iterating over each element,
Correction: this only applies to `h`, the array slice `b` will
not be mutated by writeln.
On Thursday, 2 April 2020 at 12:59:06 UTC, AlexM wrote:
Please explain me whats wrong with binery heap?!!!
This has nothing to do with binaryheap and all to do with writeln.
writeln recognizes b and h as ranges, and prints them by
iterating over each element, which advances the range to the en
On Thursday, 26 March 2020 at 19:34:08 UTC, Quantium wrote:
1. How can I make string ONLY char[] (Not immutable)
You can use .dup to make a mutable copy of an array.
```
char[] a = "abc".dup;
```
2. How can I work with some of chars in the stirng, is, for
example:
string s="abc";
wr
On Sunday, 22 March 2020 at 18:48:32 UTC, Abby wrote:
Is there a way to create a template that would do the same is
glib
g_return_val_if_fail()
(https://developer.gnome.org/glib/stable/glib-Warnings-and-Assertions.html#g-return-val-if-fail)
I'm not famililar with glib, but the description:
On Tuesday, 17 March 2020 at 22:47:43 UTC, Sebastiaan Koppe wrote:
Dont trust that marketing, there is actually decent scripting
in gamemaker, which you'll need if you get creative.
Second that. GameMaker is how I got into programming at age 12,
and look where I ended up ;)
On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer
wrote:
I want to try and learn how to write 2d games. I'd prefer to do
it with D.
I haven't seen anyone mention Dgame yet:
https://github.com/Dgame/Dgame
It's not maintained anymore since last November [1], but is seems
pretty ma
On Sunday, 15 March 2020 at 19:07:05 UTC, ... wrote:
And if I need to create very large value, how to use GMP
library (It isn't described in that post)?
You can use C bindings [1], look up examples in C and do the same
in D, or use a high-level wrapper [2].
[1] https://code.dlang.org/package
On Sunday, 15 March 2020 at 16:42:52 UTC, Panke wrote:
Should this just work and by box is not correctly configured or
do I need some pretty printers? If so, has someone already made
them?
Take a look at:
https://forum.dlang.org/post/ztyhmmxalpiysgjkv...@forum.dlang.org
On Saturday, 7 March 2020 at 10:49:24 UTC, Paolo Invernizzi wrote:
Frankly, I simply hate all that shuffle around names ...
I remember someone noting how unusual it is for D to have a name
for its standard library, "Phobos".
On Thursday, 5 March 2020 at 11:31:43 UTC, mark wrote:
I've now got Martin Porter's own Java version, so I'll have a
go at porting that to D myself.
I don't think that's necessary, the errors seem easy to fix.
src/porterstemmer.d(197,13): Error: cannot implicitly convert
expression s.length o
On Sunday, 23 February 2020 at 09:03:56 UTC, mark wrote:
Then this would not only help dscanner, but also make it clear
to programmers that the argument could be modified.
(This is done in Rust with f(&mut arg), and I certainly find it
helpful.)
C# also does it, and uses exactly the same key
On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw wrote:
Is there a dmd flag that shows the code after template
instantiations has been performed?
The -vcg-ast flag does that.
On Tuesday, 18 February 2020 at 17:11:55 UTC, Marcel wrote:
Say I have a struct where every member function can either be
static or not depending on a template parameter. Is there a
simple way to do this?
The best I can think of is:
```
mixin template maybeStatic() {
void foo() {
On Wednesday, 19 February 2020 at 07:09:02 UTC, April wrote:
What's the current state of MIPS compiling for bare metal?
Especially the R4300i processor.
I've had some success with running D code on Nintendo 64
emulators, which emulate a R4300i processor. I'm compiling with:
ldc2 -march=mips
Thanks for your perspective. Just a few things are unclear to me:
On Wednesday, 12 February 2020 at 10:39:06 UTC, mark wrote:
I don't find the presentation of the member properties and
methods very easy to read
Can you elaborate a bit on this?
The lack of set and B-tree types is disappointing
On Friday, 7 February 2020 at 21:40:36 UTC, Steven Schveighoffer
wrote:
S.popFront is not @safe, and S is not a template. So no
inferrence.
Oops, minimized a bit too much. Corrected test case:
```
import std;
struct S {
@safe:
int[3] front = [10, 20, 30];
bool empty = false;
voi
On Friday, 7 February 2020 at 20:55:14 UTC, nullptr wrote:
Depending on how your range is structured, it might be possible
to just mark front as returning by ref to make this work.
That's a good one. I can't make front() return by ref, but I can
make front a member variable of the range struct
On Friday, 7 February 2020 at 20:31:47 UTC, Steven Schveighoffer
wrote:
The only solution I can provide is to wrap the static array
into a range (maybe something like this exists in Phobos?):
Thanks. I was hoping something like that existed in Phobos, but I
can't find anything.
If I have an input range with element type `int[3]`, how do I
easily turn it into a range of `int` so I can map it?
If it were an int[3][] I could simply cast it to an int[] before
mapping, but I don't want to eagerly turn it into an array.
I thought of doing this:
```
range.map!(x => x[]).joine
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
On Sunday, 2 February 2020 at 18:18:28 UTC, Steven Schveighoffer
wrote:
scope should have been a type constructor.
I feel the same way, I find const/immutable much easier to reason
about than scope in its current state.
Do you think scope as a storage class is fundamentally broken, or
is it s
Thanks for your response.
On Sunday, 2 February 2020 at 15:20:39 UTC, ag0aep6g wrote:
Now it's important to realize that `scope` only applies to the
top-level of the type.
This is where my confusion was.
I knew scope wasn't transitive, so I thought that `scope
string[1]` meant the static arra
Compiling the following with -dip1000 gives an error.
```
void main() @safe {
string[1] a0;
scope int[1] a1;
scope string[1] a2;
scope string[] b0 = a0[]; // Fine
scope int[] b1 = a1[]; // Fine
scope string[] b2 = a2[]; // Error: cannot take address of
scope local a2
}
On Thursday, 23 January 2020 at 17:10:29 UTC, berni44 wrote:
I'd like to get a list of all items (public, package, private)
that are defined in a D file. Is there a simple way, to get
them?
You can pass the -X flag to dmd, which makes it generate a .json
file describing the compiled file.
On Thursday, 9 January 2020 at 13:04:33 UTC, Marcone wrote:
I am creating a GUI using winsamp.d as model.
See the window here: https://i.ibb.co/ZJ4v2KD/Sem-t-tulo.png
I want to ask a user for choose a color when click
Configuration/Color, and then change backgroud color of GUI.
But how can I cr
I would say it should return a ubyte[].
On Monday, 6 January 2020 at 10:07:37 UTC, WebFreak001 wrote:
Or should void[] actually be castable to ubyte[] in @safe code?
Definitely not with the current semantics, since a void[] can
alias pointers in @safe code.
See: https://issues.dlang.org/show
101 - 200 of 339 matches
Mail list logo