On Friday, 18 July 2025 at 16:58:13 UTC, Luna wrote:
On Friday, 18 July 2025 at 16:50:07 UTC, realhet wrote:
On Friday, 18 July 2025 at 15:42:23 UTC, realhet wrote:
On Friday, 18 July 2025 at 15:25:04 UTC, Kagamin wrote:
ldc has libs in lib/mingw
libcmt and co are a part of the Windows SDK.
On Friday, 18 July 2025 at 15:42:23 UTC, realhet wrote:
On Friday, 18 July 2025 at 15:25:04 UTC, Kagamin wrote:
ldc has libs in lib/mingw
Ok I was doing too much:
I uninstalled the whole sdk and it turned out It works
miraculously just by itself:
`ldc2 win32_app.d -L/subsystem:windows` as si
On Friday, 18 July 2025 at 15:25:04 UTC, Kagamin wrote:
ldc has libs in lib/mingw
Please help me how to use it.
Currently I managed to compile a very simple example, after
installing win10 sdk:
I was happy that I don't even need to pass
--m64
--line-internally
Because it was defaulted.
I onl
Hello,
What are the minimal environment to do generate win32 64bit
windoswed exe's nowadays?
Can I do it with only these two?
- LDC2 release
- and a few static lib files extracted from the windows 10 sdk
Is it right?
Is there a way to avoid that 2 gigabytes of SDK somehow?
Is it possible to a
On Saturday, 28 June 2025 at 08:11:53 UTC, realhet wrote:
On Thursday, 26 June 2025 at 16:40:10 UTC, Steven Schveighoffer
wrote:
On Tuesday, 24 June 2025 at 08:48:16 UTC, realhet wrote:
For those who run into this problem: These are really illegal
things in the destructors:
- GC allocation.
On Thursday, 26 June 2025 at 16:40:10 UTC, Steven Schveighoffer
wrote:
On Tuesday, 24 June 2025 at 08:48:16 UTC, realhet wrote:
Finalizers are run with the world resumed.
I'll remember this. It sounds less mystical than I thought.
Currently I'm having an 'infrastructure' that's like:
I'm ma
Hi,
I started to make a resident texture class, it just holds a
TexHandle (an int).
I it's destructor, I try to notify the outer world in a thread
safe way that that the handle is no longer in use.
I know that in the ~this() I have restricted options.
I tried to do this with a simple queue ob
On Saturday, 24 May 2025 at 12:53:21 UTC, realhet wrote:
On Friday, 23 May 2025 at 13:10:47 UTC, Dennis wrote:
Now I reached a point it's quite stable.
I had 2 problems to solve:
1. glslc.exe (the external compiler) sometimes freezed at the
exit.
Solution: Use a modified version of executeShel
On Wednesday, 28 May 2025 at 11:32:53 UTC, Jonathan M Davis wrote:
On Wednesday, May 28, 2025 5:04:06 AM Mountain Daylight Time
realhet via Digitalmars-d-learn wrote:
Yes, most of the time I can put __FILE__ and __LINE__ onto a
runtime function parameter.
But this time it is a requirement:
I
On Wednesday, 28 May 2025 at 10:13:43 UTC, realhet wrote:
On Tuesday, 27 May 2025 at 21:16:57 UTC, monkyyy wrote:
On Tuesday, 27 May 2025 at 21:07:51 UTC, realhet wrote:
I've found a way to eliminate !() by using a function:
```d
struct LOCATION_t2
{
string location;
string toString()
On Tuesday, 27 May 2025 at 21:16:57 UTC, monkyyy wrote:
On Tuesday, 27 May 2025 at 21:07:51 UTC, realhet wrote:
I stay in safety and choose this way:
```d
enum _LOCATION_(string FILE=__FILE__, size_t LINE=__LINE__) =
FILE~'('~LINE.text~",1)";
enum loc1 = (_LOCATION_!());
enum loc2 = (_LOCAT
On Tuesday, 27 May 2025 at 15:01:38 UTC, monkyyy wrote:
On Tuesday, 27 May 2025 at 10:20:40 UTC, realhet wrote:
Hi and thanks for trying!
t2!(x) //The problem with this is the __LINE__ will point to the
alias declaration, not the pragma.
Interesting trick: template nested inside a templat
Hello,
```d
template T1(string FILE=__FILE__, size_t LINE=__LINE__, A...)
{
enum T1 = FILE ~ LINE.text ~ A.text;
}
pragma(msg, T1!(__FILE__,__LINE__, "hello", " world")); //works
pragma(msg, T1!(__FILE__,__LINE__,i"Hello $("World")")); //works
pragma(msg, T1!(i"Hello $("World")")); //error: does
On Friday, 23 May 2025 at 13:10:47 UTC, Dennis wrote:
I recommend keeping it simple, cover common cases and don't try
to make it perfect, because it won't be. But if you do somehow
make it perfect, post your results, I'd love to see it!
When you look at it through my glasses (graphical IDE), I
On Friday, 23 May 2025 at 22:11:58 UTC, Ali Çehreli wrote:
On 5/23/25 6:10 AM, Dennis wrote:
> This results in a complex system that's more annoying to deal
with than
> the original problem of just maintaining a .d file and shader
file in
> parallel, which is what I'm doing now for the time bein
On Wednesday, 21 May 2025 at 15:20:57 UTC, realhet wrote:
Why are these simple looking things are so slow in compile time?
Now I learned why: I had the misconception that CTFE is using the
compiler itself to generate code and then runs it with the CPU.
In reality I've found out it's an inter
On Wednesday, 21 May 2025 at 14:40:21 UTC, realhet wrote:
On Wednesday, 21 May 2025 at 14:00:56 UTC, realhet wrote:
Small program to reproduce.
I'm lucky:
`pragma(msg, "Here comes the big data: ", data);`
With this simple way I managed to put 16MB large data through it
in no time.
It was new t
On Wednesday, 21 May 2025 at 14:00:56 UTC, realhet wrote:
Hi,
Small program to reproduce.
```d
import std;
string doit(string data)()
{
static foreach(i; 0..256)
{
pragma(msg, i"Here goes lots of data:
$(cast(ubyte[])data)".text);
}
return "dummy";
}
static
Hi,
I have a pragma(msg, xxx) statement where x is a byte array of
30KBytes.
LDC2 produces the following symptom: It's memory usage goes
slowly up to the maximum (20GB) then stops with out of memory
error. The amount of used memory grows in an exponentially
slowing rate. (I guess it's a rea
On Monday, 31 March 2025 at 13:24:11 UTC, realhet wrote:
Hello,
Update: One ugly workaround I've found is to put a dummy struct
around the string mixin, but that introduces unwanted redundancy.
It seems like only module level enum type declarations are lost
if they were mixed in.
On Monday, 31 March 2025 at 14:59:21 UTC, FeepingCreature wrote:
On Monday, 31 March 2025 at 13:24:11 UTC, realhet wrote:
Can you give a repro? It works here.
Ok, I tried and gave up, it's too big.
But I've found what is triggering it. The problem roots in
circular module imports, and this m
On Monday, 31 March 2025 at 17:21:03 UTC, realhet wrote:
On Monday, 31 March 2025 at 14:59:21 UTC, FeepingCreature wrote:
On Monday, 31 March 2025 at 13:24:11 UTC, realhet wrote:
Forgot the picture link:
[https://ibb.co/1GXKvfQz](https://ibb.co/1GXKvfQz)
I'm kinda abusing the circular import
On Monday, 31 March 2025 at 14:59:21 UTC, FeepingCreature wrote:
Can you give a repro? It works here.
You are right, I just tested in small scale and it worked.
```
module a;
enum EGood:ubyte {e1, e2}
mixin(q{enum EBad:ubyte {e1, e2} });
struct Dummy { mixin(q{enum EUgly:ubyte {e1, e2} });
Hello,
I have a module with an enum declaration: `module a; enum
E:ubyte{ e1, e2 }`
I can import it into a different module: `module b; import a : E;`
But if I generate the enum with a string mixin: `module a;
mixin(q{enum E:ubyte{ e1, e2 }});`
I get an error: module `a` import `E` not fou
On Sunday, 2 March 2025 at 23:28:09 UTC, Inkrementator wrote:
On Sunday, 2 March 2025 at 19:31:06 UTC, realhet wrote:
Anyone have an idea?
While template mixins have access to the caller scope, the
default values for parameters apparently don't.
Thank you, both of you!
That was the key to
Hello,
```d
mixin template T(string def, alias C = typeof(mixin("new
class{"~def~"}")))
{
enum generatedStr = FieldTypeTuple!C.stringof;
}
void main()
{
{
mixin T!"int a, b;";
pragma(msg, generatedStr); //works
}
{
struct LocalStruct(){ int aaa; }
On Thursday, 20 February 2025 at 03:54:28 UTC, Jonathan M Davis
wrote:
On Wednesday, February 19, 2025 7:48:48 PM MST Jonathan M Davis
via Digitalmars-d-learn wrote:
So you should probably either just make your code operate on
ranges of dchar
Thank You for the deep explanation!
This thing che
On Wednesday, 19 February 2025 at 19:08:07 UTC, bauss wrote:
On Wednesday, 19 February 2025 at 18:13:24 UTC, realhet wrote:
...
std.conv.to can convert for you.
Thx!
I tried .map!(to!dchar) instead of .byChar and it still failed.
But then I deleted the constraints where I detect if the
Hello,
The problematic line is at the very bottom.
I only managed to make it run by precedding the .byChar with
.text, but that is unwanted because it would convert the whole
InputRange.
How can I do this dchar->char conversion on only the required
number of chars? (The kwSearch function wi
On Wednesday, 15 January 2025 at 21:55:30 UTC, monkyyy wrote:
On Wednesday, 15 January 2025 at 21:00:35 UTC, realhet wrote:
On Wednesday, 15 January 2025 at 20:27:18 UTC, Steven
Schveighoffer wrote:
On Wednesday, 15 January 2025 at 12:01:21 UTC, realhet wrote:
Also seems like invalid syntax.
On Wednesday, 15 January 2025 at 20:27:18 UTC, Steven
Schveighoffer wrote:
On Wednesday, 15 January 2025 at 12:01:21 UTC, realhet wrote:
Also seems like invalid syntax. Where does this come from?
It's in std.typecons.d -> [git
link](https://github.com/dlang/phobos/blob/336bed6d8ffec74d117b7
```d
struct Tuple(T...){ T expand;alias expand this; }
pragma(msg, isTuple!(Tuple!(int)));
```
And LDC2's opinion about Your Tuple is: Not a tuple :D
These are the mysterious parts of the language, I like this
stuff, even I can't understand.
When I write:
template f(Specs...)f(T.init);
The compiler syntactically refuses it: It expects a '{', not a
"f".
Why they use this inside a __traits(compiles, {}) in Phobos?
Does it makes sense inside there?
Hello,
I'm working on understanding and automating the contents of an X
Json file generated by LDC2.
I'm testing it by processing the whole Phobos lib.
The weirdest thing that I've found is this:
X Json:
```
```
With my program, I transformed into this header source code:
```d
public template
On Saturday, 4 January 2025 at 19:54:19 UTC, realhet wrote:
On Saturday, 4 January 2025 at 15:34:27 UTC, monkyyy wrote:
On Saturday, 4 January 2025 at 13:56:47 UTC, realhet wrote:
Only the very complex stuff works weird in CT -> text, format...
I think I've found the solution, it was so simpl
On Saturday, 4 January 2025 at 15:34:27 UTC, monkyyy wrote:
On Saturday, 4 January 2025 at 13:56:47 UTC, realhet wrote:
Id check that it is a string and not some sort of lazy wrapper
type doing worse of both world things; I usually use `enum
string[]` for mixin-y things when possible, idk wha
Hello,
I have an array of array of strings, a 2D table encapsulated in a
struct:
The first few rows look like this.
```d
enum TBL_niceExpressionTemplates =
(表([
[q{/+Note: Name+/},q{/+Note: Example+/},q{/+Note:
Pattern+/},q{/+Note: op+/},q{/+Note: Style+/},q{/+Note:
Syntax+/},q{/+Note: Clas
On Sunday, 1 December 2024 at 21:35:43 UTC, monkyyy wrote:
On Sunday, 1 December 2024 at 20:29:30 UTC, realhet wrote:
Update: This not works!
You have more code in that one file then I try to have in a
*project*, so idk but if your still looking at the file, may as
well say my thing
The r
On Sunday, 1 December 2024 at 19:55:59 UTC, realhet wrote:
On Sunday, 1 December 2024 at 00:08:02 UTC, Richard (Rikki)
Andrew Cattermole wrote:
The trick...
Update: This not works!
This is another ugly fix:
```d
import het.math; void main(){ auto col = RGB(1, 2, 3); auto img
= image2D(1, 2,
On Sunday, 1 December 2024 at 00:08:02 UTC, Richard (Rikki)
Andrew Cattermole wrote:
The trick...
I've managed to 'fix' it. Sadly it's not a rational fix, just
voodoo magic :D
When I mixin() my aliases for my Vector types, I have to
'mention' all types first, because if I use the simple al
On Sunday, 1 December 2024 at 00:08:02 UTC, Richard (Rikki)
Andrew Cattermole wrote:
The trick for such a function, is you have the public wrappers
that sanitize the input into something that you want to work
with, then internally have a function that accepts only that
input.
I'm putting thin
On Saturday, 30 November 2024 at 18:11:56 UTC, realhet wrote:
narrowing it down would take
I was lucky, I narrowed down to only 2 files.
The recursion error occurs when I call this 'abomination' of a
template function:
https://github.com/realhet/hetlib/blob/fe028689791d011cd98bc63042ee76e28f
I have a big example code (compared to me) for this particular
case, I can't include example as narrowing it down would take
several hours.
I just ask you to give me general tips to avoid it.
How can I detect them earlier for example?
Is it a way analyze the --vtemplates compiler output and de
On Tuesday, 8 October 2024 at 10:43:31 UTC, Dennis wrote:
On Tuesday, 8 October 2024 at 07:14:28 UTC, realhet wrote:
Is there a way to do it nicer with Phobos?
You can use `find` with a negated predicate: `find!(x =>
!x.front.all!isWhite)`
Perfect, Thank You!
I guess skipOver is more compl
Hello,
I wanted to use skipOver on my input range, but I ran into an
error that it needs a .save method in the range.
I can't give that because it's a generator function that catches
yield()s, I can't save the state of that.
What I wanted to simplify is this:
```
void skipWhite()
{
while(
Thank You!
I just did a test, I did not used the --allinst flag for the
first time since 4-5 years.
It was a superstition since that, because back then it fixed
something.
Now to my surprise the test build was successful :D
80KLOC, 20 modules -> 20 obj files, and the full compiling time
went
Hi,
I have some statements in my mind about --allinst, but I'm not
sure they are correct or not.
1. Normally the compiler analyzes the full code with all the
modules, and it only compiles code for template things that are
used in the given code.
2. It is not needed for compiling the code w
Update: I downloaded the latest LDC. (I waited with this version
catch up long ago.)
The above __asm inlining works fine on version LDC2 1.38.
Hi,
I'm switching from LDC2 1.28 to 1.35, and trying to solve some
problems on the way.
Target: 64bit Windows.
The problematic code:
```
const tmp = __asm!size_t(
"pcmpestri $5,$3,$1"
// 01 2 3 45
, "={RCX},x,{RAX},*p,{RDX},i,~{flags}",
charSetVec
On Sunday, 23 June 2024 at 16:42:43 UTC, Richard (Rikki) Andrew
Cattermole wrote:
See above why the string imports was designed that way.
I totally forgot the name "string imports". Now I remember,
thanks. That's one data direction of the 2.
On Sunday, 23 June 2024 at 16:46:05 UTC, monkyyy wrote:
On Sunday, 23 June 2024 at 16:33:54 UTC, realhet wrote:
realistically you should just write a build script with two
stages
fun thought experiment time, if you found a programmable
"FUSE"(file system api) database of some sort, mixed `-J`
Hi,
Is there a way to call an external program from CTFE?
Use case:
Inside a module I want to put some GLSL code.
I also want to generate that GLSL code using CTFE.
And when it's done, it would be nice if I was able to save that
GLSL code into a temp file and call the glsl compiler on it.
The
On Tuesday, 18 June 2024 at 02:26:00 UTC, Steven Schveighoffer
wrote:
All the code you posted here looks fine to me. It compiles and
runs fine on run.dlang.io (even with the `version(none)`
changed to `version(all)`, or using `scoped!B`).
Thank You for checking.
Also to add to the weirdness,
Hello,
I'm having a weird case of access violation.
I tried to narrow the problem and put up a reproducible testCase
on compilerexploer, but it requires my framework too which
overrides std.stdio.writeln() in order to produce colorful text,
and logging, etc.
The error is an access violation
On Thursday, 15 February 2024 at 20:10:15 UTC, Paul Backus wrote:
On Thursday, 15 February 2024 at 18:12:42 UTC, realhet wrote:
There was an attempt to fix it, but it looks like the PR author
wasn't able to get it working correctly in all cases.
That means I will solve this by putting the UDAs
On Wednesday, 6 December 2023 at 11:53:09 UTC, realhet wrote:
Hello,
I've found another trick:
- prepend "version(none):" in front of the source.
- ignore the optional "Error: declaration expected, not `module`"
message
- Take seriously all the other errors, those are only syntax
errors, se
Hello,
I can turn off linking with -c
I can turn off compiling with-o-
How can I turn it off before the semantic passes?
I'm experimenting with a nasty trink: I prepend "__undefinied__
_;" into the tested code. And if I get an error:
Error: undefined identifier `__undefinied__`
I know
On Thursday, 27 July 2023 at 16:17:28 UTC, IchorDev wrote:
I'm not aware of any way to do that exact thing. Measuring what
column a line is on would be quite subjective.
When I compile(LDC2) a something with an error and using the
--vcolumns argument I get this:
onlineapp.d(14,5): Error: found
Hi,
I can access the special tokens: __MODULE__, __LINE__, but how
can I access the column.
Is there a way to "hack" it out from LDC2?
All the error messages contain column information, also I've
found __traits(getLocation, symbol) also reporting the column.
But how to get this information
Hi,
I'm using LDC2 64bit on Windows. If I ask it to generate a .map
file, I can locate the function. But how can I access the
Line-code information? Do I need to generate a huge .pdb file
with lots of other information (and also I have to understand it
and extract the lines), or is there a li
It seems like I managed to solve it.
All the chain of properties now capturing a generic value type T.
And finally the most inner associative array will handle the
implicit cast.
Maybe that extra implicit () got confused when the types are
same, but the aliases to those types are different. o.O
On Friday, 26 May 2023 at 21:11:45 UTC, Adam D Ruppe wrote:
On Friday, 26 May 2023 at 21:00:20 UTC, realhet wrote:
Only the extra () let it compile successfuly.
No way to fix it. If the function takes an extra argument you
can kinda trick it but for zero arg function pointer return
from a pr
On Friday, 26 May 2023 at 21:00:20 UTC, realhet wrote:
Update:
```
auto x = karcSamples[a.key].lod0; print(x._size);
auto y = karcSamples[a.key].lod0(); print(y._size);
with(karcSamples[a.key].lod0) print(_size);
with(karcSamples[a.key].lod0()) print(_size);
```
When I put it into a tem
Hello,
I tried to narrow the problem and make a small example, but I've
failed.
I try to describe the syndrome, maybe someone knows about it.
(I heard that @properties are not 100% functional, maybe it's
because of that, I dunno...)
With pragma msg, I verify the time of things:
karcSamples
On Friday, 26 May 2023 at 13:18:15 UTC, Steven Schveighoffer
wrote:
This worked for me:
```d
char[4] fourC(string s)
{
if(s.length >= 4)
return s[0 .. 4];
char[4] res = 0;
res[0 .. s.length] = s;
return res;
}
```
Sometimes I forget that the return does an implicit cast
Hello,
Is there a way to do it nicer/better/faster/simpler?
```
char[4] fourC(string s)
{
uint res;//Zero initialized, not 0xff initialized.
autocnt = min(s.length, 4),
p = cast(char[4]*)(&res);
(*p)[0..cnt] = s[0..cnt];
return *p;
}
```
I tri
On Monday, 8 May 2023 at 11:43:33 UTC, Richard (Rikki) Andrew
Cattermole wrote:
Don't forget to type bad2 which gives the same result as the
good one. Otherwise it only has 7 elements in it.
Thank You, now that's good too.
So here are the weird stuff:
Pure arrays produce errors:
enum ubyte16
On Monday, 8 May 2023 at 08:05:13 UTC, Richard (Rikki) Andrew
Cattermole wrote:
Yes, there is a pragma msg bug, but there is also a functionality
'bug'.
I collected some more info:
```
import std, core.simd, ldc.llvmasm;
T pshufb(T, U)(T a, in U b) { return __asm!ubyte16("pshufb $2,
$1", "
Hello,
```
import std, core.simd;
void main()
{
enum ubyte16
good1 = mixin([1, 2, 3, 4]),
bad = [1, 2, 3, 4];
static immutable ubyte16
good2 = mixin([1, 2, 3, 4]),
crash = [1, 2, 3, 4];
pragma(msg, good1);
pragma(msg, bad);
pragma(msg, good2)
On Friday, 3 March 2023 at 14:33:08 UTC, Imperatorn wrote:
We don't know what you mean by your definition of safe
unfortunately
For example killing ldc2.exe while it writes some cached temp
files.
And when the next time it tries to load those corrupted files, it
will crash, or generate wrong
Hello,
Is it safe to kill an ongoing LDC2 process on Windows?
My situation is this:
- I launch 8 LDC2 compilation command lines on 8 DLang source
files.
- One of them has a compilation error and quits.
- At this point I wait the completion of the other threads, but
it would be faster to kill
Awesome, Thank both of you!
```
enum a = ["A", "B"];
writeln(a);
writeln(aliasSeqOf!a);
writeln([aliasSeqOf!a]);
```
Hello,
Is there a better way to transform a string array to a tuple or
to an AliasSeq?
```
mixin(customSyntaxPrefixes.format!`tuple(%(%s,%))`)
```
I'd like to use this as variable length arguments passed to the
startsWith() std function (as multiple needles).
Hi again and thanks for the suggestions.
I ended up checking every {} block with the following program:
It works on a string where all the nested blocks are reduced to a
single symbol. For example: '{', '"', '['
And all the comments and whitespaces are reduced to ' ' space.
```
enum CurlyBlock
Hi,
I'm writing a DLang parser and got confused of this.
What is a good way to distinguish lambda functions and structure
initialization blocks.
Both of them are {} blocks.
I'm thinking of something like this:
1. checking inside (on the first hierarchy level inside {})
, => must be a st
On Saturday, 1 October 2022 at 13:49:12 UTC, H. S. Teoh wrote:
On Sat, Oct 01, 2022 at 01:20:08PM +, realhet via
Digitalmars-d-learn wrote:
It is very good to know. Thank You for the confirmation. Indeed
it is really clever.
I wrote a parser only to parse the structural elements of
Hello,
I just wanted to optimize a byte -> index lookup, by using a 256
element table instead of using [1, 2, 3].countUntil(x) and I was
amazed what I've found.
My solution lookup[x] was not faster at all, because LDC2
amazingly optimized the linear search to a jump table.
Anyone please can
On Monday, 22 August 2022 at 19:35:11 UTC, Steven Schveighoffer
wrote:
It is possible to write the same function for both const and
mutable overloads by using the `this` template parameter:
I guess before the "inout", "this This" was the only way to do
this. I must remember this, it's really u
Hello,
I managed to make a universal getParent() function which can
preserve constness.
I also had success with inout functions that work with this inout
getParent method.
Is it possible to do something like this but for the allParents
input range producer method?
In the const range implementa
On Friday, 12 August 2022 at 02:13:48 UTC, bachmeier wrote:
Informative error message
I'm making something like an IDE.
The text search function in it is able to search across all user
modules.
I thought about filtering the search results by context.
The following contexts are planned already
On Thursday, 11 August 2022 at 19:33:31 UTC, bachmeier wrote:
std.string does a public import of std.algorithm.cmp.
That was it! Thanks!
Conclusion: This is how to overload cmp()
```d
//this is the only place from where all other modules can see
these std modules
public import std.string, s
On Thursday, 11 August 2022 at 18:10:31 UTC, Paul Backus wrote:
... If you remove `std.algorithm` from `testcmpmodule2`'s
`public import` line, the code compiles successfully.
Yes, but in the 40 module project I'm unable to make it work.
I doublechecked that the only public import of std.algori
Hello,
I try to make an overload group of cmp() functions in my utility
module but everything works well except when I import some 3rd
party module that imports std.algorithm. Then I get an error:
C:\D\testCmpOverload.d(11,8): Error:
function `std.algorithm.comparison.cmp!(string, string).cmp`
Hello,
I noticed that the LDC2 compiler has an architecture target
called "AMD GCN".
Is there an example code which is in D and generates a working
binary of a hello world kernel.
I tried it, and just failed at the very beginning: How can I
specify __kernel and __global in D?
On Thursday, 14 July 2022 at 14:41:53 UTC, Paul Backus wrote:
Explicit type annotation: vvv
Thank You!
I will remember that in case of weird errors I can try to help
the compiler with type inference.
Hello,
Somehow it can't reach map and array inside a class field
initializer. If I put that small expression inside a function, it
works. If I encapsulate the initializer expression into a lambda
and evaluate it right away, it also works. Only the nice form
fails.
Why is that?
```d
import
On Tuesday, 31 May 2022 at 09:35:30 UTC, Andrea Fontana wrote:
On Tuesday, 31 May 2022 at 08:51:45 UTC, realhet wrote:
Check if that string is init.
assert("", "cool");
assert("ehh", "cool");
assert(string.init, "Not cool");
I feel some "JavaScript equality operator" vibes in this :D
Anyways,
Hi,
In my framework I just found a dozen of compile time error
handling like:
...else static assert("Invalid type");
This compiles without error. And it was useless for detecting
errors because I forgot the first "false" or "0" parameter.
I think it is because of the weird case of "every s
On Thursday, 12 May 2022 at 20:12:19 UTC, Ali Çehreli wrote:
And I've been thinking 'iota' may not be as suitable as I
thought at first. I like the following even more:
auto r0 = st
.by(Duration(2))
.take(5);
So I wrote this by() for my DateTime and then:
import
On Thursday, 12 May 2022 at 17:06:39 UTC, Ali Çehreli wrote:
I don't care whether it is good practice or not. :) The
following is what you meant anyway and seems to work.
I restricted the parameter types to the ones I wanted to use.
And for the standard iota behavior I used a public import.
On Thursday, 12 May 2022 at 16:57:35 UTC, H. S. Teoh wrote:
Does your DateTime type support the `++` operator?
It can't because I only want to use the quantities.si.Time type
to do arithmetic with my DateTime. In my previous DateTime, it
was a lot of problem that I was doing math on it's raw
Hello,
I have my own DateTime struct.
It has opCmp() and opBinary(), I can do arithmetic with this
custom DateTime and the amazing time units of the **quantities**
package.
Now I'm about mo make iterations in a DateTime range:
const
st = DateTime(UTC, "22.1.1 8:30").utcDayStart,
On Tuesday, 5 April 2022 at 09:57:29 UTC, Mike Parker wrote:
On Tuesday, 5 April 2022 at 09:26:54 UTC, realhet wrote:
You should compile the existing package as a library, then add
the library file to the linker settings in VisualD.
Thank You for the fast help!
Currently I have my own build s
Hello,
I have all my D packages in the c:\D\libs\ directory.
I added this path to the PropertyPages/Compiler/Additional Import
Paths field.
In the project source file I imported a module from my package
using "import het.utils;"
Also used a function from it.
The syntax highlighter worked go
On Sunday, 29 August 2021 at 09:02:52 UTC, Mike Parker wrote:
On Sunday, 29 August 2021 at 08:55:44 UTC, realhet wrote:
Is it safe, or do I have to take a snapsot of the keys range
like this? ->
You shouldn't remove anything when iterating over `.keys` or
`.values`. Use `.byKey` and `.byV
Hi,
//remap the result blobs
foreach(k; res.blobs.keys){
int p = map(k);
if(p!=k){
res.blobs[p].weight += res.blobs[k].weight;
res.blobs.remove(k);
}
}
It boils down to:
foreach(k; aa.keys) aa.remove(k);
Is it safe, or do I have to take a snapsot of the keys ra
On Wednesday, 7 July 2021 at 17:10:01 UTC, Paul Backus wrote:
On Wednesday, 7 July 2021 at 16:20:29 UTC, realhet wrote:
int[] opIndex() { return array; }
Thx, I didn't know about this type of opSlice override. It works
nicely.
Now I have these choices:
- write [] everywhere to access
Hi,
I wanted to make a container class that exposes its elements
using a simple "alias this", but getting weird errors:
I test with the std.algorithm.filter template function.
1. when I use "alias this" on a function that returns a slice,
making the internal array unreachable, filter just ca
On Sunday, 30 May 2021 at 12:16:19 UTC, realhet wrote:
presets.keys.sort.take(1).get(0); <-
Oups: after fixing an error and making it compile the solution is
even uglier:
presets.keys.sort.take(1).array.get(0);
Hello,
This is my current solution but there must be a better way to do
it in D
T get(T)(T[] arr, size_t idx, T def = T.init){
return idx
1 - 100 of 199 matches
Mail list logo