Re: Program logic bugs vs input/environmental errors

2014-09-28 Thread luka8088 via Digitalmars-d
On 28.9.2014. 1:15, Walter Bright wrote: This issue comes up over and over, in various guises. I feel like Yosemite Sam here: https://www.youtube.com/watch?v=hBhlQgvHmQ0 In that vein, Exceptions are for either being able to recover from input/environmental errors, or report them to the

Re: Program logic bugs vs input/environmental errors

2014-09-28 Thread luka8088 via Digitalmars-d
On 28.9.2014. 21:32, Walter Bright wrote: On 9/28/2014 11:25 AM, bearophile wrote: Exceptions are often used to help debugging... https://www.youtube.com/watch?v=hBhlQgvHmQ0 Example exception messages: Unable to connect to database Invalid argument count Invalid network package format

Re: RFC: reference counted Throwable

2014-09-22 Thread luka8088 via Digitalmars-d
On 21.9.2014. 22:57, Peter Alexander wrote: On Sunday, 21 September 2014 at 19:36:01 UTC, Nordlöw wrote: On Friday, 19 September 2014 at 15:32:38 UTC, Andrei Alexandrescu wrote: Please chime in with thoughts. Why don't we all focus our efforts on upgrading the current GC to a state-of-the GC

Re: Memory allocation purity

2014-05-15 Thread luka8088 via Digitalmars-d
On 15.5.2014. 8:58, Jonathan M Davis via Digitalmars-d wrote: On Thu, 15 May 2014 05:51:14 + via Digitalmars-d digitalmars-d@puremagic.com wrote: Yep, purity implies memoing. No, it doesn't. _All_ that it means when a function is pure is that it cannot access global or static

Re: Memory allocation purity

2014-05-15 Thread luka8088 via Digitalmars-d
On 15.5.2014. 11:35, Jonathan M Davis via Digitalmars-d wrote: On Thu, 15 May 2014 10:14:48 +0200 luka8088 via Digitalmars-d digitalmars-d@puremagic.com wrote: On 15.5.2014. 8:58, Jonathan M Davis via Digitalmars-d wrote: On Thu, 15 May 2014 05:51:14 + via Digitalmars-d digitalmars-d

Re: Memory allocation purity

2014-05-15 Thread luka8088 via Digitalmars-d
On 15.5.2014. 11:45, Don wrote: On Thursday, 15 May 2014 at 08:14:50 UTC, luka8088 wrote: On 15.5.2014. 8:58, Jonathan M Davis via Digitalmars-d wrote: On Thu, 15 May 2014 05:51:14 + via Digitalmars-d digitalmars-d@puremagic.com wrote: Yep, purity implies memoing. No, it doesn't. _All_

Re: Memory allocation purity

2014-05-15 Thread luka8088 via Digitalmars-d
On 15.5.2014. 12:48, Don wrote: On Thursday, 15 May 2014 at 10:31:47 UTC, luka8088 wrote: On 15.5.2014. 11:45, Don wrote: On Thursday, 15 May 2014 at 08:14:50 UTC, luka8088 wrote: On 15.5.2014. 8:58, Jonathan M Davis via Digitalmars-d wrote: On Thu, 15 May 2014 05:51:14 + via Digitalmars

Re: Memory allocation purity

2014-05-15 Thread luka8088 via Digitalmars-d
On 15.5.2014. 13:04, Jonathan M Davis via Digitalmars-d wrote: On Thu, 15 May 2014 10:48:07 + Don via Digitalmars-d digitalmars-d@puremagic.com wrote: Yes. 'strong pure' means pure in the way that the functional language crowd means 'pure'. 'weak pure' just means doesn't use globals.

Re: Memory allocation purity

2014-05-15 Thread luka8088 via Digitalmars-d
On 15.5.2014. 17:24, Andrei Alexandrescu wrote: On 5/15/14, 3:31 AM, luka8088 wrote: Yeah, I read all about weak/string purity and I do understand the background. I was talking about strong purity, maybe I should pointed that out. So, to correct myself: As I understood strong purity implies

Re: range behaviour

2014-05-13 Thread luka8088 via Digitalmars-d
On 13.5.2014. 19:40, H. S. Teoh via Digitalmars-d wrote: On Tue, May 13, 2014 at 01:29:32PM -0400, Steven Schveighoffer via Digitalmars-d wrote: [...] Even in this case, I'd put an in-contract on f2 that verifies that the range is indeed non-empty: ... void f2(R)(R r)

Re: Livestreaming DConf?

2014-05-10 Thread luka8088 via Digitalmars-d-announce
On 9.5.2014. 21:48, Andrei Alexandrescu wrote: Hi folks, We at Facebook are very excited about the upcoming DConf 2014. In fact, so excited we're considering livestreaming the event for the benefit of the many of us who can't make it to Menlo Park, CA. Livestreaming entails additional

Re: More radical ideas about gc and reference counting

2014-05-09 Thread luka8088 via Digitalmars-d
On 6.5.2014. 20:10, Walter Bright wrote: On 5/6/2014 10:47 AM, Manu via Digitalmars-d wrote: On 7 May 2014 01:46, Andrei Alexandrescu via Digitalmars-d I'm not even sure what the process it... if I go through and LGTM a bunch of pulls, does someone accept my judgement and click the merge

Re: From slices to perfect imitators: opByValue

2014-05-07 Thread luka8088 via Digitalmars-d
On 8.5.2014. 5:58, Andrei Alexandrescu wrote: This magic of T[] is something that custom ranges can't avail themselves of. In order to bring about parity, we'd need to introduce opByValue which (if present) would be automatically called whenever the object is passed by value into a function.

Re: Soon Nick will be $75 richer...

2014-03-18 Thread luka8088
On 18.3.2014. 21:28, Andrei Alexandrescu wrote: ... pending Martin's approval. https://d.puremagic.com/issues/show_bug.cgi?id=3490 https://www.bountysource.com/issues/1327154-dmd-never-inlines-functions-that-could-throw https://d.puremagic.com/issues/show_bug.cgi?id=3490 Andrei I

Re: null dereference

2014-03-16 Thread luka8088
On 16.3.2014. 0:22, Jonathan M Davis wrote: On Saturday, March 15, 2014 11:05:42 luka8088 wrote: I was thinking and I am not sure about the reason for not having some king of safeguard for null dereferencing in version(assert)/debug builds. One possible reason that comes to mind

Re: TLBB: The Last Big Breakage

2014-03-16 Thread luka8088
On 16.3.2014. 5:08, Andrei Alexandrescu wrote: D1's approach to multithreading was wanting. D2 executed a big departure from that with the shared qualifier and the default-thread-local approach to data. We think this is a win, but D2 inherited a lot of D1's thread-related behavior by

null dereference

2014-03-15 Thread luka8088
I was thinking and I am not sure about the reason for not having some king of safeguard for null dereferencing in version(assert)/debug builds. One possible reason that comes to mind is that it somewhat affects performance but should this really be an issue in version(assert)/debug build?

Re: null dereference

2014-03-15 Thread luka8088
On 15.3.2014. 12:25, bearophile wrote: luka8088: I was thinking and I am not sure about the reason for not having some king of safeguard for null dereferencing in version(assert)/debug builds. Eventually reference deference in D will be guarded by an assert in non-release builds

Re: double.init is nan ..?

2014-03-15 Thread luka8088
On 14.3.2014. 17:04, Etienne wrote: I'm trying to compare two doubles as part of a cache framework. To put it simply, double.init == double.init ... is false? Note that you should not compare floating point types for equality! http://www.parashift.com/c++-faq/floating-point-arith.html

Re: null dereference

2014-03-15 Thread luka8088
On 15.3.2014. 16:37, Adam D. Ruppe wrote: There is a hidden module on Linux which can activate this, sort of: void main() { // these two lines turn it on import etc.linux.memoryerror; registerMemoryErrorHandler(); Object o = null; o.toString(); // trigger it here }

Re: null dereference

2014-03-15 Thread luka8088
On 15.3.2014. 14:34, Ary Borenszweig wrote: On 3/15/14, 8:25 AM, bearophile wrote: luka8088: I was thinking and I am not sure about the reason for not having some king of safeguard for null dereferencing in version(assert)/debug builds. Eventually reference deference in D will be guarded

Re: Final by default?

2014-03-13 Thread luka8088
On 13.3.2014. 0:48, Walter Bright wrote: On 3/12/2014 4:01 PM, luka8088 wrote: How do you nearly lose a client over a change in a development branch which was never a part of any release? (or am I mistaken?) The change went into a release. I see, that indeed is an issue.

Re: Final by default?

2014-03-12 Thread luka8088
On 12.3.2014. 23:50, Walter Bright wrote: But we nearly lost a major client over it. How do you nearly lose a client over a change in a development branch which was never a part of any release? (or am I mistaken?) You seem to have a very demanding clients :) On a side thought, maybe there

Re: hiding a class property behind a method

2014-02-23 Thread luka8088
On 22.2.2014. 23:43, simendsjo wrote: On 02/22/2014 11:33 PM, Francesco Cattoglio wrote: The problem isn't about optional parenthesis or properties. It's the fact that you can redefine a symbol to be something entierly different, and that this difference will only be seen if you are looking

Re: hiding a class property behind a method

2014-02-23 Thread luka8088
On 23.2.2014. 13:51, luka8088 wrote: That is exactly what I wanted to point out! I reduced the example code to make that point more obvious: Just one note. I know how this works currently in D and how it works in C++. What I am asking here is not how it works but is this a good idea as I just

hiding a class property behind a method

2014-02-22 Thread luka8088
It seems to me that the following code should be illegal, but I am uncertain of it so I am posting here for a confirmation before I post it on bug tracker: http://dpaste.dzfl.pl/dae728734cc6 import std.stdio; class A { string x () { return A; }; } class B : A { override string x () {

Re: Testing some singleton implementations

2014-02-10 Thread luka8088
On 10.2.2014. 10:52, Andrej Mitrovic wrote: On 2/9/14, luka8088 luka8...@owave.net wrote: What about swapping function pointer so the check is done only once per thread? (Thread is tldr so I am sorry if someone already suggested this) Interesting solution for sure. // tls @property

Re: Testing some singleton implementations

2014-02-10 Thread luka8088
On 10.2.2014. 10:54, Andrej Mitrovic wrote: On 2/9/14, luka8088 luka8...@owave.net wrote: private static __gshared typeof(this) instance_; Also, static __gshared is really meaningless here, it's either static (TLS), or globally shared, either way it's not a class instance, so you can type

Re: Testing some singleton implementations

2014-02-10 Thread luka8088
On 10.2.2014. 10:59, Andrej Mitrovic wrote: On 2/9/14, luka8088 luka8...@owave.net wrote: dmd -release -inline -O -noboundscheck -unittest -run singleton.d Test time for LockSingleton: 901 msecs. Test time for SyncSingleton: 20.75 msecs. Test time for AtomicSingleton: 169 msecs. Test time

Re: Testing some singleton implementations

2014-02-10 Thread luka8088
On 10.2.2014. 13:44, luka8088 wrote: On 10.2.2014. 10:54, Andrej Mitrovic wrote: On 2/9/14, luka8088 luka8...@owave.net wrote: private static __gshared typeof(this) instance_; Also, static __gshared is really meaningless here, it's either static (TLS), or globally shared, either way it's

Re: Testing some singleton implementations

2014-02-09 Thread luka8088
On 31.1.2014. 9:25, Andrej Mitrovic wrote: There was a nice blog-post about implementing low-lock singletons in D, here: http://davesdprogramming.wordpress.com/2013/05/06/low-lock-singletons/ One suggestion on Reddit was by dawgfoto (I think this is Martin Nowak?), to use atomic primitives

Re: Testing some singleton implementations

2014-02-09 Thread luka8088
On 9.2.2014. 15:09, Stanislav Blinov wrote: On Sunday, 9 February 2014 at 12:20:54 UTC, luka8088 wrote: What about swapping function pointer so the check is done only once per thread? (Thread is tldr so I am sorry if someone already suggested this) That is an interesting idea indeed

Re: Testing some singleton implementations

2014-02-09 Thread luka8088
On 9.2.2014. 19:51, Stanislav Blinov wrote: On Sunday, 9 February 2014 at 18:06:46 UTC, Martin Nowak wrote: On 02/09/2014 01:20 PM, luka8088 wrote: class FunctionPointerSingleton { private static __gshared typeof(this) instance_; // tls @property static typeof(this) function () get

Re: Idea #1 on integrating RC with GC

2014-02-06 Thread luka8088
On 5.2.2014. 0:51, Andrei Alexandrescu wrote: Consider we add a library slice type called RCSlice!T. It would have the same primitives as T[] but would use reference counting through and through. When the last reference count is gone, the buffer underlying the slice is freed. The underlying

Re: Compiling dmd on Windows

2014-02-01 Thread luka8088
On 1.2.2014. 10:40, luka8088 wrote: On 1.2.2014. 9:13, Paulo Pinto wrote: Hi, is there any page on how to compile the whole dmd, druntime and phobos on Windows? I am facing a few issues with me hacking around win32.mak files, related to tools location, missing tools(detab) and expected

Re: extend in to all array types

2014-01-15 Thread luka8088
On 15.1.2014. 16:30, pplantinga wrote: In python, I really like the ability to check if an element is in an array: if x in array: # do something D has this, but only for associative arrays. Is there any chance we could extend this to every kind of array? D array uses this operator for

Re: [OT] Efficient file structure for very large lookup tables?

2013-12-17 Thread luka8088
On 17.12.2013. 20:08, H. S. Teoh wrote: Another OT thread to pick your brains. :) What's a good, efficient file structure for storing extremely large lookup tables? (Extremely large as in 10 million entries, with keys and values roughly about 100 bytes each.) The structure must support

global vs context variable

2013-12-11 Thread luka8088
Hi everyone! I would like to address the issue of global variables (or states). In general my opinion is that they are bad solely because they (in most cases) lack the ability of alternative values (or states) or ability to alter them in user friendly way. For example, take write function from

Re: global vs context variable

2013-12-11 Thread luka8088
On 11.12.2013. 9:30, monarch_dodra wrote: write is really just a global helper/shortcut function that calls stdout.write. If the user wants to customize this, then it's really no more complicated than doing a write to a named stream, which represents the global out, which may or may not be

Re: global vs context variable

2013-12-11 Thread luka8088
On 11.12.2013. 10:53, QAston wrote: This issue is probably nearly as old as programming itself. There are several sollutions already developed: dependency injection (requires complex configuration rules), manually passing deps as args (cumbersome), service locator or global variables. Yeah,

Re: global vs context variable

2013-12-11 Thread luka8088
On 11.12.2013. 12:14, Shammah Chancellor wrote: On 2013-12-11 08:21:35 +, luka8088 said: Examples using such library: void writeOutput () { writeln(example output); } void main () { writeOutput(); standardOutputContext(file(example.txt), { writeOutput

Re: global vs context variable

2013-12-11 Thread luka8088
On 11.12.2013. 15:47, monarch_dodra wrote: On Wednesday, 11 December 2013 at 12:58:54 UTC, luka8088 wrote: Yeah, and it always keeps pooping right up! I hate it when issues just keep pooping up. So rude! Lol, popping xD

Re: Using cast(enum) for explicit request of ctfe

2013-12-04 Thread luka8088
On 4.12.2013. 12:12, monarch_dodra wrote: I love D's ctfe capabilities. They allow using complex values, with no run-time cost, and at a very low code cost. One thing that does kind of get on my nerves is how you *always* have to declare an actual enum to do that. You can't do CTFE on the

Re: Using cast(enum) for explicit request of ctfe

2013-12-04 Thread luka8088
On 4.12.2013. 12:41, monarch_dodra wrote: On Wednesday, 4 December 2013 at 11:32:40 UTC, Jakob Ovrum wrote: On Wednesday, 4 December 2013 at 11:12:54 UTC, monarch_dodra wrote: Or, if somebody has an idea of how to do this via a library solution? alias eval(alias exp) = exp; Nice :D Very

Re: Using cast(enum) for explicit request of ctfe

2013-12-04 Thread luka8088
On 4.12.2013. 13:08, Jakob Ovrum wrote: On Wednesday, 4 December 2013 at 11:54:08 UTC, luka8088 wrote: Eval comes from examples of http://dlang.org/function.html#interpretation A couple of notes: The use of a variadic template parameter instead of an alias parameter is misleading because

Re: Using cast(enum) for explicit request of ctfe

2013-12-04 Thread luka8088
On 4.12.2013. 16:28, monarch_dodra wrote: On Wednesday, 4 December 2013 at 13:45:35 UTC, Jakob Ovrum wrote: On Wednesday, 4 December 2013 at 13:16:35 UTC, monarch_dodra wrote: Problem is that doing this returns an immutable type, which isn't quite the same as a ctfe variable (which was the

Re: mutexes (mutices?) and TLS

2013-12-03 Thread luka8088
On 2.12.2013. 17:44, Torje Digernes wrote: On Monday, 2 December 2013 at 12:09:34 UTC, Artem Tarasov wrote: Yes, global variables are thread-local by default. Use shared or _gshared qualifier. I guess such questions belong to D.learn. Is this really desired behaviour for mutexes? Since

Re: Duplicate keys in array literals?

2013-11-28 Thread luka8088
On 28.11.2013. 12:23, bearophile wrote: Is it a good idea to silently statically accept duplicated keys in both dynamic array literals and in associative array literals? void main() { int[] a = [0:10, 0:20]; int[int] aa = [0:10, 0:20]; } I don't remember having ever had

Re: Duplicate keys in array literals?

2013-11-28 Thread luka8088
On 28.11.2013. 21:01, Jacob Carlborg wrote: On 2013-11-28 18:55, luka8088 wrote: PHP also allows it: $data = array('a' = 1, 'a' = 2); And I find it to be only a source of bugs. Arrays are a weird beast in PHP. They're both arrays and associative arrays, at the same time, somehow

Re: DIP 50 - AST macros

2013-11-23 Thread luka8088
On 23.11.2013. 11:40, Jacob Carlborg wrote: On Friday, 22 November 2013 at 23:43:26 UTC, luka8088 wrote: Then q{ } or [ ] would be very limited. Not even templets need to contain semantically valid code, as long as it's not instantiated. Usually the idea with AST macros is to take code

Re: DIP 50 - AST macros

2013-11-22 Thread luka8088
On 21.11.2013. 9:31, Jacob Carlborg wrote: On 2013-11-21 09:01, luka8088 wrote: When using q{} compiler treats the contents as a regular string, and you have to parse it and give it to the compiler using mixin. So basically you can say to the compiler: this part of code is my DSL and I

Re: DIP 50 - AST macros

2013-11-22 Thread luka8088
On 21.11.2013. 8:28, Jacob Carlborg wrote: On 2013-11-20 23:25, luka8088 wrote: The point of this example is that mixin() accepts Ast instead of string. That way, we parse our DSL to D Ast and give it straight to the compiler and everything is done only once! So how is this different

Re: DIP 50 - AST macros

2013-11-22 Thread luka8088
On 22.11.2013. 11:19, Jacob Carlborg wrote: On 2013-11-22 10:44, luka8088 wrote: What we currently have: I should have been t{ }. I do understand the difference between t{ } and q{ }. But not between [ ] and t{ }. Is it just two different syntaxes for the same? Yes. t

Re: DIP 50 - AST macros

2013-11-22 Thread luka8088
On 22.11.2013. 11:17, Jacob Carlborg wrote: On 2013-11-22 10:27, luka8088 wrote: Um, my it's suppose to be the same as [ ... ] but I liked t{ ... } syntax better as it looked more consistent with what D already has. But I should have used [ ... ] , my mistake sorry. I thought you argued

Re: DIP 50 - AST macros

2013-11-21 Thread luka8088
On 21.11.2013. 8:28, Jacob Carlborg wrote: On 2013-11-20 23:25, luka8088 wrote: If I understood you correctly, the issue with current way DSLs are implemented is that code needs to be parsed two times. First time DSL author parses it and creates D code from it, and second time D compiler

Re: DIP 50 - AST macros

2013-11-20 Thread luka8088
On 20.11.2013. 9:04, Jacob Carlborg wrote: On 2013-11-19 21:54, luka8088 wrote: Well, do think about that :) auto f = e = e.name == John; if (true) f = e = e.name == Jack; auto person = Person.where(f); I can think of a many use cases where conditional query generation is required

Re: @property (again)

2013-11-20 Thread luka8088
On 21.11.2013. 6:59, Jesse Phillips wrote: On Thursday, 21 November 2013 at 03:37:19 UTC, Manu wrote: On 21 November 2013 13:27, Adam D. Ruppe destructiona...@gmail.com wrote: On Thursday, 21 November 2013 at 03:14:30 UTC, Manu wrote: I personally think () should not be optional No.

Re: @property (again)

2013-11-20 Thread luka8088
On 21.11.2013. 7:06, Walter Bright wrote: On 11/20/2013 7:14 PM, Manu wrote: It would be nice to have a commitment on @property. Currently, () is optional on all functions, and @property means nothing. I personally think () should not be optional, and @property should require that () is not

Re: @property (again)

2013-11-20 Thread luka8088
On 21.11.2013. 4:14, Manu wrote: It would be nice to have a commitment on @property. Currently, () is optional on all functions, and @property means nothing. I personally think () should not be optional, and @property should require that () is not present (ie, @property has meaning). This

Re: DIP 50 - AST macros

2013-11-19 Thread luka8088
On 13.11.2013. 13:47, Jacob Carlborg wrote: On 2013-11-13 09:15, luka8088 wrote: I think that string concatenation is enough (at least for now), and if you want another syntax for templates you can write a macro for that. Strings are far from enough. Then you have missed the whole idea. It's

Re: DIP 50 - AST macros

2013-11-19 Thread luka8088
On 18.11.2013. 6:05, Walter Bright wrote: On 11/17/2013 7:14 PM, deadalnix wrote: Ok, then I'm not seeing what AST macros do that lazy parameters / template overloading / mixin templates do not? Well, this is just a small piece of the puzzle but I would like to be able to write (as syntax

Re: DIP 50 - AST macros

2013-11-19 Thread luka8088
On 19.11.2013. 21:32, Jacob Carlborg wrote: On 2013-11-19 19:32, luka8088 wrote: Oh, I see. It seems that I indeed missed the point. It seems to me that this DIP could to be granulated into: AST reflection, AST manipulation and AST template. The reason for this, as far as I see

Re: Build Master: Scheduling

2013-11-15 Thread luka8088
On 14.11.2013. 10:55, Jacob Carlborg wrote: On 2013-11-14 09:39, luka8088 wrote: Just a wild thought... Maybe we can have monthly release and still keep it stable. Imagine this kind of release schedule: Month # 11 12 1 2 3 2.064

Re: Build Master: Scheduling

2013-11-15 Thread luka8088
On 15.11.2013. 0:22, Xavier Bigand wrote: Le 14/11/2013 09:39, luka8088 a écrit : On 14.11.2013. 5:29, Tyro[17] wrote: On 11/13/13, 11:06 PM, Brad Roberts wrote: On 11/13/13 7:13 PM, Tyro[17] wrote: On 11/13/13, 9:46 PM, Brad Roberts wrote: On 11/13/13 4:37 PM, Tyro[17] wrote: I'm

Re: Build Master: Scheduling

2013-11-15 Thread luka8088
On 15.11.2013. 11:01, Jacob Carlborg wrote: On 2013-11-15 10:16, luka8088 wrote: Yes. For example, if you have version 0.1, 0.2 and 0.3. And you find and fix a bug in 0.3 but you still wish to support backport for 0.2 and 0.1 that you indeed need to make 3 releases. 0.1.1, 0.2.1 and 0.3.1

Re: Build Master: Scheduling

2013-11-14 Thread luka8088
On 14.11.2013. 5:29, Tyro[17] wrote: On 11/13/13, 11:06 PM, Brad Roberts wrote: On 11/13/13 7:13 PM, Tyro[17] wrote: On 11/13/13, 9:46 PM, Brad Roberts wrote: On 11/13/13 4:37 PM, Tyro[17] wrote: I'm of the opinion, however, that the cycle should be six months long. This particular schedule

Re: DIP 50 - AST macros

2013-11-13 Thread luka8088
On 10.11.2013. 22:20, Jacob Carlborg wrote: I've been thinking quite long of how AST macros could look like in D. I've been posting my vision of AST macros here in the newsgroup a couple of times already. I've now been asked to create a DIP out of it, so here it is:

Re: DIP 50 - AST macros

2013-11-13 Thread luka8088
On 13.11.2013. 9:26, Jacob Carlborg wrote: On 2013-11-12 17:14, John Colvin wrote: oh, I see. Would AST macros really be enough to make this work in D? Arbitrary code is a huge feature space in D, including much that doesn't map well to anything outside of a relatively low-level language,

Re: DIP 50 - AST macros

2013-11-13 Thread luka8088
On 13.11.2013. 13:26, Jacob Carlborg wrote: On 2013-11-13 09:34, luka8088 wrote: What about something like this? class Person { macro where (Context context, Statement statement) { // ... } } auto foo = John; auto result = Person.where(e = e.name == foo); // is replaced

Re: DIP 50 - AST macros

2013-11-11 Thread luka8088
On 10.11.2013. 22:20, Jacob Carlborg wrote: I've been thinking quite long of how AST macros could look like in D. I've been posting my vision of AST macros here in the newsgroup a couple of times already. I've now been asked to create a DIP out of it, so here it is:

Re: Overflow-safe use of unsigned integral types

2013-11-10 Thread luka8088
On 10.11.2013. 12:10, Joseph Rushton Wakeling wrote: One of the challenges when working with unsigned types is that automatic wraparound and implicit conversion can combine to unpleasant effect. Consider e.g.: void foo(ulong n) { writeln(n); } void main()

Re: Aspect Oriented Programming in D

2013-10-30 Thread luka8088
On 30.10.2013. 5:05, Sumit Adhikari wrote: Dear All, I want to exploit D Language for Aspect Oriented Programming. I would like to have a discussion with people who have similar interest in D AOP and who possibly have implemented AOP in D. Would be great to have a productive

Re: Is -1 7 ?

2013-08-14 Thread luka8088
On 9.8.2013. 17:11, michaelc37 wrote: forgive me if i'm doing something stupid, i'm extremely tired and trying to avoid drinking coffee. void main() { int[] arr = [0, 1, 2, 3, 4, 5, 6]; //check 1 if (-1 arr.length) writefln(WTF - %d is greater than %d , -1, arr.length); else writefln(GOOD

Re: primitive value overflow

2013-05-29 Thread luka8088
On 24.5.2013. 1:58, bearophile wrote: Peter Alexander: What about code that relies on overflow? It's well-defined behaviour, so it should be expected that people rely on it (I certainly do sometimes) Do you rely on signed or unsigned overflow? My opinions on this topic have changed few

Re: primitive value overflow

2013-05-23 Thread luka8088
On 17.5.2013. 0:23, Marco Leise wrote: Am Thu, 16 May 2013 22:39:16 +0200 schrieb luka8088luka8...@owave.net: On 16.5.2013. 22:29, Andrej Mitrovic wrote: On Thursday, 16 May 2013 at 20:24:31 UTC, luka8088 wrote: Hello everyone. Today I ran into a interesting issue. I wrote auto offset

primitive value overflow

2013-05-16 Thread luka8088
Hello everyone. Today I ran into a interesting issue. I wrote auto offset = text1.length - text2.length; and in case text2 was longer then text1 I got something around 4294967291. So I opened an issue: http://d.puremagic.com/issues/show_bug.cgi?id=10093 I know that there is a perfectly

Re: primitive value overflow

2013-05-16 Thread luka8088
On 16.5.2013. 22:29, Andrej Mitrovic wrote: On Thursday, 16 May 2013 at 20:24:31 UTC, luka8088 wrote: Hello everyone. Today I ran into a interesting issue. I wrote auto offset = text1.length - text2.length; Yeah, I don't like these bugs either. In the meantime you can swap auto

Re: primitive value overflow

2013-05-16 Thread luka8088
On 16.5.2013. 22:35, Mr. Anonymous wrote: On Thursday, 16 May 2013 at 20:29:13 UTC, Andrej Mitrovic wrote: On Thursday, 16 May 2013 at 20:24:31 UTC, luka8088 wrote: Hello everyone. Today I ran into a interesting issue. I wrote auto offset = text1.length - text2.length; Yeah, I don't like

Re: @property - take it behind the woodshed and shoot it?

2013-01-26 Thread luka8088
On 24.1.2013 9:34, Walter Bright wrote: This has turned into a monster. We've taken 2 or 3 wrong turns somewhere. Perhaps we should revert to a simple set of rules. 1. Empty parens are optional. If there is an ambiguity with the return value taking (), the () go on the return value. 2. the: f

Re: @property - take it behind the woodshed and shoot it?

2013-01-25 Thread luka8088
On 24.1.2013 23:04, Andrei Alexandrescu wrote: On 1/24/13 4:56 PM, Adam Wilson wrote: Simplicity is clearly good, but there's something to be said about those warts in chained calls. The UFCS-enabled idioms clearly bring a strong argument to the table, there's no ignoring it. Andrei Then

Re: Something needs to happen with shared, and soon.

2012-11-15 Thread luka8088
On 15.11.2012 11:52, Manu wrote: On 15 November 2012 12:14, Jacob Carlborg d...@me.com mailto:d...@me.com wrote: On 2012-11-15 10:22, Manu wrote: Not to repeat my prev post... but in reply to Walter's take on it, it would be interesting if 'shared' just added

Re: Const ref and rvalues again...

2012-11-14 Thread luka8088
On 13.11.2012 15:07, martin wrote: On Tuesday, 13 November 2012 at 08:34:19 UTC, luka8088 wrote: Your proposal isn't really related to this thread's topic Um, Const ref and rvalues again, I suggest it to be the default behavior, how is this not related ? The topic here is binding rvalues

Re: Something needs to happen with shared, and soon.

2012-11-14 Thread luka8088
On 14.11.2012 20:54, Sean Kelly wrote: On Nov 13, 2012, at 1:14 AM, luka8088luka8...@owave.net wrote: On Tuesday, 13 November 2012 at 09:11:15 UTC, luka8088 wrote: On 12.11.2012 3:30, Walter Bright wrote: On 11/11/2012 10:46 AM, Alex Rønne Petersen wrote: It's starting to get outright

Re: Const ref and rvalues again...

2012-11-13 Thread luka8088
On 13.11.2012 2:16, martin wrote: On Monday, 12 November 2012 at 23:38:43 UTC, luka8088 wrote: What about making this a default behavior and introducing a new keyword if the function wants to modify the argument but it is not ref (pass by value) ? The reason I think that this should

Re: Something needs to happen with shared, and soon.

2012-11-13 Thread luka8088
On Tuesday, 13 November 2012 at 09:11:15 UTC, luka8088 wrote: On 12.11.2012 3:30, Walter Bright wrote: On 11/11/2012 10:46 AM, Alex Rønne Petersen wrote: It's starting to get outright embarrassing to talk to newcomers about D's concurrency support because the most fundamental part

Re: Something needs to happen with shared, and soon.

2012-11-13 Thread luka8088
On 12.11.2012 3:30, Walter Bright wrote: On 11/11/2012 10:46 AM, Alex Rønne Petersen wrote: It's starting to get outright embarrassing to talk to newcomers about D's concurrency support because the most fundamental part of it -- the shared type qualifier -- does not have well-defined semantics

Re: Const ref and rvalues again...

2012-11-13 Thread luka8088
On 13.11.2012 11:00, Era Scarecrow wrote: On Tuesday, 13 November 2012 at 08:34:19 UTC, luka8088 wrote: Would it ? How many functions actually change their non ref/out arguments ? Can you point out any existing public code that would be broken ? It would be possible that if the language

Re: Something needs to happen with shared, and soon.

2012-11-13 Thread luka8088
On 13.11.2012 10:20, Sönke Ludwig wrote: Am 13.11.2012 10:14, schrieb luka8088: On Tuesday, 13 November 2012 at 09:11:15 UTC, luka8088 wrote: On 12.11.2012 3:30, Walter Bright wrote: On 11/11/2012 10:46 AM, Alex Rønne Petersen wrote: It's starting to get outright embarrassing to talk

Re: Something needs to happen with shared, and soon.

2012-11-12 Thread luka8088
If I understood correctly there is no reason why this should not compile ? import core.sync.mutex; class MyClass { void method () {} } void main () { auto myObject = new shared(MyClass); synchronized (myObject) { myObject.method(); } } On 12.11.2012 12:19, Walter Bright wrote:

Re: Something needs to happen with shared, and soon.

2012-11-12 Thread luka8088
implementation I like the first one (or something similar to the first one) more, it looks cleaner and leaves space for additional optimizations. On 12.11.2012 17:14, deadalnix wrote: Le 12/11/2012 16:00, luka8088 a écrit : If I understood correctly there is no reason why this should not compile

Re: Const ref and rvalues again...

2012-11-12 Thread luka8088
What about making this a default behavior and introducing a new keyword if the function wants to modify the argument but it is not ref (pass by value) ? The reason I think that this should be a default behavior because not many functions actually modify their arguments and so it leaves a lot

current GC behavior

2012-11-06 Thread luka8088
Hello everyone, I was writing some unit tests and I also wanted to test that in certain cases object references are properly removed everywhere so that GC can collect them in order to make sure there is no memory leak. While trying to achieve this I learned that objects are not always

Re: current GC behavior

2012-11-06 Thread luka8088
On 6.11.2012 18:00, Ali Çehreli wrote: On 11/06/2012 03:27 AM, luka8088 wrote: I was writing some unit tests and I also wanted to test that in certain cases object references are properly removed everywhere so that GC can collect them in order to make sure there is no memory leak. While

Re: current GC behavior

2012-11-06 Thread luka8088
On 6.11.2012 18:02, thedeemon wrote: On Tuesday, 6 November 2012 at 11:27:25 UTC, luka8088 wrote: Hello everyone, I was writing some unit tests and I also wanted to test that in certain cases object references are properly removed everywhere so that GC can collect them in order to make sure

Re: current GC behavior

2012-11-06 Thread luka8088
On 6.11.2012 21:59, Ali Çehreli wrote: On 11/06/2012 12:00 PM, luka8088 wrote: Yes, but it seems that we can in general say that the following code will never fail... or am I wrong ? import core.memory; class a { static int totalRefCount = 0; this () { totalRefCount

Re: Proposal: __traits(code, ...) and/or .codeof

2012-10-11 Thread luka8088
On Tuesday, 9 October 2012 at 19:29:34 UTC, F i L wrote: On Tuesday, 9 October 2012 at 13:28:55 UTC, luka8088 wrote: Is this at least similar to what you had in mind ? [ ..code.. ] Yes, I realized, a bit after I originally posted that, that my suggestion was already possible if BankType

Re: Proposal: __traits(code, ...) and/or .codeof

2012-10-09 Thread luka8088
Is this at least similar to what you had in mind ? http://dpaste.dzfl.pl/a5dc2875 module program; import std.stdio; mixin template BankAccount () { public int amount; void deposit (int value) { this.amount += value; } void withdraw (int value) { this.amount -= value; } auto

Re: Setting defaults to variadic template args

2012-10-02 Thread luka8088
module program; import std.stdio; import std.traits; import std.typetuple; struct Event (T...) { alias EraseAll!(void, TypeTuple!(T, Select!(T.length 1, int, void), Select!(T.length 2, float, void), )) T2; void F (T2 args) { writeln(typeid(typeof(args))); } } void

Re: Setting defaults to variadic template args

2012-10-02 Thread luka8088
, int), SelectTrue!(T.length 2, float), ) T2; void F (T2 args) { writeln(typeid(typeof(args))); } } void main () { Event!() e1; e1.F(5, 6); } On Tuesday, 2 October 2012 at 13:44:10 UTC, luka8088 wrote: module program; import std.stdio; import std.traits; import

Re: Setting defaults to variadic template args

2012-10-02 Thread luka8088
.F(5, 6); } I hope that you found the solution that you where looking for. On Tuesday, 2 October 2012 at 13:49:56 UTC, luka8088 wrote: Or maybe... This seems like a much better solution: module program; import std.stdio; import std.traits; import std.typetuple; template SelectTrue (bool

  1   2   >