Thank you Steven and Christian.
I had a look at both those methods, creating a local dmd.conf
file almost worked but it wasn't a simple modification, I was
hoping it would be as simple as just adding the extra path but it
seems that I needed to add the whole path from the existing
dmd.conf
On Wednesday, 14 September 2022 at 19:34:01 UTC, Alain De Vos
wrote:
Although the framework is good. There is no community. Or
general acceptance. Which is a pitty.
Currently I ask myself how to do "sessions" with vibe.d.
Hi Alain,
I'm new to D and looking at vibe as well but I'm not as far
Hi,
New to D (and enjoying the learning..) I've probably missed
something obvious but I'm slightly confused with the best way to
achieve a simple build.
I like to keep my reusable modules in a directory outside of the
project directory so I can use them on another project for
example.
I
On Monday, 14 June 2021 at 17:34:00 UTC, Steven Schveighoffer
wrote:
D doesn't have head-const. So you must hide the mutable
implementation to get this to work.
You'd want to do this anyway, since you don't want to directly
use the pointer for anything like indexing (it should first
validate
I'm searching for a way to do something like this in D:
```cpp
struct MyStruct {
const size_t length;
int *const data;
MyStruct(size_t n) : length(n) {
data = new int[length];
}
}
```
This way it is mutable, but non resizeable:
```cpp
MyStruct s = MyStruct(10);
s.data[0] = 42;
On Wednesday, 17 March 2021 at 15:16:36 UTC, Jacob Carlborg wrote:
On Wednesday, 17 March 2021 at 13:52:48 UTC, Guillaume Piolat
wrote:
On Sunday, 14 March 2021 at 11:33:00 UTC, David wrote:
Anyone else done this? Pointers welcome.
Sorry for delay.
Just add "dflags-osx-ldc":
On Tuesday, 16 March 2021 at 07:43:18 UTC, drug wrote:
That means that you GZippedRange should provide opSlice
operator and should be a narrow string (string of char or wchar)
Yes, I should have looked more carefully at the doc, I was
assuming splitter would accept a simple input range, but
I came across this problem as I was trying to see if could write
a quick range-based solution with std.zlib to do what was asked
about in a different Learn forum post - read a gzipped file.
This seems like it should work:
import std.stdio, std.algorithm, std.zlib;
import std.range.primitives;
On Sunday, 14 March 2021 at 11:40:25 UTC, David wrote:
This is more a macos thing than a D thing but still relevant.
In another thread I was asking about cleaning up a D dylib for
using in Excel. Ldc was suggested though first I have to figure
out how to make the phobos and druntime loadable
This is more a macos thing than a D thing but still relevant. In
another thread I was asking about cleaning up a D dylib for using
in Excel. Ldc was suggested though first I have to figure out how
to make the phobos and druntime loadable from within the sandbox.
(I've posted in a new topic as
On Sunday, 14 March 2021 at 01:38:23 UTC, David Skluzacek wrote:
On Thursday, 11 March 2021 at 22:10:04 UTC, David wrote:
I wasn't aware that object files could be manipulated like the
strip manual page - thx for the heads up.
With the caveats that the linked post is almost 14 years old, I
On Sunday, 14 March 2021 at 00:00:59 UTC, Adam D. Ruppe wrote:
On Saturday, 13 March 2021 at 23:41:28 UTC, David wrote:
So Excel complains that it can't load my library - presumably
because libphobos2 and libdruntime are not in the sandbox.ly
You *might* be able to compile with
--link
On Thursday, 11 March 2021 at 22:10:04 UTC, David wrote:
I wasn't aware that object files could be manipulated like the
strip manual page - thx for the heads up.
With the caveats that the linked post is almost 14 years old, I
can't try this command myself, and the ldc solution is probably
On Friday, 12 March 2021 at 00:12:37 UTC, Guillaume Piolat wrote:
Create a exports.lst file with:
_addDD_D
as the only line there.
Build with:
"lflags-osx-ldc": [ "-exported_symbols_list", "exports.lst",
"-dead_strip" ],
Thx that's really helpful.
I've hit a snag with LDC. After
On Friday, 12 March 2021 at 22:18:59 UTC, tsbockman wrote:
Why do you think you need a `void[]` slice? I think `void*`
pointers are sufficient. This handles all normal data types, as
long as they are allocated on the GC heap:
I wanted to have the registry own the structs' memory, though
On Friday, 12 March 2021 at 18:14:12 UTC, Imperatorn wrote:
On Friday, 12 March 2021 at 17:57:06 UTC, David Zhang wrote:
On Friday, 12 March 2021 at 17:46:22 UTC, Imperatorn wrote:
On Friday, 12 March 2021 at 17:37:43 UTC, David Zhang wrote:
[...]
Have you tried using Variant or jsvar
On Friday, 12 March 2021 at 18:50:26 UTC, tsbockman wrote:
The idea is to implement a service locator s.t. code like this is
possible:
// struct (I didn't mention this in the top post, my mistake)
auto log = Logger()
api_registry.register!Logger(log);
// class/interface
On Friday, 12 March 2021 at 17:46:22 UTC, Imperatorn wrote:
On Friday, 12 March 2021 at 17:37:43 UTC, David Zhang wrote:
I want to store interfaces as untyped void[], then cast them
back to the interface at a later time. However, it appears to
produce garbage values on get().
Is this even
I want to store interfaces as untyped void[], then cast them back
to the interface at a later time. However, it appears to produce
garbage values on get().
Is this even possible, and if so, what is happening here? The
alternative would be a struct { CheckedPtr self; api_fns }
e.g.
void
On Thursday, 11 March 2021 at 18:35:37 UTC, Imperatorn wrote:
On Thursday, 11 March 2021 at 17:00:06 UTC, David wrote:
On Thursday, 11 March 2021 at 14:49:32 UTC, Imperatorn wrote:
On Thursday, 11 March 2021 at 10:29:55 UTC, David wrote:
On Thursday, 11 March 2021 at 08:40:58 UTC, Imperatorn
On Thursday, 11 March 2021 at 14:49:32 UTC, Imperatorn wrote:
On Thursday, 11 March 2021 at 10:29:55 UTC, David wrote:
On Thursday, 11 March 2021 at 08:40:58 UTC, Imperatorn wrote:
On Thursday, 11 March 2021 at 08:34:48 UTC, David wrote:
I thought it would be fun to convert some old C++/C
On Thursday, 11 March 2021 at 14:35:45 UTC, rikki cattermole
wrote:
Pipe it to grep should work
| grep -v "__D2"
Thanks - though I'm trying to suppress the symbols being
generated in the library.
A colleague says it can be done in ldc but not dmd. I'll think
I'll try that out.
On Thursday, 11 March 2021 at 08:40:58 UTC, Imperatorn wrote:
On Thursday, 11 March 2021 at 08:34:48 UTC, David wrote:
I thought it would be fun to convert some old C++/C quant
utils to D. I'm starting with a simple library that I call
from vba in Excel on macos:
[...]
*trigger warning
00018660 T _thread_scanAll
00018480 T _thread_scanAllType
00019658 T _thread_suspendAll
Is there a way of not exposing the symbols that aren't mine? - I
only need a simple C interface.
Thx
David
On Wednesday, 24 February 2021 at 06:14:58 UTC, Imperatorn wrote:
On Tuesday, 23 February 2021 at 19:44:39 UTC, David wrote:
Not sure if `learn` is the right topic or not to post this..
I've been going through Bob Nystrom's "Crafting Interpreters"
for a bit of fun and over the w
Not sure if `learn` is the right topic or not to post this..
I've been going through Bob Nystrom's "Crafting Interpreters" for
a bit of fun and over the weekend put together a toy allocator in
D - free and gc not yet done. It's single threaded and
unsurprisingly faster than malloc for small
David
On Saturday, 29 February 2020 at 07:35:10 UTC, Boris Carvajal
wrote:
On Saturday, 29 February 2020 at 03:53:37 UTC, David Anderson
wrote:
I want to capture that text in a variable, but the upload
function returns void. How can I get the text returned by the
web server to be stored
I'm working with std.net.curl. Using curl on the command line I
can do this:
curl -T file.txt http://localhost:9998/tika
and it returns text as a result.
When I attempt to do the same thing in D code as follows:
import std.net.curl;
upload("file.txt",
On Wednesday, 9 October 2019 at 15:42:42 UTC, David Briant wrote:
On Wednesday, 9 October 2019 at 10:33:21 UTC, David Briant
wrote:
[...]
If I uninstall clang using conda I now get:
(base) Davids-MacBook:fred david$ dub
Performing "debug" build using /Library/D/dmd/bin/dmd f
On Wednesday, 9 October 2019 at 10:33:21 UTC, David Briant wrote:
I've accidentally upgraded to Catalina - a little earlier than
planned as I had hoped not to be trail blazing!
My problem is this, in a bash shell and a new directory when I
run
$ dub init
... answering the questions that dub
articles that explain the common
issues of floating point representation in detail.
-- David
-MacBook:fred david$ dub
Performing "debug" build using /Library/D/dmd/bin/dmd for x86_64.
fred ~master: building configuration "application"...
Linking...
ld: warning: ignoring file
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libpthread.tbd, file was built for unsupporte
libraries.
Best,
Ilya
thanks! I will try it out accordingly.
Bests, David
On Saturday, 5 October 2019 at 04:38:34 UTC, 9il wrote:
On Friday, 4 October 2019 at 20:32:59 UTC, David wrote:
Hi
I am wondering if MIR modules run in parallel by default or if
I can enforce it by a compiler flag?
Thanks
David
Hey David,
Do you mean unittests run in parallel or mir
Hi
I am wondering if MIR modules run in parallel by default or if I
can enforce it by a compiler flag?
Thanks
David
Ah, fair enough.
On Saturday, 1 June 2019 at 13:00:50 UTC, ag0aep6g wrote:
How is setting/replacing different from modifying?
e.g.:
S s;
this() { s = ...; }
update(S s) { this.s = s; }
mod(int i) { s.i = i; } // illegal
Kinda like how strings can be copied and assigned to, but not
On Saturday, 1 June 2019 at 16:30:12 UTC, Jonathan M Davis wrote:
If any member variable of a struct is const, then you can't
modify that member ever, and assignment isn't possible unless
you override opAssign so that it overwrites only the mutable
members. It's very rare that it makes sense
Say I have a struct `S`:
struct S {
/*const*/ char* pointer;
... other members ...
this(/*const*/ char* p, ... others ...) {
pointer = p;
...
}
}
What I want, is to be able to use `S` in other data structures
with the following
On Friday, 28 December 2018 at 08:11:37 UTC, 9il wrote:
On Friday, 28 December 2018 at 08:09:09 UTC, 9il wrote:
On Thursday, 27 December 2018 at 21:17:48 UTC, David wrote:
On Wednesday, 26 December 2018 at 18:59:25 UTC, 9il wrote:
[...]
great many thanks!! Is there any logic why getting
On Wednesday, 26 December 2018 at 18:59:25 UTC, 9il wrote:
On Saturday, 15 December 2018 at 19:04:37 UTC, David wrote:
Hi
I am wondering if it is possible to assign a vector to a row
of a matrix?
main.d ==
import mir.ndslice;
void main() {
auto matrix = slice!double
On Monday, 17 December 2018 at 08:56:07 UTC, Laurent Tréguier
wrote:
I think that's not possible right now, D-Scanner skips over
body functions and unittest blocks to not clutter the tags with
potentially lots of local names.
A pity; nevertheless many thanks for coming back on it!
I am wondering how I could display (nested) local variables and
functions in vim's tagbar (majutsushi/tagbar) using dscanner? So
far I only see gloable variables, functions, ...
=== script.d ==
import std.stdio;
enum globalEnum1 { A = 1, B = 2 }
enum globalEnum2 { C, D }
Hi
I am wondering if it is possible to assign a vector to a row of a
matrix?
main.d ==
import mir.ndslice;
void main() {
auto matrix = slice!double(3, 4);
matrix[] = 0;
matrix.diagonal[] = 1;
auto row = matrix[0];
row[3] = 4;
assert(matrix[0, 3] == 4);
On Wednesday, 13 June 2018 at 07:35:25 UTC, RazvanN wrote:
Hello,
I'm having a hard time understanding whether this inconsistency
is a bug or intended behavior:
immutable class Foo {}
immutable struct Bar {}
void main()
{
import std.stdio : writeln;
Foo a;
Bar b;
On Thursday, 7 June 2018 at 04:58:40 UTC, Jonathan M Davis wrote:
It would be trivial enough to create a wrapper template so that
you can do something like
immutable n = ctfe!(foo());
e.g.
template ctfe(alias value)
{
enum ctfe = value;
}
Would this be equivalent to using static
On Thursday, 22 March 2018 at 04:49:39 UTC, Seb wrote:
No need for regular expressions. D is powerful enough without
them:
```
alias lowercased = (m, n) =>
m.take(n).asLowerCase.chain(m.drop(n));
```
https://run.dlang.io/is/cSL0si
And with the filter, so it passes the assert:
```
it for?
— David
On Tuesday, 20 March 2018 at 09:44:41 UTC, Dennis wrote:
Are there ways to reduce this to below 0.1s, or should I just
leave idiomatic D and make a betterC program?
The best solution would be to profile the startup process and
file a bug accordingly. ;)
— David
he LLVM IR obtained with -output-ll might be easier to read than assembly.)
— David
– process the results
further?
— David
On Saturday, 10 February 2018 at 22:59:18 UTC, ag0aep6g wrote:
But there is a recent regression on Windows that might be
related. Do you also have a static constructor (`static this`)
that uses `wndclassName`? If so, you might be hitting issue
18412.
Building with Visual Studio seems to be fine. This isn't an
OptLink issue, is it?
On Saturday, 10 February 2018 at 22:36:41 UTC, ag0aep6g wrote:
On 02/10/2018 11:26 PM, David Zhang wrote:
I've got an immutable string declared in module scope, and I
attempted to get a pointer to its characters through both
[0] and str.ptr. However, it appears to me that the string
that it has a location in memory
and thus has a pointer.
So, my question is thus: Is this a bug in DMD, or is this just
something I missed?
Thanks
David
/...), But couldn't you in
theory just send a custom signal to the thread (which you
ignore), and then check for the exit flag after the syscall
returned EINTR?
The DInotify wrapper might of course have the retry loop
hardcoded; I didn't check.
—David
.)
There is indeed no way to do this; as you say, aliases are just
names for a particular reference to a symbol. Perhaps you don't
actually need the names in your use case, though?
— David
On Monday, 25 December 2017 at 20:39:52 UTC, Mengu wrote:
is partially applying templates possible?
Check out std.meta.Apply{Left, Right}.
— David
.
— David
On Friday, 22 December 2017 at 21:36:20 UTC, Ryan David Sheasby
wrote:
Hi. Struggling to figure this out. At the bottom of this page:
https://dlang.org/library/std/conv/octal.html is a vague
reference to using parse. However, when I use what I would
assume to be correct based on this:
https
Hi. Struggling to figure this out. At the bottom of this page:
https://dlang.org/library/std/conv/octal.html is a vague
reference to using parse. However, when I use what I would assume
to be correct based on this:
https://dlang.org/phobos/std_conv.html#.parse.3 and the fact that
in the octal
On Sunday, 17 December 2017 at 08:40:53 UTC, rikki cattermole
wrote:
On 17/12/2017 8:32 AM, Ryan David Sheasby wrote:
Hey guys. First time poster here. I've searched high and low
but can't seem to find a simple sleep/delay/wait/pause
function in the core or in phobos. The most recent
Hey guys. First time poster here. I've searched high and low but
can't seem to find a simple sleep/delay/wait/pause function in
the core or in phobos. The most recent information I can find
about it is this forum post from 12 years ago:
On Thursday, 14 December 2017 at 19:47:53 UTC, Jack Stouffer
wrote:
Clang has __int128. Is there anyway to use this with D with LDC?
There has been some work on this a while ago, by Kai, but it
hasn't been merged yet:
https://github.com/ldc-developers/ldc/pull/1355
— David
lain" iteration the compiler AST internally has special ref
variables, but they are not visible to the language.)
-David
On Thursday, 30 November 2017 at 00:40:51 UTC, David Colson wrote:
Hello all!
I'm getting settled into D and I came into a problem. A code
sample shows it best:
class SomeType
{
string text;
this(string input) {text = input;}
}
void main()
{
SomeType foo = new SomeType("
Hello all!
I'm getting settled into D and I came into a problem. A code
sample shows it best:
class SomeType
{
string text;
this(string input) {text = input;}
}
void main()
{
SomeType foo = new SomeType("Hello");
SomeType bar = foo;
foo = new SomeType("World");
On Tuesday, 21 November 2017 at 19:05:21 UTC, Jonathan M Davis
wrote:
Well, the assertion is going to throw an AssertError, which
takes a string for its message. It doesn't copy the contents of
the string. It's just taking a slice just like whenever you
pass a string to any other function. So,
On Tuesday, 21 November 2017 at 18:56:03 UTC, Adam D. Ruppe wrote:
On Tuesday, 21 November 2017 at 18:49:40 UTC, David Zhang
wrote:
assert(false, chars[0..str.length]);
}
What am I missing here?
You're escaping a reference to a local variable there. chars[]
is a pointer
Hi,
I've been trying to copy a string, then output it from an
`assert(false)` statement, but the copy seems to be corrupted
somehow.
void main()
{
string str = "some string";
//initializing `chars` with any value doesn't do anything
char[64] chars;
//char[64]
Huh, I think I did something weird. It compiles now, and I don't
know why. Thanks for your answers.
Hi,
Is there a way for a templated function to deduce or apply the
@safe/@nogc attributes automaticaly? I feel like I remember dmd
doing so at one point, but it doesn't appear to work anymore. In
particular, I need to call a function belonging to a templated
type, but do not know what
On Thursday, 10 August 2017 at 07:00:55 UTC, David J Kordsmeier
wrote:
On Wednesday, 9 August 2017 at 08:37:53 UTC, Johannes Pfau
wrote:
Iain recently updated GDC & phobos up to 2.074 and we have a
pull request for 2.075. So don't worry about fixing old GDC
phobos/druntime versions, re
On Thursday, 21 September 2017 at 13:52:25 UTC, Meta wrote:
On Thursday, 21 September 2017 at 12:30:15 UTC, David Bennett
wrote:
On Thursday, 21 September 2017 at 11:42:36 UTC, David Bennett
wrote:
enum isCTstring(alias arg) = (!isAssignable!(typeof(arg)) ||
__traits(compiles, mixin(` &quo
On Thursday, 21 September 2017 at 19:49:14 UTC, ag0aep6g wrote:
I don't have a one-liner, but here are some other solutions
that might be interesting. None of them is particularly pretty,
though.
1) Recursive template:
2) Using the std library:
3) Declaring a packed struct in a function
Given the function F, where: F(Args...)(Args args) { ... }
How can I statically determine the size of the argument list in
bytes?
Preferably, I would like a one-liner. However, std.algorithm
doesn't seem to support tuples, or `Args.each!(T =>
T.sizeof).sum` would work.
For the moment,
On Thursday, 21 September 2017 at 11:42:36 UTC, David Bennett
wrote:
[snip]
```
string[] escapeCTFE(Args...)(){
static foreach (arg; Args){
static if(__traits(compiles, ###WHATDOIPUTHERE###)){
[snip]
So far the best I've come up with is :
```
enum isCTstring(alias arg
t;c";
immutable string d = "d";
const string e = "e";
enum escape_as_much_as_possible = escapeCTFE!(a,b,c,d,e,"f");
}
```
I know for ints I can use __traits(compiles, int[arg]) but I'm
not sure about strings.
I believe only a and b should be hidden from pragma right?
Thanks,
David.
Nevermind! I rediscovered the `inout`attribute.
Though if I may say so, I have no idea how `inout` is supposed to
indicate "whatever the constness of a".
On Sunday, 17 September 2017 at 21:18:08 UTC, David Zhang wrote:
Hi,
I have a class `Image`, and I have a function called
`getSubImage(Rect bounds)`. What I can't figure out is how to
get the result of `getSubImage()` to take on the constness of
the backing image.
ie.
//The Image
Hi,
I have a class `Image`, and I have a function called
`getSubImage(Rect bounds)`. What I can't figure out is how to get
the result of `getSubImage()` to take on the constness of the
backing image.
ie.
//The Image class is really just a view over a buffer that's
managed elsewhere
On Friday, 15 September 2017 at 15:48:10 UTC, Stefan Koch wrote:
are you using ucent ?
Not that I know of, the code above is the full code (not sure
what's used internally for string literals).
I was using dmd 2.076 from the apt repo but the error also
happens in LDC 1.3[1].
Is there an
On Friday, 15 September 2017 at 07:12:36 UTC, Andrea Fontana
wrote:
Internal error is always a bug, so it should be reported!
I have opened a issue:
https://issues.dlang.org/show_bug.cgi?id=17828
Hi Guys,
I've been playing around with CTFE today to see how far I would
push it but I'm having an issue appending to an array on a struct
in CTFE from a template:
```
struct Content{
string[] parts;
}
void add_part_to_content(Content content, string s)(){
content.parts ~= "Part:
On Friday, 11 August 2017 at 04:50:48 UTC, rikki cattermole wrote:
On 11/08/2017 12:18 AM, David Zhang wrote:
I've been working on getting OpenGL to load on windows without
a library, and encountered something curious;
Context creation fails when I try to use the function pointer
retrieved
I've been working on getting OpenGL to load on windows without a
library, and encountered something curious;
Context creation fails when I try to use the function pointer
retrieved through GetProcAddress, but works just fine with the
statically linked version provided through
On Wednesday, 9 August 2017 at 08:37:53 UTC, Johannes Pfau wrote:
Iain recently updated GDC & phobos up to 2.074 and we have a
pull request for 2.075. So don't worry about fixing old GDC
phobos/druntime versions, recent gdc git branches should
already have AArch64 phobos changes.
We have a
On Sunday, 14 May 2017 at 15:05:08 UTC, Richard Delorme wrote:
I recently bought the infamous Raspberry pi 3, which has got a
cortex-a53 4 cores 1.2 Ghz CPU (Broadcom). After installing on
it a 64 bit OS (a non official fedora 25), I was wondering if
it was possible to install a D compiler on
in fact
generate Linux binaries.
— David
Windows
x64/MSVCRT executable from Linux today if you copy over the
necessary libraries. The question is just how we can make this as
easy as possible for users.
— David
: https://github.com/ldc-developers/ldc/pull/2142
For Windows, we use the MS C runtime, though, and the legal
situation around redistribution seems a bit unclear.
— David
On Thursday, 25 May 2017 at 17:56:12 UTC, jmh530 wrote:
On Thursday, 25 May 2017 at 16:36:45 UTC, jmh530 wrote:
[snip]
I haven't played around with it fully, but it seems like the
following resolves my issue in a sort of manual way:
template Process1(A, B)
{
static if (!isIndex!B)
path if necessary. (Whether this is useful or just
unnecessarily error-prone is another question, of course.)
— David
that this is a bug that
needs fixing. ;)
— David
to make the code work as-is, I suppose you could
create some aliases like `enum u32 = __u32.init;` and pass these
instead of the types – using runtime values just to convey their
type.
— David
On Sunday, 21 May 2017 at 10:03:58 UTC, Nicholas Wilson wrote:
As in the function signature of the function you call `ok` or
`error` in.
Result!(int, SomeEnum) myfunc(bool foo)
{
if(!foo)
return ok(42);
else
return error(SomeEnum.fooHappened);
}
should work.
This is
On Sunday, 21 May 2017 at 09:37:46 UTC, Nicholas Wilson wrote:
On Sunday, 21 May 2017 at 09:29:40 UTC, David Zhang wrote:
Well then it becomes
Result!(T, E) ok(T,E) (T t) { return Result(t); }
Result!(T, E) error(T,E)(E e) { return Result(e); }
and then provided it can be inferred (e.g
On Sunday, 21 May 2017 at 09:15:56 UTC, Nicholas Wilson wrote:
have free functions
Result!(T, ErrorEnum) ok(T)(T t) { return Result(t); }
Result!(T, ErrorEnum) error(T)(ErrorEnum e) { return
Result(e); }
then go
if (!foo)
return ok(42);
else
return error(Error.fooHappened);
Ah,
Hi,
I was reading a bit about this in Rust, and their enum type. I
was wondering if this is replicate-able in D. What I've got right
now is rather clunky, and involves using
`typeof(return).ok` and `typeof(return).error)`.
While that's not too bad, it does involve a lot more typing,
1 - 100 of 614 matches
Mail list logo