Is there any implementation of a 128bit integer?

2022-07-08 Thread Rob T via Digitalmars-d-learn
https://forum.dlang.org/post/mailman.10914.1566237225.29801.digitalmars-d-le...@puremagic.com In case someone comes across this old thread https://dlang.org/phobos/core_int128.html

Re: Where can i find examples of multi-threaded fibers?

2015-07-28 Thread Rob T via Digitalmars-d-learn
On Monday, 27 July 2015 at 18:30:06 UTC, Gary Willoughby wrote: Where is the discussion? This must be it http://forum.dlang.org/thread/pflkijjjuyyhextxv...@forum.dlang.org I'm interested in the same subject right now, and was wondering about the same question you asked.

Re: CPU cores & threads & fibers

2015-06-16 Thread Rob T via Digitalmars-d-learn
On Sunday, 14 June 2015 at 15:54:30 UTC, Etienne Cimon wrote: On 2015-06-14 08:35, Robert M. Münch wrote: Hi, just to x-check if I have the correct understanding: fibers = look parallel, are sequential => use 1 CPU core threads = look parallel, are parallel => use several CPU

Re: Measuring ticks (or time) per threads

2013-12-04 Thread Rob T
Also please post a bug or enhancement issue for anything that you think ought to be included in the standard libs that isn't. https://d.puremagic.com/issues/ --rt

Re: Measuring ticks (or time) per threads

2013-12-04 Thread Rob T
On Thursday, 5 December 2013 at 00:53:00 UTC, Phil wrote: That function sounds great. Unfortunately I am working on Windows so I guess I'll have to look into their API. I was hoping for a solution available in the std but if there isn't than there isn't. Thanks for you information! You may

Re: Thread affinity?

2013-12-04 Thread Rob T
On Wednesday, 4 December 2013 at 08:38:12 UTC, qznc wrote: You should file an issue [0] as this should actually be in core.thread. [0] https://d.puremagic.com/issues/enter_bug.cgi I filed an enhancement request for the thread module. Digging deeper, I notice that module core.sys.posix.pthr

Re: Measuring ticks (or time) per threads

2013-12-04 Thread Rob T
On Wednesday, 4 December 2013 at 20:12:41 UTC, Phil wrote: Hi guys, I'd like to know if there is a way using the stdlib that I can measure the number of ticks that a thread has been working. I do mean the number of ticks that it has been ACTIVE, and not the noTicks since its creation. Thank

Thread affinity?

2013-12-03 Thread Rob T
In core.thread I don't see a portable way to pin a thread to a specific core, or at least pin the thread to whatever core it is currently running in. I found this solution, but it's for Windows only. http://www.gamedev.net/blog/1140/entry-2254424-setting-thread-affinity-on-windows-in-d/ I can

Re: MSG_WAITALL for Sockets

2013-11-19 Thread Rob T
On Tuesday, 19 November 2013 at 18:35:08 UTC, Jeroen Bollen wrote: Is there a way I can call a receive method on a socket with MSG_WAITALL as a flag? There doesn't seem to be an enum for that. module core.sys.posix.sys.socket; enum : uint { MSG_CTRUNC = 0x08, MSG_

Re: Variable arguments with file and line information?

2013-11-17 Thread Rob T
On Sunday, 17 November 2013 at 21:29:03 UTC, Jonathan M Davis wrote: Yeah. Don't use concatenation in your format string: Right, that concat was bothering me too. Tks for the input. --rt

Re: Variable arguments with file and line information?

2013-11-17 Thread Rob T
Good points, got it down to this. void error(string a_Msg, string file = __FILE__, size_t line = __LINE__) { writefln( a_Msg ~ ". In file %s on line %d.", file, line ); } int main() { format("hallo").error; format("Hallo %s.", "du da").error; } There should be no more template bloat,

Re: Variable arguments with file and line information?

2013-11-17 Thread Rob T
On Saturday, 16 November 2013 at 23:55:47 UTC, Jonathan M Davis wrote: [...] e.g. force the caller to call format when creating the message rather than supporting variadic arguments directly in error. - Jonathan M Davis OK, how about this implementation? string msg( S : string, T... )( S a

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),

Re: Get variable symbol name that was passed to a paramater?

2013-11-10 Thread Rob T
On Sunday, 10 November 2013 at 00:08:11 UTC, Timothee Cour wrote: [...] I've already asked for this in the past (see email: "feature request: __ARGS__ for logging (cf __FILE__, __LINE__, __FUNC___): but Jacob pointed out that AST macros would make this un-necessary (like wise with another prop

Re: Get variable symbol name that was passed to a paramater?

2013-11-10 Thread Rob T
On Saturday, 9 November 2013 at 11:07:08 UTC, Dicebot wrote: On Saturday, 9 November 2013 at 09:12:21 UTC, Rob T wrote: It works except when passing a variable contained inside a struct or class due to a missing "this" during evaluation, I'm also worried about template bloat.

Re: Get variable symbol name that was passed to a paramater?

2013-11-09 Thread Rob T
On Saturday, 9 November 2013 at 11:07:08 UTC, Dicebot wrote: On Saturday, 9 November 2013 at 09:12:21 UTC, Rob T wrote: It works except when passing a variable contained inside a struct or class due to a missing "this" during evaluation, I'm also worried about template bloat.

Get variable symbol name that was passed to a paramater?

2013-11-09 Thread Rob T
I have a template function called "inspect" that takes two variables as arguments, void inspect(T)( string symbol, T value ) { writeln(symbol, " = ", value); } int y = 100; inspect( y.stringof, y ); writes to console y = 100 I am wondering if there's a way to pass only the variable and

Re: What is the correct way to test for an empty string?

2013-07-17 Thread Rob T
On Tuesday, 16 July 2013 at 19:33:13 UTC, bearophile wrote: The right, safe and readable way is to use std.array.empty: if (myString.empty) If you don't want to import functions, then test for the length: if (string.length == 0) Bye, bearophile What was the rational for empty not being bui

Re: How to create RDM sockets?

2013-07-07 Thread Rob T
On Sunday, 7 July 2013 at 10:53:09 UTC, Andrey Derzhavin wrote: Hello! I try to create a RDM socket, but all my attempts fails by "Unable to create socket: Socket type not supported" error. How can I create a RDM socket using std.socket module? Thanks. Not all systems support RDM and/or it

Re: UFCS and "with" statement

2013-06-12 Thread Rob T
On Wednesday, 12 June 2013 at 11:05:22 UTC, bearophile wrote: Rob T: Rather disappointing that this fails. Anyone know if this is an expected limitation of UFCS or a bug? Probably no one thought on this case. Why do you think it's useful? Bye, bearophile If we're to use UFCS

UFCS and "with" statement

2013-06-11 Thread Rob T
struct S { } void f(S) { } void main() { S s; with (s) { f(); // compiler error } } Rather disappointing that this fails. Anyone know if this is an expected limitation of UFCS or a bug? --rt

Re: Segfault on simple program?

2013-06-05 Thread Rob T
On Saturday, 1 June 2013 at 01:10:05 UTC, Shriramana Sharma wrote: On Sat, Jun 1, 2013 at 6:02 AM, Anthony Goins wrote: Works for me ubuntu 64. Do you have both versions installed? Of course not. The later install from the distributed DEB (from dlang.org) overwrites the earlier one by apt in

Re: Segfault on simple program?

2013-06-05 Thread Rob T
On Saturday, 1 June 2013 at 14:41:13 UTC, Shriramana Sharma wrote: On Sat, Jun 1, 2013 at 7:57 PM, Anthony Goins wrote: Sometimes running ldconfig will solve wierd problems like this. Thanks and I tried that just now but no fruit. :-( Try a *full* removal of the deb installations (dmd and

Re: D is totally useless

2013-05-02 Thread Rob T
On Thursday, 2 May 2013 at 04:27:10 UTC, evilrat wrote: learn what? opengl is C API specification, any resource about opengl will work, the only thing required for apply it to D is to know D basics. but unfortunately for D itself it is really hard to find good tutorials I use this on-line boo

Re: mysql

2013-04-17 Thread Rob T
On Tuesday, 16 April 2013 at 21:09:42 UTC, gedaiu wrote: On Monday, 15 April 2013 at 19:25:19 UTC, simendsjo wrote: On Monday, 15 April 2013 at 17:34:07 UTC, gedaiu wrote: Hi, Can anyone help me to connect to mysql from D? Thanks! You can use Steve Teales native library. The most up-to-date

Re: Status of AA's?

2013-03-28 Thread Rob T
Thanks for the comments. It seems that my best option is to avoid the built in AA's for now. I'll take a look at the suggested alternative solutions. One thing I'm looking for is enforced explicit additions of new key value pairs rather than the magical method used by the built in AA's, it's

Status of AA's?

2013-03-28 Thread Rob T
I recall some discussion about AA's being buggy and fixing the bugs is difficult, and that there may be future changes to how AA's operate, for example perhaps moving it to a library solution. So I am wondering if I should simply avoid using the built-in AA's entirely at this time, and instead

Re: GC, memory leaks and 32/64 bit

2013-03-12 Thread Rob T
On Tuesday, 12 March 2013 at 21:02:20 UTC, Benjamin Thaut wrote: This is not possible as different kinds of GCs need to generate different runtime data at compile time. The current GC for example does not need any runtime data (other then what the D typeinfo system already provides) but the per

Re: GC, memory leaks and 32/64 bit

2013-03-12 Thread Rob T
On Tuesday, 12 March 2013 at 20:29:58 UTC, Marco Leise wrote: Am Tue, 12 Mar 2013 21:08:01 +0100 schrieb "Rob T" : It should be a plugin so that components like an alternate GC can be swapped in and out easily. I hope once shared lib support becomes available we'll fina

Re: GC, memory leaks and 32/64 bit

2013-03-12 Thread Rob T
On Tuesday, 12 March 2013 at 14:21:06 UTC, bearophile wrote: Benjamin Thaut: Thats not correct. Rainer Schuetze has finished it and is using it for VisualD. You can get a version of druntime which the percise GC from his github branch https://github.com/rainers/dmd I am glad to be wrong :-)

Re: Rethrow an exception like in C++?

2013-03-10 Thread Rob T
On Monday, 11 March 2013 at 03:46:22 UTC, Ali Çehreli wrote: On 03/10/2013 08:10 PM, Rob T wrote: >>> >>> Lippincott functions avoid macros and make it more explicit that the >>> entire body is inside a try block. >>> >>> Ali >> > > Oops,

Re: Rethrow an exception like in C++?

2013-03-10 Thread Rob T
Lippincott functions avoid macros and make it more explicit that the entire body is inside a try block. Ali Oops, I think you were showing me an example where it could be used. --rt

Re: Rethrow an exception like in C++?

2013-03-10 Thread Rob T
On Friday, 8 March 2013 at 22:10:19 UTC, Ali Çehreli wrote: I heard about this idiom for the first time in Jon Kalb's talk. The name appears in his slides: http://exceptionsafecode.com/ Very smart way of writing a single function that catches many different types of exceptions; does special

Re: Rethrow an exception like in C++?

2013-03-10 Thread Rob T
On Friday, 8 March 2013 at 21:10:15 UTC, Andrej Mitrovic wrote: On 3/8/13, Rob T wrote: So this is more efficient or has some other advantages than using typeid? Benchmark! :) Also you might find this useful some day: http://wiki.dlang.org/Dispatching_an_object_based_on_its_dynamic_type

Re: question with compile-time reflection

2013-03-10 Thread Rob T
On Monday, 11 March 2013 at 00:26:25 UTC, anonymous wrote: On Monday, 11 March 2013 at 00:10:46 UTC, Rob T wrote: template NDimensionalArrayType(T,alias size) I'm wondering what "alias size" does? I can't find that form documented anywhere, but it seems to be valid

Re: question with compile-time reflection

2013-03-10 Thread Rob T
template NDimensionalArrayType(T,alias size) I'm wondering what "alias size" does? I can't find that form documented anywhere, but it seems to be valid. Thanks. --rt

Re: question with compile-time reflection

2013-03-09 Thread Rob T
template NDimensionalArrayType(T,alias size) I think your use of "alias size" is incorrect. See http://dlang.org/declaration.html --rt

Re: Rethrow an exception like in C++?

2013-03-08 Thread Rob T
On Friday, 8 March 2013 at 20:46:42 UTC, Jonathan M Davis wrote: On Friday, March 08, 2013 11:56:12 H. S. Teoh wrote: On Fri, Mar 08, 2013 at 08:52:21PM +0100, Rob T wrote: > On Friday, 8 March 2013 at 06:05:02 UTC, Maxim Fomin wrote: > > catch (Exception e) { > > > > if

Re: Rethrow an exception like in C++?

2013-03-08 Thread Rob T
On Friday, 8 March 2013 at 20:32:23 UTC, Jonathan M Davis wrote: On Friday, March 08, 2013 20:16:13 Rob T wrote: If you know of a better way to implement an exception handler in D, then I'd like to know about it. For example I do know that D's system allows you to insert callback

Re: Rethrow an exception like in C++?

2013-03-08 Thread Rob T
On Friday, 8 March 2013 at 19:58:10 UTC, H. S. Teoh wrote: On Fri, Mar 08, 2013 at 08:52:21PM +0100, Rob T wrote: On Friday, 8 March 2013 at 06:05:02 UTC, Maxim Fomin wrote: >catch (Exception e) { >if (typeid(e) == typeid(myException1)) >throw e; // may be downc

Re: Throw in a pre-condition of a nothrow function

2013-03-08 Thread Rob T
On Friday, 8 March 2013 at 19:39:47 UTC, bearophile wrote: Currently this code compiles: [...] Nice edge case to test the compiler with. Definitely looks like a bug. It should not compile given the nothrow attrib. If it was throwable, what to do about throwing a null reference is an intere

Re: Rethrow an exception like in C++?

2013-03-08 Thread Rob T
On Friday, 8 March 2013 at 06:05:02 UTC, Maxim Fomin wrote: catch (Exception e) { if (typeid(e) == typeid(myException1)) throw e; // may be downcasted, if necessary // to work with specific fields } Isn't it better to check identity in this way?

Re: Rethrow an exception like in C++?

2013-03-08 Thread Rob T
On Friday, 8 March 2013 at 17:40:38 UTC, Ali Çehreli wrote: On 03/08/2013 12:39 AM, Rob T wrote: > In C++ you can do this > > std::exception Trace() > { > try > { > // key item missing from D > throw; // <= rethrow last exception This idiom is know as a Lippincott

Re: Rethrow an exception like in C++?

2013-03-08 Thread Rob T
On Friday, 8 March 2013 at 18:56:38 UTC, Andrej Mitrovic wrote: On 3/8/13, Jonathan M Davis wrote: In both cases, you're telling it to catch everything. Also, catch points should be rare, especially the ones which catch base types like Exception or even Error or Throwable. The problem is no

Re: Rethrow an exception like in C++?

2013-03-08 Thread Rob T
On Friday, 8 March 2013 at 18:49:53 UTC, Jonathan M Davis wrote: Except that the C++ one is just as pointless. In both cases, you're telling it to catch everything. It's just that syntax is slightly different, because D doesn't allow you to throw without an explicit variable. And it's only a ha

Re: Rethrow an exception like in C++?

2013-03-08 Thread Rob T
On Friday, 8 March 2013 at 09:01:29 UTC, Jacob Carlborg wrote: On 2013-03-08 08:34, Rob T wrote: One more thing, we finally got __FUNCTION__ (and more) added to MASTER so that's another missing item that was sorely missed. Now we can easily log what functions are catching and thr

Re: Rethrow an exception like in C++?

2013-03-08 Thread Rob T
On Friday, 8 March 2013 at 09:07:59 UTC, Chris Cain wrote: On Friday, 8 March 2013 at 09:01:14 UTC, Jonathan M Davis wrote: If that's the case, I really don't see what the problem is. It's just a few characters difference. To be honest, the way I look at it, D does this _better_. "throw;" lo

Re: Rethrow an exception like in C++?

2013-03-08 Thread Rob T
On Friday, 8 March 2013 at 07:58:42 UTC, Jonathan M Davis wrote: [...] Then you can clearly do something here in C++ that I don't understand, because I have absolutely no idea how you could do anything the exception if you did catch(...), because there's no variable to work with. Check this

Re: Rethrow an exception like in C++?

2013-03-07 Thread Rob T
One more thing, we finally got __FUNCTION__ (and more) added to MASTER so that's another missing item that was sorely missed. Now we can easily log what functions are catching and throwing exceptions, and more. The big question is if Throwable will be expanded to automatically capture the fun

Re: Rethrow an exception like in C++?

2013-03-07 Thread Rob T
On Friday, 8 March 2013 at 06:09:48 UTC, Jonathan M Davis wrote: [...] C++ has no exception capabilities that D doesn't have. Except that D cannot rethrow without explicitly catching. That may seem like a very minor item, but as I explained in my last post, the extra boiler plate coding can a

Re: Rethrow an exception like in C++?

2013-03-07 Thread Rob T
On Friday, 8 March 2013 at 06:05:02 UTC, Maxim Fomin wrote: Actually no. class myException1 : Exception { this() { super("1"); } } class myException2 : Exception { this() { super("2"); } } [...] Thanks! That solves 99% of my problem. I wasn't aware that I could check the derived type from a

Re: Rethrow an exception like in C++?

2013-03-07 Thread Rob T
On Friday, 8 March 2013 at 01:56:45 UTC, Andrej Mitrovic wrote: On 3/8/13, Rob T wrote: In C++, I rethrow an exception without explicitly catching it catch(...) { throw; } Anyone know of a way to do the same thing in D? catch { // rethrow? } The only way: try { } catch

Rethrow an exception like in C++?

2013-03-07 Thread Rob T
In C++, I rethrow an exception without explicitly catching it catch(...) { throw; } Anyone know of a way to do the same thing in D? catch { // rethrow? } --rt

Re: unpredictableSeed

2013-03-04 Thread Rob T
On Monday, 4 March 2013 at 11:04:46 UTC, Joseph Rushton Wakeling wrote: On 03/04/2013 09:58 AM, Andrea Fontana wrote: Maybe you can try to connect an external hardware device (e.g. arduino) and read some params from real world... :) Yes, there are nice options here ... :-) However, to re-foc

Re: unpredictableSeed

2013-03-03 Thread Rob T
On Saturday, 2 March 2013 at 17:40:58 UTC, Joseph Rushton Wakeling wrote: Hello all, Can anyone advise on the theoretical basis for the unpredictableSeed method in std.random? I've tried googling around for the theory of good thread-safe seed generation methods but haven't really found anyth

Re: Aliasing specialized template stuct in his module leads troubles

2013-03-02 Thread Rob T
On Saturday, 2 March 2013 at 03:59:59 UTC, H. S. Teoh wrote: On Sat, Mar 02, 2013 at 04:17:10AM +0100, Rob T wrote: In my case, the problem had to do with the order in which I was linking my static libs, simply changing the order resolved the undefined references. Turns out it's a c

Re: Aliasing specialized template stuct in his module leads troubles

2013-03-01 Thread Rob T
In my case, the problem had to do with the order in which I was linking my static libs, simply changing the order resolved the undefined references. Turns out it's a common problem when working with static libs and it's unrelated to D. --rt

Re: __FUNCTION__?

2013-02-26 Thread Rob T
On Monday, 25 February 2013 at 16:32:50 UTC, js.mdnq wrote: We have __FILE__ and __LINE__. Is there a __FUNCTION__ that gives the current function name? This helps with errors. As was previously stated there's a pending pull request that properly implements __FUNCTION__ and more. If you can'

Re: Aliasing specialized template stuct in his module leads troubles

2013-02-15 Thread Rob T
On Tuesday, 4 September 2012 at 22:46:00 UTC, Ivan Agafonov wrote: I have my library module: module mylib.vector; // alias Vector!(float, 4) Vector4f; struct Vector(T, uint size) { T[size] array = 0; ... }

Re: Aliasing specialized template stuct in his module leads troubles

2013-02-15 Thread Rob T
One more thing about this. If I leave in the alias in the same module where the template is defined, and also re-define the same alias in the other modules that make use out of it, the libraries will compile OK, but I'll get linking errors when I try to build an executable and link in the libs.

Re: std.container.RedBlackTree versus C++ std::set

2013-02-14 Thread Rob T
On Thursday, 14 February 2013 at 19:56:33 UTC, Namespace wrote: There are discussions for such thing for almost a year - but nothing has changed so far. I think its finally on the priority radar, but there's still other things in more dire need to be resolved first, like @property and lack

Re: std.container.RedBlackTree versus C++ std::set

2013-02-14 Thread Rob T
On Thursday, 14 February 2013 at 19:31:36 UTC, Steven Schveighoffer wrote: On Thu, 14 Feb 2013 13:45:30 -0500, Rob T wrote: When I look at the std.container source code, it seems that the payload element is passed by value multiple times unnecessarily, so to minimize copy construction

Re: std.container.RedBlackTree versus C++ std::set

2013-02-14 Thread Rob T
When I look at the std.container source code, it seems that the payload element is passed by value multiple times unnecessarily, so to minimize copy construction you'll have to implement element as a class and implement a dup function for it. I expect performance will increase substantially ev

Re: std.container.RedBlackTree versus C++ std::set

2013-02-14 Thread Rob T
On Thursday, 14 February 2013 at 06:56:38 UTC, monarch_dodra wrote: On Wednesday, 13 February 2013 at 23:22:03 UTC, Ivan Kazmenko wrote: Hi! - Ivan Kazmenko. Keep in mind that C++ and D have very different philosophies regarding copy construction. C++ has "strong ownership", so for exam

Re: std.container.RedBlackTree versus C++ std::set

2013-02-13 Thread Rob T
On Thursday, 14 February 2013 at 00:25:15 UTC, FG wrote: On 2013-02-14 01:09, Rob T wrote: You can check if disabling the GC just before the insert process improves the performance. You may see 3x performance improvement. Disabling is safe provided you re-enable, this can be done reliably with

Re: std.container.RedBlackTree versus C++ std::set

2013-02-13 Thread Rob T
You can check if disabling the GC just before the insert process improves the performance. You may see 3x performance improvement. Disabling is safe provided you re-enable, this can be done reliably with scope(exit) or something similar. import core.memory; // ... void main () { aut

Re: Finding large difference b/w execution time of c++ and D codes for same problem

2013-02-12 Thread Rob T
Well technically it was that much faster because it did optimize away the useless calcOn Tuesday, 12 February 2013 at 23:31:17 UTC, FG wrote: On 2013-02-13 00:06, Sparsh Mittal wrote: I had a look, but first had to make juliaValue global, because g++ had optimized all the calculations away.

Re: Getting the parameters of a struct/class constructor

2013-01-24 Thread Rob T
On Thursday, 24 January 2013 at 22:49:33 UTC, Andrej Mitrovic wrote: On 1/24/13, Philippe Sigaud wrote: IIRC, you can use __traits(getOverloads, mytype.__ctor) to get all constructor overloads. See: http://dlang.org/traits.html#getOverloads I used this in conjunction with __traits(getMember,

Re: Getting the parameters of a struct/class constructor

2013-01-24 Thread Rob T
On Thursday, 24 January 2013 at 18:41:31 UTC, mist wrote: You can use "magic" functions __ctor and __dtor which actually serve as constructor and destructor implementations behind the scene. Example and proof-of-concept: http://dpaste.1azy.net/fd924332 Have no idea if it is explicitly defined

Re: Getting the parameters of a struct/class constructor

2013-01-24 Thread Rob T
There may be more than one "this", so you'll have to specify the args for each specific constructor manually. Disclaimer: Someone else may have a better solution as I'm not that much of an expert in this area. This sample may point you in the right direction ... import std.typetuple; struct

Re: Why is null lowercase?

2013-01-24 Thread Rob T
On Thursday, 24 January 2013 at 12:56:03 UTC, Matthew Caron wrote: This is probably a question for Walter, but maybe others know. Of all of the differences between C and D, the one which I have the most difficulty adapting to is null being lowercase. Does anyone know why this decision was made

Re: std.socket undefined UnixAddress?

2013-01-24 Thread Rob T
I solved the problem by creating my own version of UnixAddress. The existing implementation needs some work. I'll filed a bug report. http://d.puremagic.com/issues/show_bug.cgi?id=9384 --rt

Re: std.socket undefined UnixAddress?

2013-01-23 Thread Rob T
On Thursday, 24 January 2013 at 06:47:41 UTC, Rob T wrote: I'm using Linux, which supports unix domain sockets, but when I try to use UnixAddress it's not available. Anyone know why? import std.socket; int main() { Address UnixAddr = new UnixAddress( "path" );

std.socket undefined UnixAddress?

2013-01-23 Thread Rob T
I'm using Linux, which supports unix domain sockets, but when I try to use UnixAddress it's not available. Anyone know why? import std.socket; int main() { Address UnixAddr = new UnixAddress( "path" ); // <- compile error return(0); } Error: undefined identifier UnixAddress --rt

Re: extern (D)?

2013-01-18 Thread Rob T
On Friday, 18 January 2013 at 04:46:46 UTC, Andrej Mitrovic wrote: On 1/18/13, Rob T wrote: however I read somewhere that it pretty much does nothing but strip out the comments because it needs the full source code for a inlining, CTFE, and templates. There was a recent pull that

Re: How to use a function without their sources

2013-01-18 Thread Rob T
On Friday, 18 January 2013 at 17:02:51 UTC, Jordi Sayol wrote: Is there a way to use a function from a static D library without importing their D sources nor their DI interface? Yes you should be able to do it, but not everything can be imported without the source code, for example function te

Re: extern (D)?

2013-01-18 Thread Rob T
On Friday, 18 January 2013 at 07:34:35 UTC, Jacob Carlborg wrote: You cannot both have CTFE/inlining/templates and hide the source code. It's the same as in C++. Yes I am aware of that limitation, nothing can be done except lose the flexibility of templates and so forth, or keep it and expo

Re: extern (D)?

2013-01-17 Thread Rob T
On Friday, 18 January 2013 at 02:08:46 UTC, Andrej Mitrovic wrote: The other way is to use D interface files, which the compiler can automatically generate for you if you pass the -H switch. Also use the -op switch if you're generating multiple files at once, which will preserve directory path

Re: extern (D)?

2013-01-17 Thread Rob T
On Friday, 18 January 2013 at 01:07:05 UTC, Justin Whear wrote: You can use "extern(D)" or simply "extern"; this is described here: http://dlang.org/attribute.html#linkage Justin So there is an extern (D), excellent! Slightly embarrassed I didn't find this for myself. --rt

extern (D)?

2013-01-17 Thread Rob T
The usual way to link in D libs into D code is to include the required D module source files, but that gives away all of the source code which in some instances is not possible to do (eg legal reasons). The other way is to create a c-style API using extern (C), but that means translating some s

Re: tiny std.datetime question

2013-01-17 Thread Rob T
On Thursday, 17 January 2013 at 07:17:57 UTC, Jonathan M Davis wrote: I'd still like to break it up a bit, but I'm not going to do it unless some variant of DIP15 or DIP16 is implemented so that it can be done without breaking any code. So, it probably won't be broken up any time soon. It's not

Re: tiny std.datetime question

2013-01-16 Thread Rob T
On Thursday, 17 January 2013 at 06:26:21 UTC, Jonathan M Davis wrote: On Thursday, January 17, 2013 07:15:14 Rob T wrote: On Wednesday, 16 January 2013 at 13:07:48 UTC, n00b wrote: > Hello, I'm kinda ashamed to ask that here, but std.datetime > documentation is so complex... You

Re: tiny std.datetime question

2013-01-16 Thread Rob T
On Wednesday, 16 January 2013 at 13:07:48 UTC, n00b wrote: Hello, I'm kinda ashamed to ask that here, but std.datetime documentation is so complex... You'll likely have a much easier time reading this. http://vibed.org/temp/d-programming-language.org/phobos/std/datetime.html Those pages are e

Re: Derelict SFML destructor crashes

2012-12-18 Thread Rob T
On Tuesday, 18 December 2012 at 13:47:43 UTC, Mike Parker wrote: I *think* I've got it sorted. If you try again, it should work. I tried it again just now and it worked. Thanks! --rt

Re: Derelict SFML destructor crashes

2012-12-17 Thread Rob T
On Monday, 17 December 2012 at 04:40:39 UTC, Mike Parker wrote: First, please take all Derelict trouble-shooting problems to the Derelict forums[1]. I'm posting here because I was unable to register with the derelict forum. I filled out the registration form and press the register button, t

Re: alias this

2012-12-01 Thread Rob T
On Saturday, 1 December 2012 at 21:33:15 UTC, js.mdnq wrote: By full signature overloading I assuming you also the return type? Correct. I don't see why it is so complicated in any case since a return type can just be seen as a ref argument: int myfunc() is basically the same as void

Re: static initialization of structs

2012-12-01 Thread Rob T
On Saturday, 1 December 2012 at 18:36:35 UTC, Dan wrote: In the thread on compiling DSSS and build tools someone mentioned a format for initializing environment data of a struct: Environment env = { tests: true, verbose: true, importDirs: ["../deimos"] } A followup co

Re: struct initialization and assignment by field name

2012-12-01 Thread Rob T
On Saturday, 1 December 2012 at 19:32:27 UTC, bearophile wrote: I don't know the rationale. There are tons of things I don't know the rationale of, despite my efforts to learn. The normal way to write a struct literal in D is this, that works in most cases: auto foo = MyStruct(42, 'a'); A

Re: alias this

2012-12-01 Thread Rob T
On Friday, 30 November 2012 at 23:11:28 UTC, js.mdnq wrote: I've seen that, how does it work? struct A{ Sometype val1; int val2; alias val1 this; alias val2 this; //??? } How can A act both as Sometype and int? (at least without major issues) Does the compiler try to choose the appropria

Re: alias this

2012-11-30 Thread Rob T
On Friday, 30 November 2012 at 14:14:36 UTC, js.mdnq wrote: On Friday, 30 November 2012 at 14:02:42 UTC, Andrej Mitrovic wrote: On 11/30/12, js.mdnq wrote: alias t this; This should explain: http://dlang.org/class.html#AliasThis Thanks, I'm sure I saw that at some point but I guess it just

Re: constructor instead of opCall for an instance of a template alias

2012-11-25 Thread Rob T
On Sunday, 25 November 2012 at 16:42:03 UTC, Maxim Fomin wrote: Recently I saw a major pull affecting this behavior, so in 2.061 the situation may be changed (I haven't bother to figure yet). In practice this makes a tricky thing to understand what S() is and creates a problem when you e.x. hea

Re: constructor instead of opCall for an instance of a template alias

2012-11-24 Thread Rob T
On Saturday, 24 November 2012 at 20:34:39 UTC, comco wrote: I have the following snippet: struct A(alias Method) { string s; this(Method method) { method(s); // 5 } } struct B { this(int i) { } void opCall(string s) { } } void main() { A!B(B(0)); } This code

Re: Returning const ref (structs) in D

2012-11-24 Thread Rob T
On Saturday, 24 November 2012 at 22:01:32 UTC, Stian wrote: Is the compiler sophisticated enough that is it able to avoid the copying. For instance, if i have a struct Matrix4x4 a = node.getTransformation() and use a for whatever, but never alter it, will it be able to avoid the copy? What if i

Re: Can I call the default opAssign after overloading opAssign?

2012-11-24 Thread Rob T
On Saturday, 24 November 2012 at 20:47:17 UTC, Era Scarecrow wrote: This kind of behavior *really* needs to be documented in precise detail, it's rather critical to know. It IS documented. TDPL - pg. 248 [quote] Thanks for pointing out where the postblit stuff is documented. When I first st

Re: Can I call the default opAssign after overloading opAssign?

2012-11-23 Thread Rob T
On Monday, 19 November 2012 at 12:10:32 UTC, Dan wrote: [...] provide it - you do not need an opAssign at all, as your postblit will be called. I think this is a step up over C++. The example below prints: -- Begin assign postblit A End assign --

Re: Can functions add properties?

2012-11-23 Thread Rob T
On Friday, 23 November 2012 at 14:08:05 UTC, Jun wrote: I've never seen any documentation about this behaviour. I think it's a good feature, but I'm a bit confused. More info here http://www.drdobbs.com/cpp/uniform-function-call-syntax/232700394 UFCS is relatively new and has not been included

Re: Can I call the default opAssign after overloading opAssign?

2012-11-19 Thread Rob T
On Monday, 19 November 2012 at 09:37:35 UTC, Jonathan M Davis wrote: On Monday, November 19, 2012 10:29:21 Rob T wrote: the D language specification (which is currently MIA). The online documentation _is_ the official spec, though it definitely doesn't have enough detail to be unambi

Re: Can I call the default opAssign after overloading opAssign?

2012-11-19 Thread Rob T
On Monday, 19 November 2012 at 06:32:56 UTC, Jonathan M Davis wrote: I'm not sure. Close certainly. But if any member variables define an opAssign, then the compiler probably calls them rather than doing a simple memcpy. I'm not sure though. If it does, then a memcpy would not exhibit the same

Re: Can I call the default opAssign after overloading opAssign?

2012-11-18 Thread Rob T
I think you've cleared things up for me. When I define an opAssign, I'm not really overriding a default opAssign, because there is none, instead I'm overriding the default behavior which is to perform a memcopy-like operation. So if I defined an opAssign function, but for some odd reason I w

Re: Can I call the default opAssign after overloading opAssign?

2012-11-18 Thread Rob T
I assume that when I define an opAssign, only the opAssign that I define gets called, which means there's no blit or postblit being called ever again. I may be thoroughly confused at this point. Is there both a blit and a postblit, and an optional opAssign that when specified will override bo

  1   2   >