Re: Deimos rules?

2013-11-14 Thread qznc
On Wednesday, 13 November 2013 at 22:46:45 UTC, Jonathan M Davis wrote: On Wednesday, November 13, 2013 23:01:58 Xavier Bigand wrote: I work on XCB integration, so I think that I can add bindings in deimos. C headers are translated to d modules by using DStep or manually? If manually need I

Disassembly Tool

2013-11-14 Thread Namespace
Since the disassembly on Dpaste doesn't work for me anymore, I'm looking for an alternative. Is there one? And I don't want obj2asm, I'm not willing to pay 15$.

Re: Disassembly Tool

2013-11-14 Thread Namespace
On Thursday, 14 November 2013 at 09:48:38 UTC, Namespace wrote: Since the disassembly on Dpaste doesn't work for me anymore, I'm looking for an alternative. Is there one? And I don't want obj2asm, I'm not willing to pay 15$. Forget to say: I'm on Windows.

Re: Disassembly Tool

2013-11-14 Thread Tourist
On Thursday, 14 November 2013 at 09:53:42 UTC, Namespace wrote: On Thursday, 14 November 2013 at 09:48:38 UTC, Namespace wrote: Since the disassembly on Dpaste doesn't work for me anymore, I'm looking for an alternative. Is there one? And I don't want obj2asm, I'm not willing to pay 15$.

Re: Disassembly Tool

2013-11-14 Thread Namespace
On Thursday, 14 November 2013 at 09:55:02 UTC, Tourist wrote: On Thursday, 14 November 2013 at 09:53:42 UTC, Namespace wrote: On Thursday, 14 November 2013 at 09:48:38 UTC, Namespace wrote: Since the disassembly on Dpaste doesn't work for me anymore, I'm looking for an alternative. Is there

Maximum size of an string ?

2013-11-14 Thread Jean Christophe
Hi :) Has someone tested the maximum size of a D string variable for both 32 and 64 bits platforms ? Is it different from the maximum size of a char[] ? Oo` -- JC

Re: Disassembly Tool

2013-11-14 Thread dennis luehring
Am 14.11.2013 10:48, schrieb Namespace: Since the disassembly on Dpaste doesn't work for me anymore, I'm looking for an alternative. Is there one? And I don't want obj2asm, I'm not willing to pay 15$. maybe: distorm: http://www.ragestorm.net/distorm/ ida freeware:

Re: Disassembly Tool

2013-11-14 Thread Namespace
On Thursday, 14 November 2013 at 10:35:26 UTC, dennis luehring wrote: Am 14.11.2013 10:48, schrieb Namespace: Since the disassembly on Dpaste doesn't work for me anymore, I'm looking for an alternative. Is there one? And I don't want obj2asm, I'm not willing to pay 15$. maybe: distorm:

Re: Disassembly Tool

2013-11-14 Thread nazriel
On Thursday, 14 November 2013 at 10:14:05 UTC, Namespace wrote: On Thursday, 14 November 2013 at 09:55:02 UTC, Tourist wrote: On Thursday, 14 November 2013 at 09:53:42 UTC, Namespace wrote: On Thursday, 14 November 2013 at 09:48:38 UTC, Namespace wrote: Since the disassembly on Dpaste doesn't

Re: Disassembly Tool

2013-11-14 Thread nazriel
On Thursday, 14 November 2013 at 10:42:06 UTC, Namespace wrote: On Thursday, 14 November 2013 at 10:35:26 UTC, dennis luehring wrote: Am 14.11.2013 10:48, schrieb Namespace: Since the disassembly on Dpaste doesn't work for me anymore, I'm looking for an alternative. Is there one? And I don't

Linking from source-code

2013-11-14 Thread Andrea Fontana
Is there a way to define a library to link inside d source? I can't find anything about it. IMHO it would very useful for deimos libraries or curl. So when you import a library, it has embedded the linking instruction. For import we write: import std.stdio; That means more or less: look

Re: Linking from source-code

2013-11-14 Thread Ali Çehreli
On 11/14/2013 03:43 AM, Andrea Fontana wrote: Is there a way to define a library to link inside d source? I can't find anything about it. I have never used it but there is pragma(lib): http://dlang.org/pragma.html Ali

Re: Maximum size of an string ?

2013-11-14 Thread Ali Çehreli
On 11/14/2013 02:10 AM, Jean Christophe wrote: Has someone tested the maximum size of a D string variable for both 32 and 64 bits platforms ? Is it different from the maximum size of a char[] ? Both string and char[] are implemented in the same way: a size_t for length and a pointer to

Re: about std.string.representation

2013-11-14 Thread Ali Çehreli
On 11/13/2013 04:32 PM, bioinfornatics wrote: Hi, I try to understand which type char, dchar, wchar will give ubyte,ushort,uint… And for templates, there is std.range.ElementEncodingType: import std.stdio; import std.range; void foo(R)(R range) { // In contrast, ElementType!R for strings

Re: Linking from source-code

2013-11-14 Thread Andrea Fontana
On Thursday, 14 November 2013 at 11:46:19 UTC, Ali Çehreli wrote: On 11/14/2013 03:43 AM, Andrea Fontana wrote: Is there a way to define a library to link inside d source? I can't find anything about it. I have never used it but there is pragma(lib): http://dlang.org/pragma.html Ali

Re: Deimos rules?

2013-11-14 Thread Jacob Carlborg
On 2013-11-13 23:01, Xavier Bigand wrote: I work on XCB integration, so I think that I can add bindings in deimos. C headers are translated to d modules by using DStep or manually? If manually need I respect some syntactical rules? I would say stay as close to the original C code as possible.

Re: Linking from source-code

2013-11-14 Thread Jacob Carlborg
On 2013-11-14 12:46, Ali Çehreli wrote: I have never used it but there is pragma(lib): http://dlang.org/pragma.html Unfortunately that doesn't work with .di files. Although it might work for Deimos projects. -- /Jacob Carlborg

Re: Linking from source-code

2013-11-14 Thread Jacob Carlborg
On 2013-11-14 13:12, Andrea Fontana wrote: So I though this function didn't exist. Why doesn't it work? I doesn't work when D modules are used like header files. See: https://d.puremagic.com/issues/show_bug.cgi?id=2776 Another idea would be to use dub: http://code.dlang.org/ -- /Jacob

Re: Linking from source-code

2013-11-14 Thread Andrea Fontana
On Thursday, 14 November 2013 at 12:35:16 UTC, Jacob Carlborg wrote: On 2013-11-14 13:12, Andrea Fontana wrote: So I though this function didn't exist. Why doesn't it work? I doesn't work when D modules are used like header files. See: https://d.puremagic.com/issues/show_bug.cgi?id=2776

Re: D Program code on CLS

2013-11-14 Thread nazriel
On Thursday, 14 November 2013 at 03:35:59 UTC, Vincent wrote: how can I clear the screen for example I input first letter (A) and second letter (B) and show the result AB then after pressing enter it will clear the screen before it display again the Input first letter Input first letter : A

Re: Disassembly Tool

2013-11-14 Thread Namespace
On Thursday, 14 November 2013 at 10:35:26 UTC, dennis luehring wrote: agner fogs: http://www.agner.org/optimize/#objconv I love that. :) Thanks. But it is much assembler code. A lot more than my script should contain. Maybe druntime is included? Any idea to cut it down?

Re: Deimos rules?

2013-11-14 Thread Joseph Rushton Wakeling
On 14/11/13 13:13, Jacob Carlborg wrote: I would say stay as close to the original C code as possible. Although I do prefer to translate typedefs like int8_t to real D types, like byte, if they exist. In some ways I wonder why D's types aren't just specified according to the number of bits

Re: Chris E. Miller ToolTip (D1)

2013-11-14 Thread jicman
On Wednesday, 13 November 2013 at 18:58:44 UTC, jicman wrote: Greetings. Trying to see if anyone can help with this one... Chris Miller wrote a wonderful set of libraries for Windows programming. One of the libraries was a ToolTip library that when called against an object, when the mouse

Re: Chris E. Miller ToolTip (D1)

2013-11-14 Thread Dicebot
Not many D1 users are still here :( I personally, have zero idea what library are you even speaking about.

Re: Linking from source-code

2013-11-14 Thread Adam D. Ruppe
On Thursday, 14 November 2013 at 13:49:02 UTC, Andrea Fontana wrote: I think it's a better idea to make it works from dmd/rdmd. pragma(lib) works almost everywhere with dmd* except phobos, due to how that is compiled. rdmd ignores modules in the std namespace when building the

Re: Chris E. Miller ToolTip (D1)

2013-11-14 Thread jicman
On Thursday, 14 November 2013 at 14:38:49 UTC, Dicebot wrote: Not many D1 users are still here :( I personally, have zero idea what library are you even speaking about. I am talking about this library: http://www.dprogramming.com/dfl.php specifically, this object,

Re: Chris E. Miller ToolTip (D1)

2013-11-14 Thread Heinz
You have to manually set the tooltip's max width to a fixed value using the tooltip handle and Win32 API, by doing this you're telling the tooltip object it is a multiline tooltip and from now on it will accept \r\n as end of line: ttip = new ToolTip; SendMessageA(ttip.handle,

function XXXX conflict with YYYY

2013-11-14 Thread Agustin
final uint registerEvent(T, J)(IPlugin, void delegate(J)) { } final uint registerEvent(IPlugin, EventHandler, EventInfo, ulong) { } There seems to be a problem when having two function with same name but different parameters. Only happend when one of the function use templates. Is

Re: function XXXX conflict with YYYY

2013-11-14 Thread evilrat
On Thursday, 14 November 2013 at 16:27:39 UTC, Agustin wrote: final uint registerEvent(T, J)(IPlugin, void delegate(J)) { } final uint registerEvent(IPlugin, EventHandler, EventInfo, ulong) { } There seems to be a problem when having two function with same name but different

Re: function XXXX conflict with YYYY

2013-11-14 Thread bearophile
Agustin: final uint registerEvent(T, J)(IPlugin, void delegate(J)) { } final uint registerEvent(IPlugin, EventHandler, EventInfo, ulong) { } There seems to be a problem when having two function with same name but different parameters. Only happend when one of the function use

Re: function XXXX conflict with YYYY

2013-11-14 Thread Gary Willoughby
On Thursday, 14 November 2013 at 16:27:39 UTC, Agustin wrote: final uint registerEvent(T, J)(IPlugin, void delegate(J)) { } final uint registerEvent(IPlugin, EventHandler, EventInfo, ulong) { } There seems to be a problem when having two function with same name but different

Re: function XXXX conflict with YYYY

2013-11-14 Thread evilrat
mmm.. this is strange because for simple types it works fine(i'm using dmd 2.064.2). can you show reduced example of this?

Re: function XXXX conflict with YYYY

2013-11-14 Thread H. S. Teoh
On Thu, Nov 14, 2013 at 05:27:38PM +0100, Agustin wrote: final uint registerEvent(T, J)(IPlugin, void delegate(J)) { } final uint registerEvent(IPlugin, EventHandler, EventInfo, ulong) { } There seems to be a problem when having two function with same name but different

Re: function XXXX conflict with YYYY

2013-11-14 Thread Gary Willoughby
On Thursday, 14 November 2013 at 16:59:25 UTC, evilrat wrote: mmm.. this is strange because for simple types it works fine(i'm using dmd 2.064.2). can you show reduced example of this? See bearophile's answer.

Re: function XXXX conflict with YYYY

2013-11-14 Thread Gary Willoughby
On Thursday, 14 November 2013 at 17:13:18 UTC, H. S. Teoh wrote: It only takes one twig to burn down a forest. http://www.youtube.com/watch?v=d-S1o5OmMMo

Re: function XXXX conflict with YYYY

2013-11-14 Thread Agustin
Thanks, i updated to v2.064.2 and everything works just fine. I had this issue long time ago and it was annoying to have multiple function with different names.

What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread Jacek Furmankiewicz
In our Java code, we make heavy use of ConcurrentHashMap for in-memory caches: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentHashMap.html We use it mostly for in-memory caches. A background thread wakes up every X seconds and resyncs the cache with whatever changes

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread TheFlyingFiddle
On Thursday, 14 November 2013 at 17:36:09 UTC, Jacek Furmankiewicz wrote: In our Java code, we make heavy use of ConcurrentHashMap for in-memory caches: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentHashMap.html We use it mostly for in-memory caches. A background

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread Jacek Furmankiewicz
So how do existing D applications (especially the high perf ones in let's say the financial sector) deal with having some part of the data in memory and keeping it in sync with the DB source? This must be a very common requirement for any app with realtime or close-to-realtime SLAs. is

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread TheFlyingFiddle
On Thursday, 14 November 2013 at 18:08:22 UTC, Jacek Furmankiewicz wrote: So how do existing D applications (especially the high perf ones in let's say the financial sector) deal with having some part of the data in memory and keeping it in sync with the DB source? Good question. I have no

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread JN
On Thursday, 14 November 2013 at 18:08:22 UTC, Jacek Furmankiewicz wrote: So how do existing D applications (especially the high perf ones in let's say the financial sector) deal with having some part of the data in memory and keeping it in sync with the DB source? They don't, because there

Re: D Program code on CLS

2013-11-14 Thread Ali Çehreli
On 11/13/2013 08:59 PM, Vincent wrote: This is the code. where or what code will I use for clear the screen? My Linux console environment has 'clear'. That's why I used system(clear) below. You may need to use system(cls) if you are e.g. on Windows. import std.stdio; import std.process;

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread ilya-stromberg
On Thursday, 14 November 2013 at 17:36:09 UTC, Jacek Furmankiewicz wrote: In our Java code, we make heavy use of ConcurrentHashMap for in-memory caches: Try to look dcollections: http://www.dsource.org/projects/dcollections Also, Vibe.d has own hashmap:

Re: Cannot cast char[] to string.

2013-11-14 Thread Dicebot
On Thursday, 14 November 2013 at 19:41:13 UTC, Agustin wrote: I'm trying to use http://dlang.org/phobos/std_net_curl.html and when i compile the same example i get: cannot implicitly convert expression (get(cast(const(char)[])address, AutoProtocol())) of type char[] to string string

Cannot cast char[] to string.

2013-11-14 Thread Agustin
I'm trying to use http://dlang.org/phobos/std_net_curl.html and when i compile the same example i get: cannot implicitly convert expression (get(cast(const(char)[])address, AutoProtocol())) of type char[] to string string address = http://dlang.org;; string _data = get(address);

Re: Cannot cast char[] to string.

2013-11-14 Thread Brad Anderson
On Thursday, 14 November 2013 at 19:41:13 UTC, Agustin wrote: I'm trying to use http://dlang.org/phobos/std_net_curl.html and when i compile the same example i get: cannot implicitly convert expression (get(cast(const(char)[])address, AutoProtocol())) of type char[] to string string

Re: Cannot cast char[] to string.

2013-11-14 Thread Ali Çehreli
On 11/14/2013 11:43 AM, Dicebot wrote: On Thursday, 14 November 2013 at 19:41:13 UTC, Agustin wrote: I'm trying to use http://dlang.org/phobos/std_net_curl.html and when i compile the same example i get: cannot implicitly convert expression (get(cast(const(char)[])address, AutoProtocol())) of

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread Jacek Furmankiewicz
Thanks for the links. I looked at the dcollections docs, but none of their collections seem thread safe. The vibe.d I guess is because it is meant to be used from async I/O in a single thread...but once you add multi-threading to an app I am guessing it would not be usable.

Re: Compile-time sets and hash tables

2013-11-14 Thread Andrej Mitrovic
On 11/14/13, Philippe Sigaud philippe.sig...@gmail.com wrote: - I'd greatly like for those sets or hash tables to be CTFE-compatible. Well if it's only used in CTFE, I'd imagine a simple struct wrapping an array and doing !canFind when adding elements would do the job, no?

Re: Figuring out the returntype opDipatch

2013-11-14 Thread TheFlyingFiddle
On Sunday, 3 November 2013 at 10:48:45 UTC, Jacob Carlborg wrote: On 2013-11-03 03:15, TheFlyingFiddle wrote: In the IReflectionable interface: interface IReflectionable { final P funcPtr(P)(string fun) if (is(P == delegate)) { //Using mangeling for overloads and type safety

Re: Figuring out the returntype opDipatch

2013-11-14 Thread TheFlyingFiddle
On Thursday, 14 November 2013 at 20:39:35 UTC, TheFlyingFiddle wrote: On Sunday, 3 November 2013 at 10:48:45 UTC, Jacob Carlborg wrote: On 2013-11-03 03:15, TheFlyingFiddle wrote: In the IReflectionable interface: interface IReflectionable { final P funcPtr(P)(string fun) if (is(P ==

Re: Compile-time sets and hash tables

2013-11-14 Thread Philippe Sigaud
On Thu, Nov 14, 2013 at 9:31 PM, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On 11/14/13, Philippe Sigaud philippe.sig...@gmail.com wrote: - I'd greatly like for those sets or hash tables to be CTFE-compatible. Well if it's only used in CTFE, I'd imagine a simple struct wrapping an

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread ilya-stromberg
On Thursday, 14 November 2013 at 20:00:10 UTC, Jacek Furmankiewicz wrote: I looked at the dcollections docs, but none of their collections seem thread safe. The vibe.d I guess is because it is meant to be used from async I/O in a single thread...but once you add multi-threading to an app I am

Only run code if *not* unittesting

2013-11-14 Thread Jared
Hey there, So I'd like to limit code execution in my main function to only execute if I haven't passed the --unittest flag during compilation. Is this possible?

Re: Figuring out the returntype opDipatch

2013-11-14 Thread TheFlyingFiddle
After looking at the DIP some more i can see that my suggestion implementation does not make any sense (and i missed some of the syntax). If it can be done with AST's i don't have a sugestion for it.

Re: Only run code if *not* unittesting

2013-11-14 Thread Adam D. Ruppe
There's a version(unittest), so version(unittest) {} else { /* only run when unittesting */ } should work for you.

Re: Only run code if *not* unittesting

2013-11-14 Thread Jared
On Thursday, 14 November 2013 at 21:02:21 UTC, Adam D. Ruppe wrote: There's a version(unittest), so version(unittest) {} else { /* only run when unittesting */ } should work for you. That worked... except backwards: version(unittest) { /* executed when --unittest flag used */ } else {

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread TheFlyingFiddle
2) Use `shared` storage class and mutex like this: import vibe.utils.hashmap; shared HashMap!(int, int) map; void foo() { synchronized { //use map map[1] = 1; } } Locking every time you use the map dosn't rly seem reasonable. It's not particulary fast and you might

Multidimensional array in d2?

2013-11-14 Thread seany
I See that in stack exchange, that it is possible to create multidimensional arrays like : type [][] arrayname ; and here : http://homepages.uni-regensburg.de/~nen10015/documents/D-multidimarray.html that such is not possible. I would like to know more about it, and learn about

Re: opCmp on a struct keyed by an array of bytes

2013-11-14 Thread Ali Çehreli
On 11/13/2013 07:46 PM, Charles Hixson wrote: On 11/12/2013 04:47 PM, bearophile wrote: Charles Hixson: I had tried return bytes.cmp(b.bytes); , but it didn't occur to me that the error meant I should have used a copy? Does this syntax mean that what's being compared is a dynamic array

Re: Multidimensional array in d2?

2013-11-14 Thread Ali Çehreli
On 11/14/2013 01:18 PM, seany wrote: I See that in stack exchange, that it is possible to create multidimensional arrays like : type [][] arrayname ; That works because in C, C++, D, etc. a multi-dimensional array is nothing but a single dimensional array where elements are arrays. I

interface and class inheritance

2013-11-14 Thread Oleg B
[code] import std.stdio; interface A { void funcA(); } class B { final void funcA() { writeln( B.funcA() ); } } class C: B, A { } void main() { auto c = new C; c.funcA(); } [code/] $ dmd -run interface.d interface.d(6): Error: class interface.C interface function 'void funcA()' is

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread ilya-stromberg
On Thursday, 14 November 2013 at 21:16:15 UTC, TheFlyingFiddle wrote: If that is the case are you not limited in the way you can update the map eg only in a single block? Yes, it's probably not the best example. It's valid if you have only 1 synchronized block for map. But you can use

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread Jacek Furmankiewicz
hashmap per thread is not an option. The cache may be a few GBs of data, there is no way we can duplicate that data per thread. Not to mention the start up time when we have to warm up the cache.

Re: Multidimensional array in d2?

2013-11-14 Thread seany
Oh, this is really nice, thank you very much I also note you have a book http://ddili.org/ders/d.en/index.html (too bad that there are chapters not translated, but thank you very much)! On Thursday, 14 November 2013 at 21:24:25 UTC, Ali Çehreli wrote: On 11/14/2013 01:18 PM, seany wrote:

Dynamic array handling

2013-11-14 Thread seany
In Very High level languages, such as scilab, you can write array_var = (1,2,3 ... etc) and then you can also write array_var = array_var(1:2,4:$) In this case, the third element is dropped, and the same variable, array_var is set to be an array of a different length, resizing of array and

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread bearophile
Jacek Furmankiewicz: hashmap per thread is not an option. The cache may be a few GBs of data, there is no way we can duplicate that data per thread. But is the D garbage collector able to manage efficiently enough associative arrays of few gigabytes? You are not dealing with a GC nearly as

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread ilya-stromberg
On Thursday, 14 November 2013 at 21:31:52 UTC, Jacek Furmankiewicz wrote: hashmap per thread is not an option. The cache may be a few GBs of data, there is no way we can duplicate that data per thread. Not to mention the start up time when we have to warm up the cache. How often do you

Re: Dynamic array handling

2013-11-14 Thread Brad Anderson
On Thursday, 14 November 2013 at 21:38:39 UTC, seany wrote: In Very High level languages, such as scilab, you can write array_var = (1,2,3 ... etc) and then you can also write array_var = array_var(1:2,4:$) In this case, the third element is dropped, and the same variable, array_var is set

Re: interface and class inheritance

2013-11-14 Thread Ali Çehreli
On 11/14/2013 01:20 PM, Oleg B wrote: [code] import std.stdio; interface A { void funcA(); } class B { final void funcA() { writeln( B.funcA() ); } } class C: B, A { } void main() { auto c = new C; c.funcA(); } [code/] $ dmd -run interface.d interface.d(6): Error: class interface.C

Question about inheritance

2013-11-14 Thread Akzwar
import std.stdio; interface A { void funcA(); } class B { final void funcA() { writeln( B.funcA() ); } } class C: B, A { } void main() { auto c = new C; c.funcA(); } $ rdmd interface.d interface.d(6): Error: class interface.C interface function 'void funcA()' is not implemented Why

Re: Question about inheritance

2013-11-14 Thread Ali Çehreli
On 11/14/2013 01:41 PM, Akzwar wrote: import std.stdio; interface A { void funcA(); } class B { final void funcA() { writeln( B.funcA() ); } } class C: B, A { } void main() { auto c = new C; c.funcA(); } $ rdmd interface.d interface.d(6): Error: class interface.C interface function

Re: D Program code on CLS

2013-11-14 Thread seany
what is the tango equivalent for system? In my case, since my dmd, tango and things are in custom folders, i notice that i am getting problems when importing both std.stdio and tango.io.stdout On Thursday, 14 November 2013 at 19:00:00 UTC, Ali Çehreli wrote: On 11/13/2013 08:59 PM, Vincent

Re: interface and class inheritance

2013-11-14 Thread Agustin
On Thursday, 14 November 2013 at 21:20:57 UTC, Oleg B wrote: [code] import std.stdio; interface A { void funcA(); } class B { final void funcA() { writeln( B.funcA() ); } } class C: B, A { } void main() { auto c = new C; c.funcA(); } [code/] $ dmd -run interface.d interface.d(6):

Re: interface and class inheritance

2013-11-14 Thread Agustin
On Thursday, 14 November 2013 at 21:42:38 UTC, Agustin wrote: On Thursday, 14 November 2013 at 21:20:57 UTC, Oleg B wrote: [code] import std.stdio; interface A { void funcA(); } class B { final void funcA() { writeln( B.funcA() ); } } class C: B, A { } void main() { auto c = new C;

Re: Dynamic array handling

2013-11-14 Thread Adam D. Ruppe
On Thursday, 14 November 2013 at 21:38:39 UTC, seany wrote: array_var = (1,2,3 ... etc) In D, that'd look like: auto array_var = [1,2,3,4,5]; array_var = array_var(1:2,4:$) array_var = array_var[0 .. 1] ~ array_var[2 .. $]; array[x .. y] does a slice in D, with the first element of

Re: Dynamic array handling

2013-11-14 Thread Ali Çehreli
On 11/14/2013 01:38 PM, seany wrote: In Very High level languages, such as scilab, you can write array_var = (1,2,3 ... etc) and then you can also write array_var = array_var(1:2,4:$) In this case, the third element is dropped, and the same variable, array_var is set to be an array of a

Re: Dynamic array handling

2013-11-14 Thread seany
WOW On Thursday, 14 November 2013 at 21:50:53 UTC, Ali Çehreli wrote: On 11/14/2013 01:38 PM, seany wrote: In Very High level languages, such as scilab, you can write array_var = (1,2,3 ... etc) and then you can also write array_var = array_var(1:2,4:$) In this case, the third element is

Re: Multidimensional array in d2?

2013-11-14 Thread Ali Çehreli
On 11/14/2013 01:31 PM, seany wrote: I also note you have a book http://ddili.org/ders/d.en/index.html (too bad that there are chapters not translated, but thank you very much)! You are very welcome! Just three chapters left and I must add the UDA chapter, which has been one of the most

select all rows (resp. columns) out of matrix

2013-11-14 Thread seany
How do I access All rows (resp. columns ) of a Matrix / multidimensional array? In scilab, you write array_var(:,row_index), colon meaning all columns, at that particular row given by row index will be selected. can you, forexample, in D, write, array_var[0][] to select all elements

Re: Object destruction versus finalization

2013-11-14 Thread Florian
Michael, thank you for these links. Regards, Florian.

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread Jacek Furmankiewicz
On Thursday, 14 November 2013 at 21:36:46 UTC, ilya-stromberg wrote: On Thursday, 14 November 2013 at 21:31:52 UTC, Jacek Furmankiewicz wrote: How often do you change the data? Probably, you should use `immutable` variables. Customer specific. It may change once a year. It may change

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread Jacek Furmankiewicz
On Thursday, 14 November 2013 at 21:39:53 UTC, bearophile wrote: Jacek Furmankiewicz: hashmap per thread is not an option. The cache may be a few GBs of data, there is no way we can duplicate that data per thread. But is the D garbage collector able to manage efficiently enough associative

Re: select all rows (resp. columns) out of matrix

2013-11-14 Thread TheFlyingFiddle
On Thursday, 14 November 2013 at 22:06:28 UTC, seany wrote: How do I access All rows (resp. columns ) of a Matrix / multidimensional array? In scilab, you write array_var(:,row_index), colon meaning all columns, at that particular row given by row index will be selected. can you,

Re: interface and class inheritance

2013-11-14 Thread Oleg B
On Thursday, 14 November 2013 at 21:45:11 UTC, Agustin wrote: On Thursday, 14 November 2013 at 21:42:38 UTC, Agustin wrote: On Thursday, 14 November 2013 at 21:20:57 UTC, Oleg B wrote: [code] import std.stdio; interface A { void funcA(); } class B { final void funcA() { writeln( B.funcA() );

Re: select all rows (resp. columns) out of matrix

2013-11-14 Thread Ali Çehreli
On 11/14/2013 02:18 PM, TheFlyingFiddle wrote: On Thursday, 14 November 2013 at 22:06:28 UTC, seany wrote: How do I access All rows (resp. columns ) of a Matrix / multidimensional array? In scilab, you write array_var(:,row_index), colon meaning all columns, at that particular row given by row

Re: select all rows (resp. columns) out of matrix

2013-11-14 Thread TheFlyingFiddle
On Thursday, 14 November 2013 at 22:18:44 UTC, TheFlyingFiddle wrote: unittest { int[][] matrix = new int[][](n,m); //Getting a collumn is simple. int[] collumn0 = matrix[0]; //Getting a row is trickier int[] row0; //Loop over all collumns foreach(i; matrix) { row0 ~=

Re: select all rows (resp. columns) out of matrix

2013-11-14 Thread TheFlyingFiddle
On Thursday, 14 November 2013 at 22:26:03 UTC, Ali Çehreli wrote: transversal() is useful too: :) http://dlang.org/phobos/std_range.html#transversal Ali Did not know about this one. Thanks for pointing it out :D

Re: Deimos rules?

2013-11-14 Thread Xavier Bigand
Le 14/11/2013 13:13, Jacob Carlborg a écrit : On 2013-11-13 23:01, Xavier Bigand wrote: I work on XCB integration, so I think that I can add bindings in deimos. C headers are translated to d modules by using DStep or manually? If manually need I respect some syntactical rules? I would say

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread bearophile
Jacek Furmankiewicz: Well, these are the types of questions I have as a Java veteran who is having a first look at D after the recent Facebook announcement. By now I have a decent idea of where most of the new languages (Go has same issues, for the most part) come up short when compared to

Re: Dynamic array handling

2013-11-14 Thread bearophile
Brad Anderson: a = a.remove(3); But I think the remove function should be modified: https://d.puremagic.com/issues/show_bug.cgi?id=10959 To the Original Poster I can also answer that with a filter+array functions you can build a new array that contains only certain items of the original

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread Jacek Furmankiewicz
True. While looking a D, I am just trying to focus on the parts which I know would be a showstopper for us on day one...and this particular issue is it. I do like D a lot as well from what I've seen so far. Regarding the GC, I've seen some slides on DConf about other garbage collectors

Re: select all rows (resp. columns) out of matrix

2013-11-14 Thread bearophile
Ali Çehreli: transversal() is useful too: :) http://dlang.org/phobos/std_range.html#transversal transversal() is sometimes useful, but if you need a significant amount of matrix processing, slicing and dicing matrices all the time in scientific code, then probably it's better to use a

Re: select all rows (resp. columns) out of matrix

2013-11-14 Thread H. S. Teoh
On Fri, Nov 15, 2013 at 12:13:11AM +0100, bearophile wrote: Ali Çehreli: transversal() is useful too: :) http://dlang.org/phobos/std_range.html#transversal transversal() is sometimes useful, but if you need a significant amount of matrix processing, slicing and dicing matrices all the

Re: pitfalls of enum

2013-11-14 Thread Ali Çehreli
On 11/02/2013 02:14 PM, JR wrote: But in Andrei's thread on tristates[2] he lists this code excerpt: struct Tristate { private static Tristate make(ubyte b) { Tristate r = void; r.value = b; return r; } enum no = make(0), yes = make(1), unknown

Re: What is the closest to ConcurrentHashMap and NavigableMap in Java?

2013-11-14 Thread Charles Hixson
On 11/14/2013 01:36 PM, ilya-stromberg wrote: On Thursday, 14 November 2013 at 21:31:52 UTC, Jacek Furmankiewicz wrote: hashmap per thread is not an option. The cache may be a few GBs of data, there is no way we can duplicate that data per thread. Not to mention the start up time when we have

Re: pitfalls of enum

2013-11-14 Thread bearophile
Ali Çehreli: When is an enum *better* than a normal (static const/immutable) constant? Good question. :) When you can or want to compute something at compile-time, when you need values to feed to templates, etc. Bye, bearophile

Re: std.json

2013-11-14 Thread Rob T
On Wednesday, 4 July 2012 at 16:55:19 UTC, Ali Çehreli wrote: On 07/04/2012 08:25 AM, Alexsej wrote: On Monday, 26 March 2012 at 07:14:50 UTC, Ali Çehreli wrote: // Assumes UTF-8 file auto content = to!string(read(json_file)); Your example only works if the json file in UTF-8 (BOM), how to

Re: D Program code on CLS

2013-11-14 Thread Jesse Phillips
On Thursday, 14 November 2013 at 21:42:34 UTC, seany wrote: what is the tango equivalent for system? In my case, since my dmd, tango and things are in custom folders, i notice that i am getting problems when importing both std.stdio and tango.io.stdout For tango it looks like you want

Re: Deimos rules?

2013-11-14 Thread Jonathan M Davis
On Thursday, November 14, 2013 15:06:59 Joseph Rushton Wakeling wrote: On 14/11/13 13:13, Jacob Carlborg wrote: I would say stay as close to the original C code as possible. Although I do prefer to translate typedefs like int8_t to real D types, like byte, if they exist. In some ways I

  1   2   >