V Thu, 11 Sep 2014 11:40:05 +
andre via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
napsáno:
Hi,
I am 80% sure, the failing assertion is correct but please have a
look.
No it is not
assert(cast(A)cast(C)b); // this is OK
b is B so it does not know about having alias to A;
On Thursday, 11 September 2014 at 13:06:05 UTC, Colin wrote:
I have this test code:
struct Thing {
uint x;
}
void main(){
uint[] ar1 = [1, 2, 3, 4, 5];
auto min1 = ar1.reduce!((a,b) = a b);
writefln(%s, min1); // prints 1 as expected
Thing[] ar2 = [Thing(1), Thing(2),
On Thursday, 11 September 2014 at 14:18:31 UTC, Colin wrote:
Ah ok. I get it.
Thanks daniel!
a quiet better version:
import std.stdio;
import std.algorithm;
struct Thing {
uint x;
alias x this;
}
void main(){
uint[] ar1 = [1, 2, 3, 4, 5];
auto min1 = ar1
On Thursday, 11 September 2014 at 14:39:53 UTC, Daniel Kozak
wrote:
On Thursday, 11 September 2014 at 14:18:31 UTC, Colin wrote:
Ah ok. I get it.
Thanks daniel!
a quiet better version:
import std.stdio;
import std.algorithm;
struct Thing {
uint x;
alias x this;
}
void
V Thu, 11 Sep 2014 14:49:02 +
bearophile via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
napsáno:
Daniel Kozak:
You can just use min:
import std.stdio, std.algorithm;
struct Thing {
uint x;
alias x this;
}
alias minimum = reduce!min;
void main
On Thursday, 11 September 2014 at 14:56:00 UTC, Daniel Kozak via
Digitalmars-d-learn wrote:
V Thu, 11 Sep 2014 14:49:02 +
bearophile via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com
napsáno:
Daniel Kozak:
You can just use min:
import std.stdio, std.algorithm;
struct Thing
On Thursday, 11 September 2014 at 15:07:03 UTC, Daniel Kozak
wrote:
or use alias minimum = reduce!a b;
;)
ok this one does not work
V Sun, 31 Aug 2014 10:55:31 +
bearophile via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
napsáno:
This is C++ code that solves one Euler problem:
--
#include stdio.h
#include map
const unsigned int H = 9, W = 12;
const int g[6][3] = {{7, 0, H - 3},
V Mon, 1 Sep 2014 12:38:52 +0300
ketmar via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
napsáno:
On Mon, 01 Sep 2014 09:22:50 +
bearophile via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
In theory the best solution is to improve the performance of the
Brian Schott wrote in message
news:pbfgiwaxsdxdxetpi...@forum.dlang.org...
The delete keyword is deprecated[1] and making that decision never broke
any code.
[1] http://dlang.org/deprecate.html#delete
If you look at the table up the top, delete hasn't actually been deprecated
yet. If
Jonathan M Davis wrote in message
news:xjmfhegvanqdivhbt...@forum.dlang.org...
AFAIK, the only reason that it's not deprecated is that no one has
bothered to make the change (and you didn't want to deprecate it when you
went through all of those and updated their status a while back).
Am 05.08.2014 21:13, schrieb Marc Schütz schue...@gmx.net:
On Tuesday, 5 August 2014 at 18:36:35 UTC, ddos wrote:
alias Vec4f = TVector!(float,4);
alias Vec3f = TVector!(float,3);
class TVector(T,int n)
{
T[n] val;
...
TVector as class does work as expected, as a struct i get the
variants or
something): use an appropriate cast,
i.e. double pi_2 = *(cast(double*)ptr);
furthermore: why not use void* instead of size_t?
Cheers,
Daniel
V Thu, 31 Jul 2014 02:03:35 +
Puming via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
napsáno:
Hi,
I'm writing this global Config class, with an AA member:
```d
module my.config;
class Config
{
Command[string] commands;
}
__gshared Config CONFIG;
```
and
V Thu, 31 Jul 2014 13:26:38 +
Kagamin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
napsáno:
On Thursday, 31 July 2014 at 12:02:22 UTC, Kozzi11 wrote:
module m;
@someUda
class C {
void someFun();
}
@someUda
class D {
void anotherFun();
}
On Wednesday, 30 July 2014 at 16:14:56 UTC, Jesse Phillips wrote:
On Wednesday, 30 July 2014 at 07:08:17 UTC, Kozzi11 wrote:
#main.d:
import m.f;
class A {
//class main.A member m is not accessible
//mixin(t!(typeof(this), m));
void m() {};
//here is ok
//mixin(t!(typeof(this),
V Wed, 30 Jul 2014 14:33:51 +
seany via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
napsáno:
In Ali's excllent book, somehow one thing has escaped my
attention, and that it the mentioning of pointer arrays.
Can pointers of any type of pointed variable be inserted in an
int
Am 24.07.2014 17:29, schrieb Pavel:
On Thursday, 24 July 2014 at 15:22:46 UTC, Adam D. Ruppe wrote:
On Thursday, 24 July 2014 at 15:15:37 UTC, Pavel wrote:
string s = parsed[fail].str;
Since there is no entry fail in the object, it returns a null
JSON_VALUE pointer. Trying to get the string
is in a map.
If it is, it returns a pointer to the value, otherwise null.
Thus null.
Cheers,
Daniel
Am 24.07.2014 19:05, schrieb Gary Willoughby:
I was reading Ali's book (http://ddili.org/ders/d.en/index.html) and saw
this piece of code on how to get the true size of an object:
MyClass* buffer = cast(MyClass*)GC.calloc(__traits(classInstanceSize,
MyClass) * 10);
That got me thinking, how
Am 21.07.2014 17:04, schrieb TheFlyingFiddle:
On Monday, 21 July 2014 at 01:42:58 UTC, Daniel Gibson wrote:
Am 21.07.2014 03:34, schrieb Vlad Levenfeld:
To get a foreach to run at compile-time, you have to give it something
whose value is known to the compiler (so, T and typeof(argTuple) would
Am 21.07.2014 20:09, schrieb H. S. Teoh via Digitalmars-d-learn:
On Mon, Jul 21, 2014 at 06:36:04PM +0200, Daniel Gibson via Digitalmars-d-learn
wrote:
[...]
However, having something like staticIota in the stdlib would probably
make sense.
[...]
It's already in std.typecons.
(Admittedly
Jonathan M Davis via Digitalmars-d-learn wrote in message
news:mailman.1421.1401576730.2907.digitalmars-d-le...@puremagic.com...
By dynamic linking do you mean LoadLibrary or linking with import
library?
Both will work, otherwise we couldn't use Microsoft's libraries - e.g.
Yuriy wrote in message news:klosrzuxwmvilupzz...@forum.dlang.org...
Ok, i can understand that, but what about this one:
http://dpaste.dzfl.pl/6a9961e32e6d
It doesn't use d arrays in function interfaces. Should it work?
Similar problem, D arrays cannot be mangled correctly with C++ mangling.
Yuriy wrote in message news:rfirqtgbparjbqxwt...@forum.dlang.org...
On Wednesday, 14 May 2014 at 08:47:38 UTC, Daniel Murphy wrote:
I'm not getting any errors with the development head. What os/compiler
version?
Hm, now that's strange. Building with latest public version seems to work
On Tuesday, 13 May 2014 at 17:41:42 UTC, Yuriy wrote:
On Tuesday, 13 May 2014 at 17:09:01 UTC, Daniel Murphy wrote:
What exactly is the mangling problem with extern(C++) classes?
Can't use D arrays (and strings) as function argument types.
Can't use D array types as template arguments.
extern
Yuriy wrote in message news:uflaemdlxvavfmvkb...@forum.dlang.org...
Hello, is there a way of reducing size of an empty class to just
vtbl? I tried to declare it as extern(C++) which works, but has a
nasty side effect of limited mangling.
What exactly is the mangling problem with extern(C++)
Jonathan M Davis wrote in message
news:mailman.112.1397351369.5999.digitalmars-d-le...@puremagic.com...
Honestly, I would have considered that to be a bug. Converting the return
type
to a different level of mutability based on purity is one thing.
Automatically
casting the return value just
bearophile wrote in message news:hxdrbyqrhwvuochlh...@forum.dlang.org...
Is it possible and a good idea to allow code like the function
foo2?
It seems reasonable.
This block of code fails the second assert, why? Using
stableRemove{Front,Back} does not fix it.
import std.range;
import std.container;
unittest {
auto dl2 = DList!int([2,7]);
dl2.removeFront();
//dl2.stableRemoveFront();
assert(dl2[].walkLength == 1);
dl2.removeBack();
Byron wrote in message news:li1ba2$5lc$1...@digitalmars.com...
So does anyone have a fool prof way of converting coff to omf libs. I
feel like this use to be easy..
In general, this won't work. The only thing that is straightforward and
reliable is converting coff import libraries to omf
On Friday, 4 April 2014 at 04:10:51 UTC, Saurabh Das wrote:
Hello,
Say I compile a program with:
dmd -unittest -debug -cov test.d
Then, when I run ./test, a file 'test.lst' is generated in the
current working directory. Is there a way in which I can
instruct the file to be created in a
evilrat wrote in message news:mxhmgkljrzqhaymec...@forum.dlang.org...
On Friday, 28 February 2014 at 04:19:47 UTC, Etienne Cimon wrote:
How do you stop statements from belonging to the specific version of
code without using brackets?
add version(all): after code where specific version
Jesse Phillips wrote in message
news:vaatltklsmbmdnabo...@forum.dlang.org...
Wish it would work with @safe and nothrow too, granted writeln should
eventually be @safe/trusted anyway.
I just travelled back in time and granted your wish!
int x;
int* p;
void main() pure nothrow @safe
{
On Monday, 2 December 2013 at 09:01:25 UTC, Gary Willoughby wrote:
On Sunday, 1 December 2013 at 20:46:20 UTC, Kozzi wrote:
I'm basically porting all the mysql-client headers which i
thought would be pretty straight forward but it's taking a
little more thought than i anticipated.
Can I ask
On Monday, 2 December 2013 at 13:42:48 UTC, Dfr wrote:
Hi
I searched through various D documentation sources and did not
found anything except 'std.copy', but it's only for slices.
Is there such feature in standart library ? Or some easy way to
clone for example map of slices of maps or an
On Sunday, 17 November 2013 at 10:56:16 UTC, Jonathan M Davis
wrote:
I think that the typical approach at this point is to just drop
purity for the
moment, but if you want you really want it, you are indeed
going to have to
implement it yourself. But we'll get there with Phobos
eventually.
The following code works for finding the lower bound based on
needle. But I have to create a needle which I don't want to do.
How can I use lowerBound with just the sortKey, date in this
case? So I want to do something like the following - but it
won't work. Is there a way to search an array
On Tuesday, 12 November 2013 at 15:51:53 UTC, bearophile wrote:
Daniel Davidson:
Is there a way to search an array I know is ordered by date by
only supplying date?
You can use a map to perform a projection:
import std.stdio, std.range, std.datetime, std.algorithm,
std.array
On Tuesday, 12 November 2013 at 16:34:30 UTC, bearophile wrote:
Daniel Davidson:
Yes, but that is only giving the dates. I want the actual
array elements. Suppose S is a large object with lots of extra
fields in addition to `string foo`. There should be a way to
pull out the lower bound
On Tuesday, 5 November 2013 at 17:47:16 UTC, bearophile wrote:
TV[TK] mergeAAs(TK, TV)(TV[TK] aas...) {
It seems even fit for Phobos.
Bye,
bearophile
I have something I would appreciate feedback/criticism on. My
first stab at it worked, but had no support for passing in
const/immutable.
On Friday, 1 November 2013 at 20:29:54 UTC, Jonathan M Davis
wrote:
On Friday, November 01, 2013 14:28:55 Daniel Davidson wrote:
On Thursday, 31 October 2013 at 19:39:44 UTC, Jonathan M Davis
Deep copying is not the only reason to have a postblit. Smart
pointers
On Wednesday, 6 November 2013 at 16:15:36 UTC, Gary Willoughby
wrote:
A simple request but i'm failing hard. How do i re-init an
associative array? This is obviously not the way:
import std.stdio;
void main(string[] args)
{
int[string] x;
On Wednesday, 6 November 2013 at 16:41:19 UTC, Gary Willoughby
wrote:
x.clear();
I looked at that but apparently it leaves the array in an
unsafe state.
Source:
http://forum.dlang.org/thread/iu3ll6$2d48$1...@digitalmars.com
Wow! Good to know, thanks!
On Wednesday, 6 November 2013 at 16:41:19 UTC, Gary Willoughby
wrote:
I looked at that but apparently it leaves the array in an
unsafe state.
Source:
http://forum.dlang.org/thread/iu3ll6$2d48$1...@digitalmars.com
Is that still the case? The following seems to work just fine.
Maybe Kenji
On Wednesday, 6 November 2013 at 21:26:09 UTC, Dicebot wrote:
On Wednesday, 6 November 2013 at 21:07:47 UTC, Gary Willoughby
wrote:
Unfortunately this still suffers the same problem in that you
need a module symbol name to do anything. I need to get all
module symbols at compile time.
You
The code below causes a crash. What is the idiomatic way to merge
associative arrays? If there is a simple version that allows the
value at a key to be clobbered by the value of the right hand
operand when there is a collision, that is a start.
import std.stdio;
void main() {
double[string]
On Friday, 1 November 2013 at 04:26:25 UTC, Ali Çehreli wrote:
You are not going to like my answer but this may be the 16-byte
struct bug. Add something to RateCurve and your code works
fine... :-/
struct RateCurve {
private immutable(DateRate)[] _data;
ubyte b; // -- ADDED
}
I
On Thursday, 31 October 2013 at 19:39:44 UTC, Jonathan M Davis
wrote:
const and postblit fundamentally don't mix, because for it to
work, you have
to violate the type system. With postblits, the struct gets
memcpied and then
the postblit constructor has the chance to mutate the resulting
On Friday, 1 November 2013 at 12:59:24 UTC, Gary Willoughby wrote:
I have a small test case that displays a linker error. I
wondered if this is an issue with the tool chain or whether i'm
doing something wrong.
I have a simple directory structure like this:
test/methods.d
test/test1.d
Given this code:
import plus.tvm.rate_curve;
struct T {
RateCurve m;
}
struct S {
const(T) rc;
}
I get this error: Error: mutable method
plus.models.dossier.__unittestL42_1.T.__fieldPostBlit is not
callable using a const object
Is this fundamentally incorrect? I abandoned
The following seems to work, but feels like luck. When foo
returns rc should be taken off the stack. If I recall, in C++
something like this would crash, but why not here?
import std.stdio;
struct RC {
this(this) { data = data.dup; }
int[] data;
}
struct T {
const(RC) *rc;
void goo() {
On Thursday, 31 October 2013 at 14:28:31 UTC, bearophile wrote:
Daniel Davidson:
I get this error: Error: mutable method
plus.models.dossier.__unittestL42_1.T.__fieldPostBlit is not
callable using a const object
Related:
http://d.puremagic.com/issues/show_bug.cgi?id=4867
Bye,
bearophile
On Thursday, 31 October 2013 at 15:56:45 UTC, Maxim Fomin wrote:
On Thursday, 31 October 2013 at 14:03:28 UTC, Daniel Davidson
wrote:
Given this code:
import plus.tvm.rate_curve;
struct T {
RateCurve m;
}
struct S {
const(T) rc;
}
I get this error: Error: mutable method
On Thursday, 31 October 2013 at 16:16:36 UTC, bearophile wrote:
That's wrong code, you are escaping a reference to memory (of
rc variable) allocated in the stack frame of foo(). The D
compiler is not smart enough to recognize the bug. There are
optimizations that patch and avoid this bug
The following crashes on writeln, but looks reasonable. Is some
form of initializing ctor required for RateCurve?
import std.datetime;
import std.range;
import std.stdio;
struct DateRate {
Date date;
double value = 0.0;
}
struct RateCurve {
private immutable(DateRate)[] _data;
}
struct
On Tuesday, 29 October 2013 at 18:02:46 UTC, Logesh Pillay wrote:
On Sunday, 20 October 2013 at 16:08:50 UTC, bearophile wrote:
Logesh Pillay:
Thanks. Coming to D from python, I have to say D's tuples
look difficult. I'm going to see how far I can get with
structs writing my sudoku solver.
On Thursday, 24 October 2013 at 00:02:30 UTC, bearophile wrote:
Jonathan M Davis:
Progress is being made on that however (as evidenced by the
fact that format can now be pure in the beta for 2.064).
Now two of the most common offenders of pure/nothrow in my
high level code are iota() and
On Saturday, 26 October 2013 at 08:09:26 UTC, Dmitry Olshansky
wrote:
26-Oct-2013 02:36, Daniel Davidson пишет:
On Friday, 25 October 2013 at 16:43:23 UTC, Daniel Davidson
wrote:
On Friday, 25 October 2013 at 14:14:39 UTC, Dicebot wrote:
This will work starting with 2.064:
Ok. I'll keep
Here is a working solution:
https://github.com/patefacio/d-help/blob/master/d-help/opmix/ut.d
Currently it only pulls in unittests at the module level. I'm
sure it will work on unittests scoped to structs/classes, I just
need to figure out how to determine if a compile time named
object is
On Friday, 25 October 2013 at 13:04:03 UTC, Dicebot wrote:
I strictly believe any unittest enhancing library must be built
on top of existing unittest blocks using __traits(getUnittest)
and be 100% compatible with normal `-unittest` mode
I don't disagree. What exactly does that mean and what
On Friday, 25 October 2013 at 14:14:39 UTC, Dicebot wrote:
This will work starting with 2.064:
Ok. I'll keep pressing. Here is an updated version:
http://pastebin.com/g6FWsTkr
The idea is to be able to just import ut, annotate as you have
described and get unit tests run. I want to mixin
On Friday, 25 October 2013 at 16:43:23 UTC, Daniel Davidson wrote:
On Friday, 25 October 2013 at 14:14:39 UTC, Dicebot wrote:
This will work starting with 2.064:
Ok. I'll keep pressing. Here is an updated version:
http://pastebin.com/g6FWsTkr
The idea is to be able to just import ut
enum Bar = Bar;
@(Foo) @Bar int x;
pragma(msg, __traits(getAttributes, x));
This prints: tuple(Foo, Bar)
How do you run code only if Bar is associated with a symbol
like x?
I was hoping something like this:
pragma(msg, hasAnnotation!(x, Bar));
Where getAnnotation from
On Wednesday, 16 October 2013 at 21:11:19 UTC, H. S. Teoh wrote:
On Wed, Oct 16, 2013 at 10:09:50PM +0200, Daniel Davidson wrote:
[...]
I reported my issue with the `chain` function to this NG and
tried
to start annotating items used by chain with pure to see how
far the
thread led. Honestly
Should text be pure?
I have multiple enforce statements of the form:
enforce(0 == _history.length ||
!binaryFun!(orderingPred)(additional,
_history[$-1]),
text(V.stringof, must be added in chronological
order, but ,
additional, comes
On Wednesday, 23 October 2013 at 19:56:26 UTC, Andrej Mitrovic
wrote:
On Wednesday, 23 October 2013 at 19:55:26 UTC, Daniel Davidson
wrote:
Should text be pure?
It's pure in 2.064, the upcoming release.
Great, thanks. What is the best way to get on that version for
the Mac (pointer
On Wednesday, 23 October 2013 at 20:18:39 UTC, Andrej Mitrovic
wrote:
On 10/23/13, Daniel Davidson nos...@spam.com wrote:
Great, thanks. What is the best way to get on that version for
the Mac (pointer to instructions)?
You can download the beta here:
http://forum.dlang.org/thread
On Wednesday, 23 October 2013 at 21:37:25 UTC, H. S. Teoh wrote:
On Wed, Oct 23, 2013 at 11:17:30PM +0200, Daniel Davidson wrote:
On Wednesday, 23 October 2013 at 20:18:39 UTC, Andrej Mitrovic
wrote:
On 10/23/13, Daniel Davidson nos...@spam.com wrote:
Great, thanks. What is the best way to get
On Thursday, 17 October 2013 at 20:31:38 UTC, Yura wrote:
Dear D programmers,
I am very new to D programming language. I just started to
learn it as an alternative to python since the latter sometimes
is too slow. My question is whether there some simple ways to
solve linear algebra problems
If it would be no different then why prefer immutable(char)[] for
string?
On Wednesday, 16 October 2013 at 20:33:23 UTC, H. S. Teoh wrote:
On Wed, Oct 16, 2013 at 09:45:09PM +0200, Daniel Davidson wrote:
On Wednesday, 16 October 2013 at 19:12:48 UTC, Dicebot wrote:
[...]
I think any usage of immutable with types/entities not
initially
designed for immutability
On Thursday, 17 October 2013 at 18:28:31 UTC, Meta wrote:
On Thursday, 17 October 2013 at 13:08:18 UTC, Daniel Davidson
wrote:
If it would be no different then why prefer immutable(char)[]
for string?
Strings are immutable in quite a few other languages. Ex: Java,
Python. I found this old
The following code runs fine. There is a whole bunch of types
imported, so whittling it down to the problem is not too easy.
import plus.models.assumption;
import pprint.pp;
import std.stdio;
import std.datetime;
void main() {
immutable am = AssumptionModel();
writeln(pp(am));
}
That code
On Wednesday, 16 October 2013 at 10:11:32 UTC, Andrew wrote:
Hello there!
I've decided to learn a bit of D, as I am currently Android
Developer (mostly C++ - JNI - Java), I'm trying to create a D
shared library which exports function (with extern (C)) for
invocation from Java.
My .d file
On Thursday, 13 June 2013 at 12:29:57 UTC, Simen Kjaeraas wrote:
On Thu, 13 Jun 2013 14:17:22 +0200, Stephan Schiffels
stephan_schiff...@mac.com wrote:
For example, is there a way of instantiating an object
normally (i.e. mutable), and then later freeze it to
immutable via a simple cast or
The code below fails to compile due to the last line. I was
hoping casting away immutable would allow the call to foo. I
think it is not accepted because of the rval to ref issue. If
that is the case, how can foo be called by casting?
I'm not a fan of casting but I'm finding cases where it is
On Wednesday, 2 October 2013 at 13:09:34 UTC, Daniel Davidson
wrote:
I'm reviewing Ali's insightful presentation from 2013 DConf. I
wonder has he or anyone else followed up on the concepts or
formalized some guidelines that could achieve consensus. I
definitely agree it would be helpful
On Wednesday, 16 October 2013 at 17:16:39 UTC, Dicebot wrote:
It works as it should. Make a mutable copy of t2 and pass it.
Or make foo() accept const. I can't imagine a single legitimate
use case for destroying type system in a way you want.
How do you propose to make a mutable copy
On Wednesday, 16 October 2013 at 17:58:41 UTC, Dicebot wrote:
On Wednesday, 16 October 2013 at 17:50:48 UTC, Daniel Davidson
wrote:
On Wednesday, 16 October 2013 at 17:16:39 UTC, Dicebot wrote:
It works as it should. Make a mutable copy of t2 and pass it.
Or make foo() accept const. I can't
On Wednesday, 16 October 2013 at 17:55:56 UTC, Dicebot wrote:
struct S {
R r;
this(ref immutable(T) t) immutable {
r.tupleof = t.tupleof;
}
}
?
Thanks. It is cute - but not so helpful. The example stands. I
*need* to call a createRFromT.
Their shapes are the same in this simple
On Wednesday, 16 October 2013 at 18:09:55 UTC, Maxim Fomin wrote:
On Wednesday, 16 October 2013 at 17:05:25 UTC, Daniel Davidson
wrote:
The code below fails to compile due to the last line. I was
hoping casting away immutable would allow the call to foo. I
think it is not accepted because
On Wednesday, 16 October 2013 at 17:55:14 UTC, H. S. Teoh wrote:
On Wed, Oct 16, 2013 at 07:23:24PM +0200, Daniel Davidson wrote:
On Wednesday, 2 October 2013 at 13:09:34 UTC, Daniel Davidson
wrote:
[...]
Maybe it is a philosophical question, but where does
immutability
really come from
On Wednesday, 16 October 2013 at 18:52:23 UTC, qznc wrote:
On Wednesday, 16 October 2013 at 17:55:14 UTC, H. S. Teoh wrote:
Maybe it's helpful to understand how D's const system works.
The
following diagram may help (please excuse the ASCII graphics):
const
/
On Wednesday, 16 October 2013 at 19:01:59 UTC, H. S. Teoh wrote:
On Wed, Oct 16, 2013 at 08:49:51PM +0200, Daniel Davidson wrote:
On Wednesday, 16 October 2013 at 17:55:14 UTC, H. S. Teoh
wrote:
On Wed, Oct 16, 2013 at 07:23:24PM +0200, Daniel Davidson
wrote:
[...]
If you have a type that has
On Wednesday, 16 October 2013 at 19:12:48 UTC, Dicebot wrote:
On Wednesday, 16 October 2013 at 19:06:06 UTC, Daniel Davidson
wrote:
I don't understand how it could be fine. As code grows it
would lead to people not adding useful members like history
just because of the huge repercussions
On Wednesday, 16 October 2013 at 19:55:41 UTC, Simen Kjaeraas
wrote:
On 2013-10-16, 18:54, Daniel Davidson wrote:
On Thursday, 13 June 2013 at 12:29:57 UTC, Simen Kjaeraas
wrote:
On Thu, 13 Jun 2013 14:17:22 +0200, Stephan Schiffels
stephan_schiff...@mac.com wrote:
For example
On Wednesday, 16 October 2013 at 19:49:25 UTC, monarch_dodra
wrote:
On Wednesday, 16 October 2013 at 17:50:48 UTC, Daniel Davidson
wrote:
How do you propose to make a mutable copy *generically*?
You can't. Let alone generically.
If I give you an immutable int* p, how do you copy it to
int
On Wednesday, 16 October 2013 at 19:49:25 UTC, monarch_dodra
wrote:
On Wednesday, 16 October 2013 at 17:50:48 UTC, Daniel Davidson
wrote:
How do you propose to make a mutable copy *generically*?
You can't. Let alone generically.
If I give you an immutable int* p, how do you copy it to
int
On Tuesday, 15 October 2013 at 05:44:25 UTC, captaindet wrote:
hi,
i am a bit confused.
the official language ref ( http://dlang.org/hash-map.html )
states:
Classes can be used as the KeyType. For this to work, the class
definition must override the following member functions of
class
I would like to correctly annotate my functions with pure. I've
hit a function that is calling chain which breaks purity. Is
chain really not pure?
The relevant section of code is:
...
auto sortedRage = assumeSorted!(a.when
b.when)(opSlice());
auto trisection =
On Tuesday, 15 October 2013 at 13:43:55 UTC, bearophile wrote:
Daniel Davidson:
I would like to correctly annotate my functions with pure.
I've hit a function that is calling chain which breaks purity.
Is chain really not pure?
Phobos is slowly being annotated with pure/nothrow (and @safe
I know I am too late, as you know best thing always delay. So
visit KoolChart to find best chart library.
On Wednesday, 9 October 2013 at 23:05:27 UTC, qznc wrote:
On Wednesday, 9 October 2013 at 15:50:55 UTC, Daniel Davidson
wrote:
void foo(const(MutableType) mt);
void foo(immutable(MutableType) mt);
Naturally the inclination is to choose the second as it is a
stronger guarantee that no threads
On Thursday, 10 October 2013 at 23:06:23 UTC, qznc wrote:
Maybe the fact that D allows this implicit copy to immutable is
the problem? If one could require the use of a specific
function, this function could be overridden with working
behavior. The following code works.
Yes - the issue
On Wednesday, 9 October 2013 at 04:31:55 UTC, Ali Çehreli wrote:
On 10/08/2013 03:12 PM, qznc wrote:
On Monday, 7 October 2013 at 17:57:11 UTC, Ali Çehreli wrote:
To look at just one usage example, the following line
carries two
requirements:
auto a = T();
immutable b = a;
1) b
On Wednesday, 9 October 2013 at 04:41:35 UTC, Ali Çehreli wrote:
On 10/08/2013 03:03 PM, qznc wrote:
On Wednesday, 2 October 2013 at 13:09:34 UTC, Daniel Davidson
wrote:
1. If a variable is never mutated, make it const, not
immutable.
2. Make the parameter reference to immutable
On Wednesday, 9 October 2013 at 15:46:29 UTC, Gary Willoughby
wrote:
So why does this give me an error i expect:
import std.stdio;
class Foo
{
public void change(string[] name)
{
name[0] = tess;
On Wednesday, 9 October 2013 at 15:33:23 UTC, Ali Çehreli wrote:
That string is independent from the argument (i.e. Bar.name).
They initially share the same characters. Either of those
strings can leave this sharing at will, and that is exactly
what name=tess does. 'name' now refers to
This simple script calls out to find (on a Mac). For me this
works. If I increase the output by changing maxdepth to 3 it
hangs forever. When I run the same find from the shell it is
fine. What could cause a deadlock in this and what is a
workaround?
http://pastebin.com/ji8dZwAY
Thanks
Dan
601 - 700 of 926 matches
Mail list logo