Re: Lost a new commercial user this week :(

2015-01-01 Thread Daniel Davidson via Digitalmars-d
On Monday, 29 December 2014 at 05:43:13 UTC, Walter Bright wrote: Often I'll pipe the pretty-printed debug output to a file, as it can be voluminous, and then actually edit the file to bring out what I need. Not possible with a debugger. I think it is. Here is a small adjustment to

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-12-22 Thread Daniel Davidson via Digitalmars-d
On Monday, 22 December 2014 at 13:37:55 UTC, aldanor wrote: For some reason, people often relate quant finance / high frequency trading with one of the two: either ultra-low-latency execution or option pricing, which is just wrong. In most likelihood, the execution is performed on FPGA

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-12-22 Thread Daniel Davidson via Digitalmars-d
On Monday, 22 December 2014 at 19:25:51 UTC, aldanor wrote: On Monday, 22 December 2014 at 17:28:39 UTC, Daniel Davidson wrote: I don't see D attempting to tackle that at this point. If the bulk of the work for the data sciences piece is the maths, which I believe it is, then the attraction

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-12-22 Thread Daniel Davidson via Digitalmars-d
On Tuesday, 23 December 2014 at 03:07:10 UTC, Laeeth Isharc wrote: At one very big US hf I worked with, the tools were initially written in Perl (some years back). They weren't pretty, but they worked, and were fast and robust enough. I has many new features I needed for my trading strategy.

Re: Lost a new commercial user this week :(

2014-12-20 Thread Daniel Davidson via Digitalmars-d
On Friday, 19 December 2014 at 19:20:15 UTC, Walter Bright wrote: On 12/19/2014 7:38 AM, Daniel Davidson wrote: Could this lack of need be attributable to understanding of the entire code base being used? No. It's attributable to I use different methods of debugging. The dmd source code

Re: Lost a new commercial user this week :(

2014-12-19 Thread Daniel Davidson via Digitalmars-d
On Friday, 19 December 2014 at 12:52:32 UTC, uri wrote: This is true. The first week for a new developer where I work is developing a better boot loader. The debugger is not allowed during this induction week and as a result our devs learn how to write better code first time through careful

Re: Lost a new commercial user this week :(

2014-12-19 Thread Daniel Davidson via Digitalmars-d
On Friday, 19 December 2014 at 16:27:03 UTC, H. S. Teoh via Digitalmars-d wrote: Could this lack of need be attributable to understanding of the entire code base being used? Nope. FWIW, I work with a large enterprise project that is far too large for anyone to grasp in its entirety, yet

Re: Lost a new commercial user this week :(

2014-12-18 Thread Daniel Davidson via Digitalmars-d
So to sum things up 1. you blindly walked into something you had no real experience with, apart from some vague memory that some parts of vibed worked for you a while ago. Pure bile. No - reread the thread. 2. you knew the debugger might be an issue, if not _the_ issue, but chose not

Re: discuss disqus

2014-08-11 Thread Daniel Davidson via Digitalmars-d
On Tuesday, 5 August 2014 at 11:00:44 UTC, Klaim - Joël Lamotte via Digitalmars-d wrote: Hi,​ did you consider using Discourse at least as a replacement for comments system? http://www.discourse.org/ It's made by the guys who made stackoverflow.com and it's useful at least as an alternative

Re: My D book is now officially coming soon

2014-05-05 Thread Daniel Davidson via Digitalmars-d-announce
On Monday, 3 March 2014 at 16:37:49 UTC, Adam D. Ruppe wrote: As some of you might know, I've been working on a D book over the last few months. It is now available as coming soon on the publisher's website: http://www.packtpub.com/discover-advantages-of-programming-in-d-cookbook/book

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-03-24 Thread Daniel Davidson
On Saturday, 22 March 2014 at 17:30:45 UTC, TJB wrote: On Saturday, 22 March 2014 at 16:35:07 UTC, Brian Rogoff wrote: This is a very interesting thread that you started. Could you flesh it out more with some example C++ that you'd like compared to D? I'm sure quite a few people would assist

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-03-22 Thread Daniel Davidson
On Saturday, 22 March 2014 at 11:46:43 UTC, Russel Winder wrote: It is also worth pointing out the LMAX Disruptor which is a lock-free ring buffer based framework used to create dealing platforms on the JVM. They outperform any other trading platform still. That is wrong. Trading is

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-03-22 Thread Daniel Davidson
On Saturday, 22 March 2014 at 12:35:50 UTC, Saurabh Das wrote: You are absolutely correct - the finance industry _wants_ to switch away fromC++. I work in a fledgeling HFT startup firm and we are actively pursuing D. We have tested it out in a live trading environment and the results are very

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-03-22 Thread Daniel Davidson
On Saturday, 22 March 2014 at 12:06:37 UTC, Russel Winder wrote: I suspect a rewrite of QuantLib in D is a bad idea, much better to create an adapter and offer it to the QuantLib folks. The ones they have already tend to be created using SWIG. JQuantLib is an attempt to rewrite QuantLib in

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-03-22 Thread Daniel Davidson
On Saturday, 22 March 2014 at 12:54:11 UTC, Paulo Pinto wrote: Am 22.03.2014 13:38, schrieb Daniel Davidson: On Saturday, 22 March 2014 at 11:46:43 UTC, Russel Winder wrote: It is also worth pointing out the LMAX Disruptor which is a lock-free ring buffer based framework used to create

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-03-22 Thread Daniel Davidson
On Saturday, 22 March 2014 at 13:36:01 UTC, Saurabh Das wrote: The edge for D in our case comes from 3 factors - 1. A lot of statistical data from older C++ systems means better assumptions and decisions in the new D system; and But, clearly that is not necessarily a benefit of D. It is a

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-03-22 Thread Daniel Davidson
On Saturday, 22 March 2014 at 13:47:31 UTC, Paulo Pinto wrote: Assuming those 10% still happen if the test was done today as suggested, how much are trade companies willing to pay for developers to achieve those 10% in C++ vs having a system although 10% slower, still fast enough for

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-03-22 Thread Daniel Davidson
On Saturday, 22 March 2014 at 14:33:02 UTC, TJB wrote: Well, I for one, would be hugely interested in such a thing. A nice D API to HDF5 would be a dream for my data problems. Did you use HDF5 in your finance industry days then? Just curious. A bit. You can check out some of my C++ code

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-03-21 Thread Daniel Davidson
On Friday, 21 March 2014 at 21:14:15 UTC, TJB wrote: Walter, I see that you will be discussing High Performance Code Using D at the 2014 DConf. This will be a very welcomed topic for many of us. I am a Finance Professor. I currently teach and do research in computational finance. Might I

Re: Walter's DConf 2014 Talks - Topics in Finance

2014-03-21 Thread Daniel Davidson
On Saturday, 22 March 2014 at 00:34:22 UTC, TJB wrote: On Saturday, 22 March 2014 at 00:14:11 UTC, Daniel Davidson wrote: On Friday, 21 March 2014 at 21:14:15 UTC, TJB wrote: Walter, I see that you will be discussing High Performance Code Using D at the 2014 DConf. This will be a very

Re: If you had money to place for a bounty, what would you choose?

2014-01-26 Thread Daniel Davidson
On Saturday, 11 January 2014 at 03:19:14 UTC, Brad Anderson wrote: On Wednesday, 4 December 2013 at 14:12:11 UTC, Daniel Davidson wrote: On Wednesday, 4 December 2013 at 09:34:27 UTC, Joseph Rushton Wakeling wrote: On 28/11/13 22:01, Fra wrote: What would your choice be? A really good

Re: If you had money to place for a bounty, what would you choose?

2013-12-04 Thread Daniel Davidson
On Wednesday, 4 December 2013 at 09:34:27 UTC, Joseph Rushton Wakeling wrote: On 28/11/13 22:01, Fra wrote: What would your choice be? A really good overhaul of the website, forums etc. from a UI/UX perspective. A good number of the problems we have with D aren't problems with the language

Re: If you had money to place for a bounty, what would you choose?

2013-12-04 Thread Daniel Davidson
On Wednesday, 4 December 2013 at 16:21:25 UTC, Andrei Alexandrescu wrote: On 12/4/13 6:12 AM, Daniel Davidson wrote: On Wednesday, 4 December 2013 at 09:34:27 UTC, Joseph Rushton Wakeling wrote: On 28/11/13 22:01, Fra wrote: What would your choice be? A really good overhaul of the website

Re: Deep copy or clone data structure (or object ?)

2013-12-02 Thread Daniel Davidson
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

Re: Checking function parameters in Phobos

2013-11-21 Thread Daniel Davidson
On Wednesday, 20 November 2013 at 18:30:58 UTC, Dmitry Olshansky wrote: And it decays to the naked type in a blink of an eye. And some function down the road will do the validation again... Not if that function down the road only accepted validated in the first place because that is what

Re: pure-ifying my code

2013-11-18 Thread Daniel Davidson
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.

how use lowerBound with just sorting key, not complete values

2013-11-12 Thread Daniel Davidson
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

Re: how use lowerBound with just sorting key, not complete values

2013-11-12 Thread Daniel Davidson
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

Re: how use lowerBound with just sorting key, not complete values

2013-11-12 Thread Daniel Davidson
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

Re: DIP49 - Define qualified postblit

2013-11-10 Thread Daniel Davidson
On Sunday, 10 November 2013 at 06:46:47 UTC, Kenji Hara wrote: http://wiki.dlang.org/DIP49 Experimental compiler/druntime patches (WIP, 80% completed): https://github.com/9rnsr/dmd/tree/qual_pblit https://github.com/9rnsr/druntime/tree/qual_pblit Kenji Hara Does the analysis hold up the same

Re: DIP49 - Define qualified postblit

2013-11-10 Thread Daniel Davidson
On Sunday, 10 November 2013 at 13:46:20 UTC, Kenji Hara wrote: 2013/11/10 Daniel Davidson nos...@spam.com With this design, is there no need then for struct constructors - or would this be orthogonal or in addition to those? Currently constructing unique object is already supported. http

Re: is there a merge for associative arrays

2013-11-09 Thread Daniel Davidson
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.

Re: Parallel Rogue-like benchmark

2013-11-07 Thread Daniel Davidson
On Thursday, 7 November 2013 at 13:12:56 UTC, bearophile wrote: Marco Leise: I made it idiomatic, D is on place 1 now by a big margin. See the 'ldc2' entry: http://togototo.wordpress.com/2013/08/23/benchmarks-round-two-parallel-go-rust-d-scala-and-nimrod/ Very nice. I have made a more

Re: D vs Go in real life

2013-11-06 Thread Daniel Davidson
On Wednesday, 6 November 2013 at 08:22:36 UTC, Bienlein wrote: Then have a look at this thread in the Scala user forum: https://groups.google.com/forum/?hl=de#!topic/scala-user/D9QDOnHSUu8 It is about build times in Scala not scaling up. One reply was Do you have very fast SSDs in your

Re: proposal: a new string litteral to embed variables in a string

2013-11-06 Thread Daniel Davidson
On Wednesday, 6 November 2013 at 21:37:14 UTC, Dmitry Olshansky wrote: 07-Nov-2013 01:02, Timothee Cour пишет: To those who don't see the use of this: which code would you rather read write? see pastebin: http://dpaste.dzfl.pl/b9f65a39 Another advantage is that using an autoformatter won't

Re: proposal: a new string litteral to embed variables in a string

2013-11-06 Thread Daniel Davidson
On Wednesday, 6 November 2013 at 22:33:36 UTC, H. S. Teoh wrote: Challenge accepted. ;-) Here is an adaptation of Dmitri's code that doesn't require you to explicitly pass in variables: ... Is that acceptable to you? :) Good stuff. Of course, the above code is just a proof-of-concept; it

Re: fieldPostBlit - what is wrong with this and workarounds

2013-11-06 Thread Daniel Davidson
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

Re: How to re-initialise an associative array.

2013-11-06 Thread Daniel Davidson
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;

Re: How to re-initialise an associative array.

2013-11-06 Thread Daniel Davidson
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!

Re: How to re-initialise an associative array.

2013-11-06 Thread Daniel Davidson
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

Re: How to iterate through all modules for use with the new getUnitTests trait?

2013-11-06 Thread Daniel Davidson
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

Re: is this an instance of the 16-byte struct bug

2013-11-05 Thread Daniel Davidson
On Tuesday, 5 November 2013 at 09:34:47 UTC, John Colvin wrote: Can't reproduce on Git master x86_64 linux. Prints 0 no matter what flags are used. Mac - OS X 10.9 (13A603) dmd -v DMD64 D Compiler v2.064 Copyright (c) 1999-2013 by Digital Mars written by Walter Bright bash-3.2$ rdmd

Re: is this an instance of the 16-byte struct bug

2013-11-05 Thread Daniel Davidson
On Tuesday, 5 November 2013 at 00:16:11 UTC, deadalnix wrote: I'm not sure what DMD is trying to do, but the function call to writefln is clearly wrong. Strange bug. FWIW adding a constructor `this(immutable(int)[] data) { _data = data; }` seems to be a workaround. Thanks Dan

Re: is this an instance of the 16-byte struct bug

2013-11-05 Thread Daniel Davidson
On Tuesday, 5 November 2013 at 00:16:11 UTC, deadalnix wrote: I'm not sure what DMD is trying to do, but the function call to writefln is clearly wrong. Strange bug. FWIW adding a constructor `this(immutable(int)[] data) { _data = data; }` seems to be a workaround. Thanks Dan

Re: proposal: a new string litteral to embed variables in a string

2013-11-05 Thread Daniel Davidson
On Tuesday, 5 November 2013 at 22:26:23 UTC, Timothee Cour wrote: Frankly, this is bike shedding though; let's assume we pick one in http://www.ascii-code.com/ and focus on whether we can agree on this feature. I'm using it extensively for great benefit: more DRY code, less spurious files,

is there a merge for associative arrays

2013-11-05 Thread Daniel Davidson
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]

Re: is this an instance of the 16-byte struct bug

2013-11-04 Thread Daniel Davidson
Ok - pretty sure this is not related to 16-byte structs, since if I just remove one of the fields it still crashes. I opened an issue - and here is a simplified version: http://d.puremagic.com/issues/show_bug.cgi?id=11440 import std.stdio; struct Y { private immutable(int)[] _data; }

is this an instance of the 16-byte struct bug

2013-11-02 Thread Daniel Davidson
and what is the 16 byte struct bug? http://forum.dlang.org/post/nqqujtblyvxvtrlsb...@forum.dlang.org import std.datetime; import std.range; import std.stdio; struct DateRate { Date date; double value = 0.0; } struct RateCurve { private immutable(DateRate)[] _data; } struct CFS {

Re: proposal: a new string litteral to embed variables in a string

2013-11-02 Thread Daniel Davidson
On Thursday, 31 October 2013 at 21:24:42 UTC, Timothee Cour wrote: I've actually already implemented this feature via a mixin, and find it extremely useful, but removing the mixing via this proposal would make it even more palatable. It works using a simple grammar that searches for valid

Re: is this invalid code

2013-11-01 Thread Daniel Davidson
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

Re: fieldPostBlit - what is wrong with this and workarounds

2013-11-01 Thread Daniel Davidson
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

Re: Linker error regarding importing and unit tests. Is this a bug?

2013-11-01 Thread Daniel Davidson
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

fieldPostBlit - what is wrong with this and workarounds

2013-10-31 Thread Daniel Davidson
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

structs holding on to reference data by pointer

2013-10-31 Thread Daniel Davidson
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() {

Re: fieldPostBlit - what is wrong with this and workarounds

2013-10-31 Thread Daniel Davidson
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

Re: fieldPostBlit - what is wrong with this and workarounds

2013-10-31 Thread Daniel Davidson
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

Re: structs holding on to reference data by pointer

2013-10-31 Thread Daniel Davidson
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

is this invalid code

2013-10-31 Thread Daniel Davidson
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

Re: Dynamic associative array, to hold many values per key

2013-10-29 Thread Daniel Davidson
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.

Re: conv text and pure

2013-10-28 Thread Daniel Davidson
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

Re: selectively running unittest functions

2013-10-26 Thread Daniel Davidson
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

Re: selectively running unittest functions

2013-10-26 Thread Daniel Davidson
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

Re: D Programming Language book - outdated, list of changes since?

2013-10-25 Thread Daniel Davidson
On Thursday, 24 October 2013 at 18:14:42 UTC, Jonathan M Davis wrote: On Wednesday, October 23, 2013 14:39:21 Suliman wrote: It would be great to have updated TDPL book... I don't understand why people keep saying that. Is it because people keep repeating that incorrect assumption that it's

Re: selectively running unittest functions

2013-10-25 Thread Daniel Davidson
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

Re: selectively running unittest functions

2013-10-25 Thread Daniel Davidson
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

Re: selectively running unittest functions

2013-10-25 Thread 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 pressing. Here is an updated version: http://pastebin.com/g6FWsTkr The idea is to be able to just import ut

proper way to find if attribute present?

2013-10-24 Thread Daniel Davidson
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

Re: this() immutable

2013-10-23 Thread Daniel Davidson
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

conv text and pure

2013-10-23 Thread Daniel Davidson
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

Re: conv text and pure

2013-10-23 Thread Daniel Davidson
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

Re: conv text and pure

2013-10-23 Thread Daniel Davidson
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

Re: conv text and pure

2013-10-23 Thread Daniel Davidson
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

Re: Proposal for a Rosettacode task

2013-10-19 Thread Daniel Davidson
On Saturday, 19 October 2013 at 10:58:11 UTC, bearophile wrote: Adam D. Ruppe: sure. I didn't format it but if you convert my tabs to spaces and maybe break up some long lines it should be good. Good, I have reformatted the code (I have chosen a narrow 72/73 line width for the code in that

Re: Slices in D vs Go

2013-10-19 Thread Daniel Davidson
On Saturday, 19 October 2013 at 04:52:31 UTC, Jesse Phillips wrote: Do to the recent slices discussion I did some investigation on what is different in Go. Thus, created this http://he-the-great.livejournal.com/48672.html It starts with: int[] original; original.reserve(5);

Re: Slices in D vs Go

2013-10-19 Thread Daniel Davidson
On Saturday, 19 October 2013 at 12:08:49 UTC, Daniel Davidson wrote: On Saturday, 19 October 2013 at 04:52:31 UTC, Jesse Phillips wrote: Do to the recent slices discussion I did some investigation on what is different in Go. Thus, created this http://he-the-great.livejournal.com/48672.html

Re: matrix business in D

2013-10-18 Thread Daniel Davidson
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

how would D be different if string were const(char)[]?

2013-10-17 Thread Daniel Davidson
If it would be no different then why prefer immutable(char)[] for string?

Re: mutable, const, immutable guidelines

2013-10-17 Thread Daniel Davidson
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

Re: how would D be different if string were const(char)[]?

2013-10-17 Thread Daniel Davidson
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

surprised by link error

2013-10-16 Thread Daniel Davidson
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

Re: this() immutable

2013-10-16 Thread Daniel Davidson
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

does cast make an lvalue appear to be an rvalue

2013-10-16 Thread Daniel Davidson
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

Re: mutable, const, immutable guidelines

2013-10-16 Thread Daniel Davidson
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

Re: does cast make an lvalue appear to be an rvalue

2013-10-16 Thread Daniel Davidson
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

Re: does cast make an lvalue appear to be an rvalue

2013-10-16 Thread Daniel Davidson
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

Re: does cast make an lvalue appear to be an rvalue

2013-10-16 Thread Daniel Davidson
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

Re: does cast make an lvalue appear to be an rvalue

2013-10-16 Thread Daniel Davidson
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

Re: mutable, const, immutable guidelines

2013-10-16 Thread Daniel Davidson
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

Re: mutable, const, immutable guidelines

2013-10-16 Thread Daniel Davidson
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 /

Re: mutable, const, immutable guidelines

2013-10-16 Thread Daniel Davidson
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

Re: mutable, const, immutable guidelines

2013-10-16 Thread Daniel Davidson
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

Re: this() immutable

2013-10-16 Thread Daniel Davidson
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

Re: does cast make an lvalue appear to be an rvalue

2013-10-16 Thread Daniel Davidson
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

Re: does cast make an lvalue appear to be an rvalue

2013-10-16 Thread Daniel Davidson
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

Re: objects as AA keys

2013-10-15 Thread Daniel Davidson
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

should chain be pure

2013-10-15 Thread 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? The relevant section of code is: ... auto sortedRage = assumeSorted!(a.when b.when)(opSlice()); auto trisection =

Re: should chain be pure

2013-10-15 Thread Daniel Davidson
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

Re: The no gc crowd

2013-10-10 Thread Daniel Davidson
On Thursday, 10 October 2013 at 17:36:11 UTC, Joseph Rushton Wakeling wrote: On 10/10/13 19:31, Jonathan M Davis wrote: I'm honestly surprised that Andrei is rejecting the idea of casting to/from shared or immutable being normal given how it's required by our current concurrency model. And

Re: The no gc crowd

2013-10-10 Thread Daniel Davidson
On Thursday, 10 October 2013 at 17:39:55 UTC, Sean Kelly wrote: On Oct 10, 2013, at 10:23 AM, Joseph Rushton Wakeling joseph.wakel...@webdrake.net wrote: On 09/10/13 06:25, Andrei Alexandrescu wrote: The way I see it we must devise a robust solution to that, NOT consider the state of the

Re: The no gc crowd

2013-10-10 Thread Daniel Davidson
On Friday, 11 October 2013 at 00:30:35 UTC, Simen Kjaeraas wrote: Here's a COW reference type that I can easily pass to a function requiring a mutable version of the type: struct S { immutable(int)[] arr; } And usage: void foo(S s) {} void main() { const S s; foo(s); }

  1   2   >