casts in
this code are as safe as I hope.
https://github.com/patefacio/d-help/blob/master/d-help/opmix/mix.d
Thanks
Dan
t;Maybe we actually need a copy constructor of some kind for this
sort of case.
I don't see how to get around it with a postblit. This is
definitely a big
problem."
With a generalized "dup" function for copying const(T) would you
agree this is not really an issue?
Thanks,
Dan
- Jonathan M Davis
ication
I use calibre and it was able to generate a mobi file from that.
Thanks
Dan
original is at this link and contents are copied below.
http://forum.dlang.org/post/rxobffxfqbqotyhmr...@forum.dlang.org
Thanks
Dan
Wouldn't a better form for foreach on associative arrays be one
of:
*case 1*
foreach(ref immutable(K) k; ref V v) {
}
*case 2*
foreach(ref immutable(K) k; ref
and probably pdf with calibre which is a great tool.
Thanks
Dan
distinguish std from any other
regular
variable.
traits uses something like this (see fullyQualifiedName)
Thanks
Dan
import std.stdio;
template isPackage(alias name) {
static if(name.stringof.length >= 9 && name.stringof[0..8] ==
"package ") {
enum isPackage
duplicated. Hope it helps.
Thanks
Dan
On Monday, 19 November 2012 at 12:24:56 UTC, Dan wrote:
I posted this on *learn* a few days back.
Is this a reasonable language request - to allow for ref of
immutable(K) on associative array iteration? If allowed it
would enable iteration without casting, because casting could
allow for
On Tuesday, 27 November 2012 at 16:08:54 UTC, Andrei Alexandrescu
wrote:
As far as I understand you reveal it's impossible to iterate a
const(V[K]), which is an implementation bug. Please file it
with bugzilla.
Sure I will do that as I think it is impossible without a deep
cast. But, I don'
On Tuesday, 27 November 2012 at 16:08:54 UTC, Andrei Alexandrescu
wrote:
On 11/27/12 10:32 AM, Dan wrote:
At the risk of being too persistent ... are there any opinions
on this?
It seems a small tweak to the meaning of foreach with
associative arrays
would fix some issues requiring unnecessary
On Friday, 30 November 2012 at 17:12:10 UTC, Rob T wrote:
On Friday, 30 November 2012 at 08:05:25 UTC, Jacob Carlborg
wrote:
That's the exact same thing as I'm proposing, except it's the
compiler handling it.
Which would be better because it is integrated and not an
external tool.
Why wou
appreciated.
Thanks,
Dan
Since gdup is recursive and does not
require the composed structs to have a postblit - it works even
on arrays of T where T has aliasing but no postblit.
Thanks,
Dan
import std.stdio;
import std.traits;
import opmix.mix;
struct Array(Type_)
{
public:
mixin(PostBlit);
this(Typ
On Monday, 10 December 2012 at 11:39:24 UTC, Thiez wrote:
On Saturday, 8 December 2012 at 21:47:32 UTC, Dan wrote:
My approach is to have a general dup function. I call it gdup,
for global dup so the name does not conflict with the existing
dup. It dup's fields recursively. Feel free to h
On Sunday, 9 December 2012 at 16:26:12 UTC, Jacob Carlborg wrote:
On 2012-12-09 15:45, Dan wrote:
Phobos can and should have a general dup function, capable of
duping
(i.e. recursive deep copy) structs without requiring any
effort from
struct developers.
[snip]
I think much of this
On Monday, 10 December 2012 at 13:37:46 UTC, Thiez wrote:
On Monday, 10 December 2012 at 12:45:16 UTC, Dan wrote:
That would be an infinite loop. If you have a compile time
cycle you would likely need your own custom dups anyway, as
you are doing low level and heap allocating already. But for
On Monday, 10 December 2012 at 15:36:44 UTC, Joseph Rushton
Wakeling wrote:
On 12/09/2012 03:45 PM, Dan wrote:
Phobos can and should have a general dup function, capable of
duping (i.e.
recursive deep copy) structs without requiring any effort from
struct
developers. This can be done to cover
nizes addresses by email. Without a postblit
or some deep copy, duplicating means sharing. When I see this, I
think - I better add a postblit in case address books get copied.
How would you approach it to not need deep copy? For something as
simple as this would you introduce COW?
Thanks
to a ubyte pointer (or similar) and
then set the const/immutable fields that way.
I think it can be done safely, but not something the compiler
can guarantee.
Only talking about structs here. classes were listed under issues
not covered.
Thanks
Dan
On Monday, 10 December 2012 at 19:40:52 UTC, Jacob Carlborg wrote:
On 2012-12-10 20:37, Jacob Carlborg wrote:
You might have the same problem with structs. That is, if it's
possible
to have const/immutable files which are not initialized in the
declaration.
That should have been "fields".
On Monday, 10 December 2012 at 20:10:25 UTC, Andrei Alexandrescu
wrote:
You want to create a new window with the same parent. At the
top level there's one desktop window, and probably having two
would be odd.
Ok - so I'm only talking about structs.
What you say is what you want here and i
d there is almost never a
need (which I would love to hear more commentary on). Yet TDPL
shows the a prime example for the need in 7.1.3 (Widget). Plus we
get questions all the time on how to cross from the
const/immutable world to the mutable - which gdup provides.
Thanks
Dan
On Tuesday, 11 December 2012 at 01:47:38 UTC, Walter Bright wrote:
On 12/10/2012 10:40 AM, Dan wrote:
For something as simple as this would you introduce COW?
Yes.
Any D examples showing the pattern in action with structs? I did
not see anything in the index of TDPL on COW except one
n is not necessary - if I
remove it it still seems to work since default opAssign calls
postblit. I added the ctor, removed opAssign and put it here:
http://dpaste.dzfl.pl/6ecfe675
Other than that - is there still a subtle bug?
Thanks,
Dan
y one of
your 3 maps. If they are always modified together, it'd make no
sense to use "triple COW".
I see.
//
When everything is said and done, most of that code can be
templated, or mixed-in.
If so, sounds like useful additions to phobos.
Thanks
Dan
to hear
about.
I'm not complaining - here, though. Keep up the good work.
Thanks,
Dan
On Friday, 14 December 2012 at 12:15:28 UTC, Andrej Mitrovic
wrote:
On 12/14/12, Manu wrote:
I've often had to pester Walter to produce a new build for us
when a
critical bug/feature was fixed.
Why waste Walter's time when building is as simple as calling
make?
His point was he clearly w
On Friday, 14 December 2012 at 12:56:42 UTC, Jacob Carlborg wrote:
On 2012-12-14 13:15, Andrej Mitrovic wrote:
Why waste Walter's time when building is as simple as calling
make?
Agree. And with DVM it's just one command, after all
repositories are updated, instead of calling "make" three ti
From the article: "If you chain more than two levels of
subclasses, BETA scales better because you don’t need to keep
coming up with new names."
Thanks
Dan
Since there is CTFE, I keep running into, do I really need this
as a template parameter? Why not put this in a constructor. And
so on...
Repost please delete
second of telecommunication data used in mobile networks.
Did it prove a worthwhile move?
Did the move relieve any issues with C++?
Was GC an issue in the end?
Thanks,
Dan
doing this?
So, the question is:
What is the best *current* way to code X to achieve struct Y {
const(X) x; } and what is the long run solution to this(this)?
Thanks,
Dan
On Wednesday, 6 February 2013 at 20:30:40 UTC, Maxim Fomin wrote:
The fact that bar() does not work and (&bar)() works is
terrific.
Sorry - but I don't understand what is terrific? Is this sarcasm?
struct X {
this(this) { c = c.dup; }
char c[];
}
(1) What is special about 'struct Y { cons
d, just as
pointed out in the previous thread. That is, things have not
changed.
So, in following, "Hi" is not printed. Have you had any luck with
'this(const this)'?
Thanks
Dan
import std.stdio;
struct X {
char[] c;
this(char[] c_) { c = c_.dup; }
this
s){}
- this(this)const{}
- this(const this){}
Also, has any of this detailed information made it into the
language spec?
Thanks
Dan
On Thursday, 7 February 2013 at 05:30:27 UTC, Maxim Fomin wrote:
On Wednesday, 6 February 2013 at 22:54:40 UTC, Dan wrote:
This begs the question:
Which of these do you choose and for what reasons:
- this(this){}
This is natural way to define struct postblit. This fully
complies with
x27;
features and truly neat enhancements to D. But the original
claims and promise of D on a certain level is within reach if the
focus is on the more mundane.
Thanks
Dan
the boilerplate required for
simple getters and
setters is kind of ridiculous. I believe that avoiding that is
the primary
reason that people want to be able to swap between variables
and property
functions, and with a small addition to the language, we can
obviate that
boilerplate.
No addition needed.
Thanks
Dan
On Thursday, 7 February 2013 at 21:12:35 UTC, Steven
Schveighoffer wrote:
struct S
{
mixin(boilerplateProperty("i"));
}
I don't see this as a difficult problem to solve.
-Steve
+1
, using +=, -=, ...)
Quite likely I missed the point.
Today I have:
struct S
{
@property int i;
}
Tomorrow I decide I need to track every time int i is read and
written.
How is that done?
I assume that that sort of encapsulation is what we are after.
Thanks
Dan
ant. But
documentation on a generated accessor is not necessary. And if
you customize it you can document it.
No extra feature needed.
Thanks
Dan
if a solution is in the works
and delegate trickery is just a stop gap it's less worrisome.
Thanks
Dan
others have more friendly ways
I'd be interested.
Thanks
Dan
/** Discriminates a pass type by its size
*/
template PrefersPassByRef(T) {
static if(isAssociativeArray!T || isDynamicArray!T) {
enum PrefersPassByRef = false;
} else static if(T.sizeof > 16 || hasAliasing!T) {
fference is the choice is somewhat formalized.
struct A {
long a;
double b;
}
is generally better passed by ref, where
struct A {
long a;
long b;
}
is better passed by value.
Any performance numbers?
Even if that were true, is it realistic to expect a compiler to
get it right each time?
Thanks
Dan
working javascript. I don't know javascript - I've started
to learn a few times but was repelled by it. But most traditional
OO programmers can grok Dart in a few days, plus it has great
tools. If D could do the same it would be great.
Thanks,
Dan
I have a question regarding performance issue I am seeing on multicore Windows
systems. I am creating many threads to do parallel tasks, and on multicore
Windows systems the performance is abysmal. If I use task manager to set the
processor affinity to a single CPU, the program runs as I would
dsimcha Wrote:
> == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article
> > Maybe I'm wrong, is there a good test case to prove it is worse on
> > multiple cores?
> > -Steve
>
> This is a synthetic, extreme corner case benchmark, but I think it hammers
> home
> the point that such pr
language". Someday I hope to use D instead of C in embedded work. I
have grown fond of 0b added to some C cross-compilers for manipulating
bits in custom h/w registers.
--
Dan
> 777
writefln("%o", octal!0777); -> 511 (0ops)
Maybe in a new version the second line will generate a error for the
leading zero on the second line?
--
Dan
Morlan writes:
> It sounds reasonable. But I cannot find information about this
> behaviour in the Language Reference or TDPL book. Can you point to a
> relevant source?
I was curious too, so found in Section 7.1.5.1 the description of
opAssign using a swap. That explains it I think.
erate opAssign taking rhs by value.
I think if the address of struct S to the ctor and dtor is printed
(e.g.)
writeln(&this, ": ", name, " destructor");
it will show that the dtor is question is called on copy. I don't think
this is a bug, just compiler implementation of assignment so it can take
non lvalues.
--
Dan
Binaries are provided for OSX, but when I try to compile it (using a
Makefile placed in dmd2/ shown below), I get linking errors due to
libphobos2.a whenever I try to link even a basic D program. The program
however links correctly if I replace my libphobos2.a with the supplied
osx/lib/libphobo
One thing I'm not sure is addressed by this design is memory
locality. I know of libnuma http://linux.die.net/man/3/numa which
allows me to express what NUMA domain my memory should be
allocated from at run-time for each allocation.
In the case that I want to allocate memory in a specific NUMA
On Tuesday, 24 September 2013 at 13:21:48 UTC, deadalnix wrote:
On Tuesday, 24 September 2013 at 11:38:29 UTC, Dan Schatzberg
wrote:
One thing I'm not sure is addressed by this design is memory
locality. I know of libnuma http://linux.die.net/man/3/numa
which allows me to express what
On Tuesday, 24 September 2013 at 16:06:39 UTC, Andrei
Alexandrescu wrote:
On 9/24/13 4:38 AM, Dan Schatzberg wrote:
One thing I'm not sure is addressed by this design is memory
locality. I
know of libnuma http://linux.die.net/man/3/numa which allows
me to
express what NUMA domain my m
On Tuesday, 24 September 2013 at 17:38:34 UTC, Dan Schatzberg
wrote:
What is your objective though? Aren't you trying to define a
hierarchy of allocators where more specific allocators can be
composed from general ones? In which case what is the concern
with including locality at the
"Diggory" writes:
>
> There's another alternative that fits more with D style which is also
> very mathsy.
>
> It would be possible to make storage classes work with the colon
> syntax, ie:
>
> auto:
>x = 1;
>y = 2;
>f = a => a+1
>writeln(f(x) + y);
>
> Also:
>
> immutable:
>x
IM-602.pdf
A fun read. I wonder what David Moon is doing today?
--
Dan
You just have to construct it first and then claim that it is
unique and so safely cast it to immutable:
import std.exception : assumeUnique;
immutable int[int] aa;
static this(){
auto temp = [1:2, 3:4];
aa = assumeUnique(temp);
}
Seems unintuitive and roundabout. Is this a bug or a f
On Tuesday, 18 March 2014 at 15:54:23 UTC, Andrea Fontana wrote:
I can't understand whether or not this is a sieve of atkin...
The link says 'A very quick (segmented) sieve of Eratosthenes'
On Wednesday, 19 March 2014 at 00:37:27 UTC, bearophile wrote:
Dan Killebrew:
Seems unintuitive and roundabout. Is this a bug or a feature?
It's a good feature. Generally immutable variables are
initializable from strongly pure functions. If you think about
what immutability and p
On Wednesday, 19 March 2014 at 01:29:16 UTC, bearophile wrote:
I suggest a Phobos module named "combinatorics" (or just
"combs"?). It's not meant to be a complete library of
combinatorics algorithms, nor to contain the most optimized
algorithms around. It's meant to be a collection of efficien
I am using in LDC for iOS. Well, at least doing
cleanups so that a objc/c++ exception could bubble up and D could call
dtors and finally blocks. It was mostly working but I wanted to make
progress on other stuff so shelved it since I had normal D sjlj eh
working.
--
Dan
Hi all, I'm toying around with the idea of porting my raytracer codebase to D.
But before committing, I have a few rookie questions:
1: What kind of license is the D compiler under? I'm thinking of shipping a
commercial, close sourced (for now) program with the D compiler (so that users
can compil
What IDE/EDITOR do you use for D? What plugins if you use Vim?
On Monday, 27 January 2014 at 12:46:43 UTC, terchestor wrote:
((snipped))
Does anyone using PLplot can tell if it's worth using it or is
there any alternative?
Well, this thread is a 1.5 years old but i was looking around for
info on plplot also, and it is possible to use it with d, at
least
s good with LDC.
using LDC - the LLVM D compiler (0.14.0):
based on DMD v2.065 and LLVM 3.4.2
$ ldc2 -L-dead_strip hello.d
$ ls -lh hello
-rwxr-xr-x 1 dan staff 305K Sep 1 10:01 hello
$ strip hello
$ ls -lh hello
-rwxr-xr-x 1 dan staff 228K Sep 1 10:01 hello
A version using put
"Kai Nacke" writes:
> On Friday, 12 September 2014 at 10:06:10 UTC, Sergey Korshunoff via
> Digitalmars-d wrote:
>>
>> LDC and LLVM allow to comvert a D source code to C source (and may
>> be
>> to C++). What wrong with this solution?
>
> There's nothing wrong with this solution. I think about th
"Koz Ross" writes:
> On Friday, 19 September 2014 at 06:21:31 UTC, ketmar via Digitalmars-d
> wrote:
>> On Fri, 19 Sep 2014 06:11:32 +
>> Koz Ross via Digitalmars-d wrote:
>>
>>> Yeah, I'm still confused as to why this is happening to me. So does
>>> it run correctly and output a bunch of nu
"eles" writes:
> On Monday, 13 October 2014 at 23:28:05 UTC, Piotrek wrote:
>> On Monday, 13 October 2014 at 21:50:20 UTC, eles wrote:
>>> Short answer is: yes, you cand write, but you cannot compile.
>>
>>
>> Wait, what? Do you mean link or maybe load? I don't write Linux
>> kernel modules, but
"Chris" writes:
>
> iOS/ARM are very important. What's the latest state of affairs? I know
> some progress has been made but it has been off my radar for a month
> or two now.
The iOS project with LDC has been idle during the windsurfing season
:-). Days are geting shorter so I plan to resume w
"Szymon Gatner" writes:
>
> That is good to hear indeed. In your estimate: how much longer until D
> is usable on iOS?
Depends on your definition of "usable" Szymon.
If it is just me working on it, I think a standalone LDC cross compiler
to 32-bit arm devices with druntime/phobos can be ready in
Walter Bright writes:
> On 10/14/2014 11:23 PM, Jacob Carlborg wrote:
>> On 2014-10-15 07:57, Walter Bright wrote:
>>
>>> Why do you need non-fatal unittests?
>>
>> I don't know if this would cause problems with the current approach. But most
>> unit test frameworks don't NOT stop on the first fa
Jacob Carlborg writes:
> On 2014-10-15 08:50, Dan Olson wrote:
>
>> Then there are all the tool related things that might hinder D use on
>> iOS. Things such as no source level debugging
>
> I think I have used Xcode to debug a D application.
Specifically here I mean
Walter Bright writes:
> On 10/15/2014 7:35 AM, Dan Olson wrote:
>> That is what I am looking for, just being able to continue from a failed
>> assert in a unittest.
>
> Just use enforce() or something similar instead of assert(). Nothing
> says you have to use assert
"Ola Fosheim "Grøstad\"" writes:
> On Wednesday, 15 October 2014 at 14:25:43 UTC, Dicebot wrote:
>> How can one continue without recovering? This will result in any
>> kind of environment not being cleaned and false failures of other
>> tests that share it.
>
> fork()?
Forking each unittest soun
Walter Bright writes:
> I don't understand why unittests in druntime/phobos are an issue for
> users. We don't release a DMD unless they all pass - it should be moot
> for users.
I think some context was lost. This is different. I am making mods to
LDC, druntime, and phobos to target iPhones an
Like D, Java is LTR evaluation for assignment, and I think C# too. A
similar situation to OP code can be created in Java by reassigning an
array reference in saveIt().
"Gary Willoughby" writes:
> There is a module called std.stdint located here:
>
> http://dlang.org/phobos/std_stdint.html
>
> but it doesn't appear in the documentation index here:
>
> http://dlang.org/phobos/index.html
>
> Not only that but when looking at the source it's just publicly
> importi
d "Default NaN" modes in fpscr which helps pass many other
tests. Normally these modes are enabled for iOS. Also, iOS uses
float-abi=softfp.
--
Dan
On Monday, 26 January 2015 at 17:36:05 UTC, Andrei Alexandrescu
wrote:
On 1/26/15 8:49 AM, Dan Olson wrote:
A question for the floating point experts. Do phobos
unittests get run
on any architectures with 64-bit reals?
Would OSX be that? -- Andrei
It is mostly x86 80-bit reals these days.
On Monday, 26 January 2015 at 20:04:46 UTC, Johannes Pfau wrote:
I run the tests for GDC on ARM/linux soft and hardfloat 64 bit.
All
modules except gammafunction should pass. gammafunction was
never
ported to 64bit reals and I asked about it multiple times on the
newsgroup but nobody cared. I a
"Joakim" writes:
> Some good news, I've made progress on the port to Android/ARM, using
> ldc's 2.067 branch. Currently, all 46 modules in druntime and 85 of
> 88 modules in phobos pass their tests (I had to comment out a few
> tests across four modules) when run on the command-line.
:-)
ngs on http://dlang.org/download.html though until
somebody besides me has reported success using D in an iOS App.
How should I proceed?
--
Dan
Vladimir Panteleev writes:
> On Monday, 26 October 2015 at 05:34:05 UTC, Dan Olson wrote:
>> I think it makes sense to add a link to the LDC iOS releases in
>> http://wiki.dlang.org/Compilers. Perhaps a row for iOS in table
>> "Package and/or binary availability
like a good idea? It is getting queued up soon as a PR to LDC
once we get an iOS version officially in the compiler frontend.
--
Dan
Johannes Pfau writes:
> Am Thu, 12 Nov 2015 09:59:14 -0800
> schrieb Dan Olson :
>
>> Johannes Pfau writes:
>> > To expand on this: I think we'd prefer one __d_personality_v0 which
>> > is implemented in upstream druntime and identical for all
>>
Dan Olson writes:
> Johannes Pfau writes:
>
>> Am Thu, 12 Nov 2015 09:59:14 -0800
>> schrieb Dan Olson :
>>
>>> Johannes Pfau writes:
>>> > To expand on this: I think we'd prefer one __d_personality_v0 which
>>> > is implemen
David Nadlinger writes:
> On Friday, 13 November 2015 at 18:40:06 UTC, Iain Buclaw wrote:
>> There may be a few other holes between how Fibers and EH interact.
>>
>> https://github.com/D-Programming-Language/druntime/commit/f6633abb43ea1f2464d3a772b8f8fe78216ffd8e
>
> The SJLJ stack switching sho
describe the data/messages, but not so much a requirement
at runtime. Usually message are special character delimited
strings, which D can do well with.
In terms of it becoming redundant, what are some of the new
competitors to it?
Thanks
Dan
braries.
>
> Next up: actually catching C++ exceptions!
>
> Thanks to everyone who helped out with this.
Very cool. Is it conceivable that DMD, GDC, and LDC might one day share
common support code in druntime (personality, etc)? Could be many
benefits like a larger test population.
--
Dan
Ola Fosheim Grøstad writes:
> 5. run D apps on mobile?
1) I am involved in recreational windsurf races and pretty much everyone
carries a mobile phone to record GPS tracks. I though it would be fun
to create an app to manage the races, track finishing places, etc. The
non-GUI portion can be D
ury
Please wait seven days for creation of world...
--then after a few moves--
..++
++
+A+
+++*
+
+OA+
001020304050
Made my day. Now I'll get nothing done.
--
Dan
CraigDillabaugh writes:
> On Monday, 14 March 2016 at 15:53:39 UTC, Joakim wrote:
>> On Monday, 14 March 2016 at 15:14:17 UTC, CraigDillabaugh wrote:
>>
>> I'm not qualified to mentor a WebAssembly port, as I'm not versed on
>> compilers or IR. Dan would pro
ABI where I
have been working in LDC lately, this cast results in -1. Satisfies
bug7(int) and assert fails.
Does D language say anything about such casts? If follows C++, then
test is invalid.
--
Dan
in a similar way to that dmd PR, so that
>>>> Android/ARM can use the same scheme. It appears that Dan did
>>>> something similar with his patched llvm for iOS.
>>>>
>>>> As for your linked Android patches, that might be possible but
>>>> would
Dan Olson writes:
>
> For Android, LDC generates the usual .tbss/.tdata sections for TLS vars
> and __aeabi_read_tp() when needed to lookup the base address.
>
> ldc2 -mtriple=thumbv7-linux-anrdoideabi -output-s test.d
>
> tlsvar = 42;
>
> ldr r1, .LCPI
s hello world, and much more. I am trying to decide weather to
cleanup and post more complicated app examples or push ios branch
changes into ldc and D-Programming-Language git repos. Lately I've been
doing the later.
--
Dan
your message array declaration line is being read by
compiler as:
uint[0] message =
>> When I change the square brackets to parantheses, the error goes
>> away, but I'm not sure that is the correct fix ?
Changing the square brackets to parens is doing something different.
You do want the square brackets.
--
Dan
1 - 100 of 203 matches
Mail list logo