On Monday, 16 October 2023 at 18:57:45 UTC, bachmeier wrote:
On Monday, 16 October 2023 at 18:28:52 UTC, dan wrote:
(Now, i still think that when module initialization order is
not forced, it should be something a programmer or systems
integrator can choose, but i don't want to be too g
constructor pragma.
(Now, i still think that when module initialization order is not
forced, it should be something a programmer or systems integrator
can choose, but i don't want to be too greedy.)
Thanks again for your help!!
dan
On Monday, 16 October 2023 at 04:26:32 UTC, Paul Backus wrote:
On Monday, 16 October 2023 at 03:31:13 UTC, dan wrote:
I have some code that i would like executed before anything
else is.
The code is to set an environment variable which is used by a
library. I'm trying to find some w
On Monday, 16 October 2023 at 03:33:55 UTC, Richard (Rikki)
Andrew Cattermole wrote:
On 16/10/2023 4:31 PM, dan wrote:
I suppose if i could figure out a way to make all other
modules depend on my module this would happen, but the module
which uses the variable i want to set is in some
already
runtime starts?) Although i would prefer to code in d, it would
be ok to do it in c.
This is on MacOS (Catalina) in case that makes a difference, and
i'm using dmd v2.104.0.
Thanks in advance for any clues.
dan
On Wednesday, 23 August 2023 at 03:24:49 UTC, z wrote:
On Tuesday, 22 August 2023 at 22:38:23 UTC, dan wrote:
Hi,
I'm parsing some files, each containing (among other things)
10 bytes said to represent an IEEE 754 extended floating point
number, in SANE (Standard Apple Numerical Enviro
t the remaining 8 bytes to a fractional part, perhaps
ignoring the last 2 or 3 as not being significant.
But --- it seems like this kind of task may be something that d
already does, maybe with some constructor of a double or
something.
Thanks in advance for any suggestions.
dan
On Sunday, 22 January 2023 at 07:33:01 UTC, evilrat wrote:
On Sunday, 22 January 2023 at 04:42:09 UTC, dan wrote:
I would like to write a function which takes an array as
input, and returns a sorted array without duplicates.
```d
private S[] _sort_array( S )( S[] x ) {
import
).
Here's the usage:
```d
void main( ) {
uint[] nums = [1, 3, 2, 5, 1, 4, 2, 8];
auto sorted = _sort_array( nums );
import std.stdio;
writeln( "Input: ", nums );
writeln( "Output: ", sorted );
}
```
Thanks in advance for any info!
dan
On Friday, 26 March 2021 at 21:54:20 UTC, rikki cattermole wrote:
On 27/03/2021 10:51 AM, dan wrote:
Are there any d compilers that run natively on the Mac Mini
with an M1 chip?
If so, does anybody here have any experience with them that
can be shared?
If not, and your machine is a mac
Are there any d compilers that run natively on the Mac Mini with
an M1 chip?
If so, does anybody here have any experience with them that can
be shared?
If not, and your machine is a mac mini, how would you go about
programming in d on it?
TIA for any info!
ge for it, but man i could sure be wrong.)
Thanks in advance for any info!
dan
On Saturday, 5 September 2020 at 12:45:06 UTC, Quantium wrote:
I have a code that I need to compile for PowerNex OS, which
compiler should I use and how to compile code for PowerNex?
Short version: You can't (right now).
Long version:
PowerNex is currently in broken development state so even i
On Saturday, 2 May 2020 at 10:36:47 UTC, Ali Çehreli wrote:
On 5/1/20 7:40 PM, dan wrote:> On Saturday, 2 May 2020 at
02:29:43 UTC, H. S. Teoh wrote:
>> On Sat, May 02, 2020 at 02:22:42AM +, dan via
Digitalmars-d-learn
>> wrote:
>>> I'm looking for a function so
On Saturday, 2 May 2020 at 02:49:04 UTC, Steven Schveighoffer
wrote:
On 5/1/20 10:40 PM, dan wrote:
On Saturday, 2 May 2020 at 02:29:43 UTC, H. S. Teoh wrote:
On Sat, May 02, 2020 at 02:22:42AM +, dan via
Digitalmars-d-learn wrote:
[...]
[...]
import std.format : format;
string
On Saturday, 2 May 2020 at 02:29:43 UTC, H. S. Teoh wrote:
On Sat, May 02, 2020 at 02:22:42AM +, dan via
Digitalmars-d-learn wrote:
I'm looking for a function something like writeln or write,
but instead of writing to stdout, it writes to a string and
returns the s
te/writeln apparatus?
My only real requirement is that it be something really easy to
do.
Thanks in advance for any pointers.
dan
On Friday, 3 April 2020 at 16:10:55 UTC, Baby Beaker wrote:
I create Bots for Telegram using Python or PHP. But I love
Dlang and would like to create my Bots in Dlang. Is there any
support for Dlang to create Telegram Bots?
Hi,
A quick search yielded this dub package:
https://code.dlang.org/
On Wednesday, 25 March 2020 at 17:35:07 UTC, kinke wrote:
Yes, just dummy-compile something with `-v` and check the line
starting with `predefs`.
Exactly what I need, thank you!
Hi,
I'm debugging issues with conditionally compiled code and I'd
like to know exactly which versions are predefined by my compiler
(Linux LDC Aarch64)
Is there a quick way to check which ones are predefined?
[0] https://dlang.org/spec/version.html#predefined-versions
On Thursday, 10 October 2019 at 22:44:05 UTC, H. S. Teoh wrote:
On Thu, Oct 10, 2019 at 09:13:05PM +, Jon Degenhardt via
Digitalmars-d-learn wrote:
On Thursday, 10 October 2019 at 17:12:25 UTC, dan wrote:
> Thanks also berni44 for the information about the dig
> attribute, Jon
>
On Wednesday, 9 October 2019 at 10:54:49 UTC, David Briant wrote:
On Tuesday, 8 October 2019 at 20:37:03 UTC, dan wrote:
I have a double precision number that i would like to print
all significant digits of, but no more than what are actually
present in the number. Or more exactly, i want to
But i would like to be able to do this without knowing the
expansion of pi, or writing too much code, especially if there's
some d function like writeAllDigits or something similar.
Thanks in advance for any pointers!
dan
Thank you for all of the great answers, everyone!
Hi all,
I am starting to write a command line tool. So far it is a small
(feature-wise) program but the file size is scaring me. It's
already 13 megabytes, but I would expect it to be much smaller.
Is it because I'm using 3 libraries so far? The libraries are:
mir, vibe.d, and d2sqlite3. Woul
I started to look into D very recently. I would like to know the
following, if you guys are so nice to help me:
1. What is the performance of D's GC, what trade-offs where done
in design , and if a in-deep primer on efficient usage and
gotchas of the current implementation exists.
2. GC is
On Tuesday, 7 November 2017 at 21:32:26 UTC, Adam D. Ruppe wrote:
On Tuesday, 7 November 2017 at 21:25:00 UTC, dan wrote:
I looked in my distribution's object.d (debian stretch, gdc, in
Did you import std.stdio in the file?
If so, it is calling the std.stdio.write on the object (th
just what methods Object
implements, and what those methods do.
Thanks in advance for any clues, or a pointer to page 1 of the
manual if it's there and i'm just being dense.
dan
On Saturday, 3 December 2016 at 09:03:25 UTC, rikki cattermole
wrote:
On 03/12/2016 9:55 PM, dan wrote:
[...]
If you can use another compiler do so, gdc is on an old
frontend/Phobos now. I recommend ldc or you know the reference
compiler dmd if performance/platform isn't an issue (not
...' and then break if the assignment returns zero.
But i really, really would like to use the idiom of assigning a
value from inside a while condition.
Is it possible to do this? Perhaps with extra braces or
something, like while ( {something here} ) { } ?
TIA for any pointers or advice.
dan
On Monday, 5 September 2016 at 18:49:25 UTC, Basile B. wrote:
On Monday, 5 September 2016 at 18:22:08 UTC, ag0aep6g wrote:
On 09/04/2016 12:07 AM, dan wrote:
Are there any FOSS tools for doing dependency analysis of
[...]
[...]
I'm not aware of a standalone tool that does something like
;auto my_string = import("my_file");').
My guess is there must be, because one of the big deals about d
is the more regular syntax it offers to make compiler building
more reliable.
(I'm using gdc, and building with gnumake.)
TIA for any info!
dan
On Monday, 22 August 2016 at 01:45:02 UTC, Jonathan M Davis wrote:
On Monday, August 22, 2016 00:14:31 Adam D. Ruppe via
Digitalmars-d-learn wrote:
int strncmp(string a, string b, int n) {
if(a.length > n)
a = a[0 .. n];
if(b.length > n)
b = b[0 .. n];
import std.algorithm.comp
In c, there's this very nice function strncmp(s1,s2,count) which
compares two c strings, using at most count characters. count
can be less than, more than, or equal to either or both of the
lengths of the two strings. It can be used to see if two
c-strings have the same prefix of some length.
On Thursday, 14 July 2016 at 08:28:56 UTC, Jacob Carlborg wrote:
On 2016-07-14 07:18, dan wrote:
I'm writing a small program (compiled with gdc on xubuntu
16.04).
I would like it to remember a little data (a few kilobytes
maybe).
.
My main concern is minimizing program compl
else entirely? (In each case, i would
store the data in some file, and on second and subsequent runs of
the program attempt to recover the data from that file if
possible.)
My main concern is minimizing program complexity.
TIA for any advice.
dan
On Sunday, 29 May 2016 at 02:44:33 UTC, jhps wrote:
On Sunday, 29 May 2016 at 00:48:20 UTC, dan wrote:
Especially in a declaration like
static typeof(this) make_instance( )
but also in the 'new typeof(this)'. In both cases, 'this'
doesn't even exist.
On Sunday, 29 May 2016 at 00:28:13 UTC, Mithun Hunsur wrote:
On Sunday, 29 May 2016 at 00:14:17 UTC, dan wrote:
Is there a standard alias for a class name inside class code?
Something like 'this' referring to a class instance, but
referring instead to the class itself?
[...]
t
piled language wouldn't want to provide this
feature. (But the php interpreter, whatever else is good or bad
about it, does let you write 'new self(...)' and does the right
thing with it.)
TIA for any clues.
dan
On Monday, 23 May 2016 at 07:03:08 UTC, chmike wrote:
On Saturday, 21 May 2016 at 17:32:47 UTC, dan wrote:
(This effect could be simulated by making my_var into a
function, but i don't want to do that.)
May I ask why you don't want to do that ?
In D you can call a function wi
Thanks Vit, Meta, and Yuxuan for your speedy help!
So 3 pieces to put together, function, const, and @property (and
i guess final for protection against subclasses).
"no" (the only
relevant type qualifiers are private, package, protected, public,
and export, and none seem appropriate).
(This effect could be simulated by making my_var into a function,
but i don't want to do that.)
TIA for any info!
dan
downloadable compiler is based on
2.068 (LDC 0.17.0) and will move to whatever LDC supports after 1.0.0 is
released. I don't know of any problems at this stage, as long as you
just want to side load your app. Submitting to the App Store is another
matter. It has not been done yet and Apple's requirement to include
embedded bitcode is missing currently.
--
Dan
Rainer Schuetze writes:
> On 05.01.2016 01:39, Dan Olson wrote:
>> I haven't played with any of the new GC configuration options introduced
>> in 2.067, but now need to. An application on watchOS currently has
>> about 30 MB of RAM. Is there any more documentation
Also pointers (pun maybe) on finding who has the references keeping memory from
being collected.
--
Dan
Thanks everyone for taking the time to respond!
@Lobo,
Start using D now. It's not all or nothing so you don't have to
give up on C++. I have several projects that contain both C++
and D intermixed.
Using both does seem like a good way to transition. I could
combine the strengths of D with
the transition. Can anyone here
who has already made that transition tell me how smoothly it
went? Any major unexpected problems? Advice?
thanks!
Dan
thank you so much John :)
thank you John it worked :)
do I always need do the same for all windows API?
GetWindowTextW(hWindow, buffer, sizeof(title)); <-- Problem here
please Ignore the sizeof(title) parameter, I copied that from c++
equivalent code :D
I'm new to Dlang and I have no Idea whats wrong with this code!
wchar[260] buffer;
HWND hWindow = GetForegroundWindow();
GetWindowTextW(hWindow, buffer, sizeof(title)); <-- Problem here
hi
I'm using those imports:
import core.runtime;
import core.sys.windows.windows;
when I call GetWindowTextW DMD compiler complains!
(error:undefined identifier)
any solution?
ossible to do this, because i can't find
it on the internet or in Alexandrescu's book.
But it is also possible that everybody considers it so obvious
that they just don't elaborate on it. I'd be delighted if there
were the case, at least if somebody would elaborate on it if so.
TIA for any info!
dan
Awesome!!
Thanks Gary and namespace (and obviously i gotta improve my
google-fu).
dan
On Sunday, 17 May 2015 at 19:40:10 UTC, Gary Willoughby wrote:
On Sunday, 17 May 2015 at 18:58:32 UTC, Namespace wrote:
http://dlang.org/operatoroverloading.html#function-call
Like this:
module main
ketmar writes:
> On Sun, 03 May 2015 18:07:20 -0700, Dan Olson wrote:
>
>> It seems a private class or struct defaults to public members. Just
>> curious if this is intended. I would have expected private all the way
>> down unless overriden.
>
> i bet it is
() {}
public void pub() {}
}
--- xyzzy.d
module xyzzy;
import plugh;
void main()
{
auto f = makeFoo();
f.maybepriv(); // is accessible after all
//f.priv(); // err expected, member private
f.pub();
}
--
Dan Olson
"tired_eyes" writes:
>
> First issue: what is the proper ("idiomatic") way to conver JSONValue
> to the proper types?
>
> Second: what is the proper way of handling boolean values in JSON (how
> to convert JSON_TYPE.TRUE and JSON_TYPE.FALSE to bool)?
>
> Righ now I'm doing is something like this:
Jacob Carlborg writes:
> On 2015-04-24 20:37, Steven Schveighoffer wrote:
>
>> So am I going crazy? Or is dmd doing things differently depending on
>> where its environment is? Any compiler gurus out there understand why
>> the symbol is different?
>>
>> I don't want to file a bug with this, beca
erge-2.067 and check it out.
There are still a few tests to reolve, but it works pretty well for me.
--
Dan
I managed to isolate the problem to the following. Program 1
below works (displays unit test failure when run), while program
2 does not.
* Program 1 *
import std.stdio;
unittest
{
assert(false);
}
void main()
{
writeln("Hello D-World!");
}
* Program 2 *
module winm
am I missing?
Thanks for helping!
Dan
"Marc "Schütz\"" writes:
> On Saturday, 13 December 2014 at 21:20:43 UTC, Andrey Derzhavin wrote:
>>>
>>> import std.stdio;
>>>
>>> class ObjectAType {
>>>bool ok;
>>>this() {ok = true;}
>>> }
>>>
>>> void main()
>>> {
>>>auto a = new ObjectAType;
>>>assert(a.ok);
>>>destroy(a
"Andrey Derzhavin" writes:
> Hello!
>
> We have object, for example, objA.
>
> ObjectAType objA = new ObjectAType(...);
>
> // we have a many references to objA
>
> void someFunction1(...)
> {
>// destroying the objA
>destroy(one_of_the_refToObjA);
>
>//
> }
>
>
> void someFun
Here is a way that will work.
"Vlasov Roman" writes:
> I have this code
>
> mixin template Template(void function() func1, void function() func2)
mixin template Template(alias func1, alias func2)
> class SomeClass {
> mixin Template!(&func, &func23);
mixin Template!(func, func23)
It seems to me that worker threads will continue as long as
the queue isn't empty. So if a task adds another task to the
pool, some worker will process the newly enqueued task.
No. After taskPool.finish() no way to add new tasks to the
queue. taskPool.put will not add new tasks.
Then perhaps
// Next line will block execution until all tasks already in
queue finished.
// Almost all what I need, but new tasks will not be started.
taskPool.finish(true);
}
Are you sure TaskPool.finish isn't what you're looking for?
"Signals worker threads to terminate when the queue becomes
emp
On Friday, 31 January 2014 at 06:24:27 UTC, Dan Killebrew wrote:
mixin template Foo(alias a){ alias Foo=a; }
pragma(msg, Foo!2); // error
template Bar(alias a){ alias Bar=a; }
pragma(msg, Bar!2); // ok
As far as I can tell, 'mixin template' does nothing new;
(besides fail to
mixin template Foo(alias a){ alias Foo=a; }
pragma(msg, Foo!2); // error
template Bar(alias a){ alias Bar=a; }
pragma(msg, Bar!2); // ok
Perhaps I was unclear. What I meant:
What does 'mixin template' do that 'template' does not?
Where would I use 'mixin template'?
As far as I can tell, 'mixin
Found this:
http://forum.dlang.org/thread/ntuysfcivhbphnhnn...@forum.dlang.org#post-mailman.1409.1339356130.24740.digitalmars-d-learn:40puremagic.com
If what Jonathan says is true, then
http://dlang.org/template-mixin.html should be updated: s/mixin
template/template/
Check out the json module in vibe.d. Maybe copy it into your own
application (since it can't be used as a library, yet).
http://vibed.org/api/vibe.data.json/
https://github.com/rejectedsoftware/vibe.d
What is the difference between:
A
---
template Foo() {
int x = 5;
}
B
-
mixin template Foo() {
int x = 5;
}
The full example is from the first code sample on
http://dlang.org/template-mixin.html Both A and B compile and
when run, have the exact same output. So how is '
On Sunday, 22 December 2013 at 21:07:11 UTC, Charles McAnany
wrote:
Friends,
I'm writing a little molecular simulator. Without boring you
with the details, here's the gist of it:
struct Atom{
double x, vx;
double interaction(Atom a2){
return (a2.x-this.x)^^2; //more complicated
I just wanted to add that the "can't format immutable Exception"
also prevents me from doing this:
auto exception = receiveOnly!(immutable Exception)();
because receiveOnly creates a tuple which implements a toString
that uses indirectly uses formatObject. So I'm forced to use the
slightly mo
I'm sending an exception from a worker thread to the owner thread
to be logged/printed. Using DMD64 D Compiler v2.064
http://dpaste.dzfl.pl/7c8b68bd
Using std.concurrency prevents me from passing a naked Exception.
So the owner receives either a shared or immutable Exception.
I can't format a sh
"evilrat" writes:
> On Thursday, 9 May 2013 at 20:33:17 UTC, bearophile wrote:
>> Brad Anderson:
>>
>>> a 64-bit Windows dmd build did not crash and here is the output.
>>
>> Thank you for the data point. So maybe the problem is only on 32 bit
>> Windows.
>>
>> Bye,
>> bearophile
>
> win8 dmd 2.0
On Monday, 29 April 2013 at 16:48:27 UTC, Jacob Carlborg wrote:
On 2013-04-29 14:45, Daniel Davidson wrote:
Ho do you debug D executables on mac os x in which debug
symbols are
available (preferably a setup that works in emacs with gdb or
gud-gdb)?
This thread seems to bring up the issue I am
On Tuesday, 26 March 2013 at 19:35:51 UTC, Jacob Carlborg wrote:
I'll take a look. Which compiler and version are you using?
DMD64 D Compiler v2.062
ubuntu 64 bit
thanks!
.__aggr2839
inout variables can only be declared inside inout functions
I can't seem to find any answers in the documentation. Anybody
could help me out?
thanks
dan
)) )
Thanks
Dan
---
static void fromJson(ref AssetCategory assetType, Json src) {
string value = cast(string)src;
writeln("value is ",value);
final switch(value) {
case "Investment": { assetType = AssetCategory.Investment;
break; }
case "Prima
On Wednesday, 20 March 2013 at 17:44:16 UTC, Ali Çehreli wrote:
In that case, brute force to the rescue (nc stands for
non-const): :)
this(const(Series[string]) source) {
auto nc_source = cast(Series[string])source;
itemToSeries = nc_source.dup;
}
Wow - that worked. Thanks! I h
work for associative arrays?
--
import std.exception;
struct S {
this(this) { x = x.dup; }
char[] x;
}
immutable S[string] aa;
static this() {
// now what
}
Thakns
Dan
The following works and is the only way I have found to
initialize m.
Unfortunately it requires the cast.
Is this safe to do?
Is there a better way?
Is this a bug or are future features coming to clean it up?
Thanks
Dan
--
import std.stdio;
struct S {
this
passed in, due to const transitivity. So that
requirement would ripple a change to all already const correct
instances to now need to flip to non-const. I'm looking for a
const correct solution. It should be doable ... I just have had
no luck with it.
Thanks
Dan
ed by the asset name.
Thanks,
Dan
import std.stdio;
struct Series {
// REQUIRED - need to have no aliasing
this(this) { data = data.dup; }
private double[] data;
}
struct Assets {
this(this) { itemToSeries.dup; }
// REQUIRED - want ctor to dup arg to ensure no aliasing
this(const(S
.
Semantically deep equality is comfortable to me, but I would
imagine by now there is a fair amount of code that might rely on
a false result from opEquals if the members (slices, associative
arrays) are not bitwise the same.
Thanks
Dan
On Wednesday, 20 March 2013 at 02:54:23 UTC, Jonathan M Davis
wrote:
On Wednesday, March 20, 2013 03:48:38 Dan wrote:
On Wednesday, 20 March 2013 at 02:03:31 UTC, Jonathan M Davis
wrote:
> We already get this. That's what == does by default. It's
> just
> that it uses ==
&
On Wednesday, 20 March 2013 at 02:03:31 UTC, Jonathan M Davis
wrote:
We already get this. That's what == does by default. It's just
that it uses ==
on each member, so if == doesn't work for a particular member
variable and the
semantics you want for == on the type it's in, you need to
override
On Tuesday, 19 March 2013 at 23:13:19 UTC, Jonathan M Davis wrote:
On Tuesday, March 19, 2013 22:43:10 Dan wrote:
The above works with the built-in AAs.
Please offer an example.
It works because the outer type defines toHash. Without toHash,
the built-in
AAs won't work. If you'
matter how clever your external functions for comparing objects
or generating
hashes are, they're not going to work with the built-in AAs.
Any type which is
going to work with the built-in AAs must define opEquals and
toHash.
The above works with the built-in AAs.
Please offer an example.
Thanks
Dan
On Tuesday, 19 March 2013 at 20:28:09 UTC, Jonathan M Davis wrote:
Those are what opEquals, opCmp, and toHash are for. It might
make sense to
define mixins which implement them for you (dealing with
whatever recursive
semantics are necessary), but using external functions for
those just isn't
b.com/patefacio/d-help/blob/master/d-help/opmix/mix.d
Thanks
Dan
:
/opt/compilers/dmd2/include/std/datetime.d(13542): Error:
Internal Compiler Error: CTFE literal cast(short)1
dmd: ctfeexpr.c:353: Expression* copyLiteral(Expression*):
Assertion `0' failed.
Thanks
Dan
Maybe you want Knuth's Literate Programming.
http://en.wikipedia.org/wiki/Literate_programming
Long ago it was only for pascal and C (web and cweb), but now I see
there is noweb that works with any programming language.
--
Dan
ase
them out 1 or more years after successful implementation of copy
constructors
- Often the only purpose of the copy constructor is to do a deep
copy. This could easily be provided by the compiler or phobos.
Further, consider standardizing on the ".dup" and ".idup"
conventions for this purpose.
Thanks
Dan
{
if ( sMy point was, you can use compile time reflection to generate a
suitable opCmp that uses s.opCmp if it exists or does the long
version of two comparisons if not.
Thanks
Dan
n not know the cost of postblit - or
copy construction if that were a future solution for structs.
Granted the no rvalue passing is a pain - but is it a big deal in
library/generic code?
Thanks,
Dan
ed a transitive copy.
Thanks
Dan
specially with structs.
For structs we could use compile time reflection to provide
automatic efficient opCmp behavior. Section 3.1 here outlines a
way:
https://github.com/patefacio/d-help/blob/master/doc/canonical.pdf
Any comments appreciated.
Thanks
Dan
HOWEVER, when you get to th
?
- on linux is there a way, once in this state to provide any
information that would be helpful. strace during on a complete
run could help - but it is too late for that.
Thanks
Dan
On Saturday, 9 February 2013 at 00:54:58 UTC, Andrej Mitrovic
wrote:
Feel free to file an enhancement request.
http://d.puremagic.com/issues/show_bug.cgi?id=9491
Hopefully that is clear.
1 - 100 of 236 matches
Mail list logo