Re: Templates in classes = what is wrong?

2012-04-17 Thread Dejan Lekic
On Tuesday, 17 April 2012 at 14:57:18 UTC, Xan wrote: On Tuesday, 17 April 2012 at 01:31:43 UTC, Kenji Hara wrote: On Monday, 16 April 2012 at 18:48:52 UTC, Xan wrote: On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote: On 04/15/2012 11:39 AM, Xan wrote: On Sunday, 15 April 2012 at

Re: shared status

2012-04-17 Thread Dejan Lekic
On Saturday, 14 April 2012 at 10:48:16 UTC, Luis Panadero Guardeño wrote: What is the status of shared types ? I try it with gdmd v4.6.3 And I not get any warring/error when I do anything over a shared variable without using atomicOp. It's normal ? shared ushort ram[ram_size];

Re: Aquivalent References as in C++?

2012-04-17 Thread Dejan Lekic
On Tuesday, 17 April 2012 at 09:39:10 UTC, Namespace wrote: On Tuesday, 17 April 2012 at 08:02:02 UTC, Namespace wrote: Now i have something like this. It works and manipulates lvalues so that i can pass my objects by ref to except null. But is this smart? class Bar { public: int x;

Re: Object Serialization?

2012-04-27 Thread Dejan Lekic
dcoder wrote: Hello. I'm probably not looking hard enough, but Do we have any standard d-library for serializing an object/object tree into -for example- an xml file? thanks. You have following - Orange - Thrift implementation - BSON (http://vibed.org) Probably wrappers or bindings

Re: Malloc in D

2012-04-27 Thread Dejan Lekic
On Friday, 27 April 2012 at 09:05:12 UTC, Marcin wrote: Hi! I find code: [code] import c.stdlib; import c.stdlib; import std.outofmemory; class Foo{ static void[] buffer; static int bufindex; static const int bufsize = 100; static this(){ void *p;

Re: unsynchronized access to primitive variables

2012-05-20 Thread Dejan Lekic
On Saturday, 19 May 2012 at 08:16:39 UTC, luka8088 wrote: Hello to all, I would like to know if D guarantees that access to primitive variable is atomic ? I was looking for any source of information that says anything about unsynchronized access to primitive variables. What I want to know

Re: state of web programming

2012-05-25 Thread Dejan Lekic
bioinfornatics wrote: it is a list of project lo look if yo want create a web application in D - https://github.com/mrmonday/serenity - https://github.com/adamdruppe/misc-stuff-including-D-programming-language- web-stuff - https://github.com/Aatch/dfcgi -

Re: Build / Package system

2012-05-30 Thread Dejan Lekic
On Wednesday, 30 May 2012 at 08:13:34 UTC, Sputnik wrote: There is a build and/or package managment system for D2 that is working? I googled, and I only can find things like dsss or cmaked that don't get updated from a long time ago. I really need to manage to get a project to compile in

Re: Simplified socket creation and handling

2012-05-30 Thread Dejan Lekic
On Friday, 18 May 2012 at 06:35:59 UTC, Jarl André wrote: I am a Java developer who is tired of java.nio and similar complex socket libraries. In Java you got QuickServer, the ultimate protocol creation centered socket library. You don't have to write any channels and readers and what not.

Re: Segmentation fault hell in D

2012-06-09 Thread Dejan Lekic
. That#39;s pretty much thebr standard way to figure out what happened when a segfault occurs.br /blockquotediv /divdivAnd use GDC because DMD#39;s debug symbols on Linux are broken enough to crash GDB at times. GDC is generally flawless. /div/div Ah noes, HTML code again... -- Dejan Lekic

Re: Concurrency in D

2012-06-29 Thread Dejan Lekic
didn't try too much to be honest). For all those appoaches, which is the preffered? For all those appoaches, which is the preffered for game programming? Thank you. Both std.concurrency and std.parallelism need core.thread in order to do what they do... -- Dejan Lekic mailto:dejan.lekic

Re: foreach syntax

2012-06-29 Thread Dejan Lekic
maybe someone here knows the reasons. Because 1) in is a D keyword 2) D has even shorter syntax: foreach(val; arr) {} -- Dejan Lekic mailto:dejan.lekic(a)gmail.com http://dejan.lekic.org

Re: Using MinGW DLL with DMD?

2012-08-09 Thread Dejan Lekic
On Thursday, 9 August 2012 at 13:43:18 UTC, Jacob Carlborg wrote: Is it possible to link a DLL compiled for MinGW with DMD? Yes, it is possible. Long ago i have dealt with this almost on a daily basis (we used Borland C++ Builder on Windows in the former company I worked for). The easiest

Re: Using MinGW DLL with DMD?

2012-08-09 Thread Dejan Lekic
On Thursday, 9 August 2012 at 13:48:14 UTC, Adam D. Ruppe wrote: On Thursday, 9 August 2012 at 13:43:18 UTC, Jacob Carlborg wrote: Is it possible to link a DLL compiled for MinGW with DMD? Yeah, I've use dlls made in gcc with dmd. You need to run implib over the dll to get a .lib and then it

Re: Is there a portable way to limit memory/cpu usage of a D application?

2012-11-29 Thread Dejan Lekic
On Thursday, 29 November 2012 at 04:44:34 UTC, Mike Young wrote: On Wednesday, 9 November 2011 at 17:13:14 UTC, Dejan Lekic wrote: Sure nothing prevents me from using setrlimit() in my D app, but perhaps it is something to think about a portable way of doing that. I know I'm over a year

Re: How to read fastly files ( I/O operation)

2013-02-04 Thread Dejan Lekic
objects fit one page, and read the file page by page. The page-size can easily be obtained from the system. IMHO that would beat this fastxtoolkit. :) -- Dejan Lekic dejan.lekic (a) gmail.com http://dejan.lekic.org

Re: D is totally useless

2013-05-01 Thread Dejan Lekic
you include opengl32 in the DMD package?? -- Dejan Lekic dejan.lekic (a) gmail.com http://dejan.lekic.org

Re: enum and tuples

2013-08-10 Thread Dejan Lekic
On Friday, 9 August 2013 at 21:24:30 UTC, Ali Çehreli wrote: On 08/09/2013 12:41 PM, captaindet wrote: On 2013-08-09 11:36, Ali Çehreli wrote: as I am in the process of revising and translating a Tuples chapter. as a matter of fact, i am checking your website regularly, eagerly awaiting

Re: Communication between Java and D application

2013-09-14 Thread Dejan Lekic
On Fri, 13 Sep 2013 22:04:24 +0200, Anton Alexeev wrote: I have a method in a D program which I want to call from a Java program. What is the best way to do this? What you need is Java JNI: http://en.wikipedia.org/wiki/ Java_Native_Interface . There are many examples how to do this in C or C+

Re: [OT] Job postings

2013-09-14 Thread Dejan Lekic
On Fri, 13 Sep 2013 15:20:47 +0200, Joseph Rushton Wakeling wrote: Hello all, OT question -- is there an etiquette/standard accepted practice for posting news of job openings to the D community? I wouldn't normally do this, but in this case it's on behalf of friends for whom I have a very

Re: Module to work with environment variables

2013-09-14 Thread Dejan Lekic
On Sat, 14 Sep 2013 19:23:31 +0200, FreeSlave wrote: As I remember there was module to work with environment variables in standard library. But now I can't find it. Was it removed or merged with some other module? Another question: I see some of modules are considered out-dated and not up

Re: fedora libcurl-gnutls issue

2013-09-27 Thread Dejan Lekic
On Friday, 27 September 2013 at 16:41:42 UTC, Joshua Niehus wrote: http://d.puremagic.com/issues/show_bug.cgi?id=10710 Does anyone know if there is there a workaround for this issue? Unfortunately Im stuck with fedora and cant jump to another OS... Thanks Option 1: Rebuild curl RPM with

Re: Embed JavaScript into D

2013-11-04 Thread Dejan Lekic
On Mon, 04 Nov 2013 20:35:53 +0100, Jeroen Bollen wrote: Is there a way I can embed javascript into my D application? I basically want to create a modular application which allows adding and removing plugins by dragging and dropping them into a folder. I love the idea of them being editable

Re: std.concurrency : sending immutable classes

2013-11-11 Thread Dejan Lekic
When I run this program, I get a runtime error which gives me a headache: http://codepad.org/vKJl11cO

Re: std.concurrency : sending immutable classes

2013-11-11 Thread Dejan Lekic
Could it be something changed in DMD recently, as in my case (DMD64 D Compiler v2.063.2, on Fedora GNU/Linux) it obviously picks Variant. Why it does not pick the immutable instance of A is beyond me. If we reverse the order of arguments in the receive(), we will get the function with

Re: std.concurrency : sending immutable classes

2013-11-11 Thread Dejan Lekic
On Tue, 12 Nov 2013 00:37:30 +0100, Dicebot wrote: Minimized repro: import std.variant; class A {} void main() { Variant v = new immutable A(); auto x = v.get!(immutable A)(); // triggers assert } One simple question - did this ever work? :) Because passing immutable

Re: T[] (array of generic type)

2013-11-19 Thread Dejan Lekic
On Mon, 18 Nov 2013 21:32:11 +0100, Philippe Sigaud wrote: On Mon, Nov 18, 2013 at 9:20 PM, seany se...@uni-bonn.de wrote: I read that book, but dont find this constructtion, that is why the question. IIRC I talk a bit about function templates in my tutorial. JR gave the link (thanks!),

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-24 Thread Dejan Lekic
On Saturday, 23 November 2013 at 23:47:11 UTC, Adam D. Ruppe wrote: On Saturday, 23 November 2013 at 23:30:09 UTC, Jeroen Bollen wrote: I added the code to my GitHub repo; there don't seem to be any uncommon associative arrays: Yea, it is the immutable string[string], I used the same pattern

Re: Composing features at compile time

2013-11-24 Thread Dejan Lekic
://en.wikipedia.org/wiki/Composition_over_inheritance . C# example is exactly how I do this (in Java and D). -- Dejan Lekic dejan.lekic (a) gmail.com http://dejan.lekic.org

Re: How to install dmd2 in centos 5.3 x64

2013-12-03 Thread Dejan Lekic
On Tuesday, 3 December 2013 at 10:43:06 UTC, Puming wrote: Hi: I followed the steps in http://dlang.org/dmd-linux.html, but when I build a simple hello world program with: rdmd hello.d I get the following error: rdmd hello.d /usr/bin/ld: cannot find -l:libphobos2.a I have copied

Re: stdout - autoflushing

2013-12-06 Thread Dejan Lekic
a = readln(); write(And again please: ); stdout.flush(); string b = readln(); ... Is there any way to prevent this? I doubt. Your IDE is buffering application's streams. -- Dejan Lekic dejan.lekic (a) gmail.com http://dejan.lekic.org

Re: My first D module - Critiques welcome.

2013-12-25 Thread Dejan Lekic
. -- Dejan Lekic dejan.lekic (a) gmail.com http://dejan.lekic.org

Re: Are modules analogous to namespaces in C# or packages in Java?

2014-01-02 Thread Dejan Lekic
On Wednesday, 1 January 2014 at 17:43:54 UTC, Afshin wrote: Modules confuse me as a way to organize code. If a module is composed of multiple classes, it seems that the module semantics in D encourages putting all those classes in one file. Can someone explain how to organize a set of

Re: std.xml

2014-01-10 Thread Dejan Lekic
On Friday, 10 January 2014 at 00:02:14 UTC, Ola Fosheim Grøstad wrote: The std.xml documentation states This module is considered out-dated and not up to Phobos' current standards. Does this mean that there is some other module I should use for xml parsing? Maybe one that is not in the

Re: Learning D as main systems programming language

2014-01-10 Thread Dejan Lekic
On Friday, 10 January 2014 at 00:05:35 UTC, Goran Petrevski wrote: You might want to look into XOmB: https://github.com/xomboverlord/xomb Isn't it written in D1? Not sure about that... So what if it is written in D1? :) It should not be a big problem to port it to D2. Second interesting

Re: What's the D way of application version numbers?

2014-01-13 Thread Dejan Lekic
On Sunday, 12 January 2014 at 18:36:19 UTC, Russel Winder wrote: With C++ and Python, it is idiomatic to put the application version number in a separate file that can then be processed by the build system. For C++ a config file is constructed defining a macro that is then used in the rest of

Re: fibers/coroutines tutorial?

2014-01-24 Thread Dejan Lekic
On Friday, 24 January 2014 at 16:02:27 UTC, Hasan wrote: Is there a quick tutorial/intro for what D offers as an equivalent or alternative to goroutines? I've seen the concurrency link on the homepage .. and umm .. call me lazy but I don't feel like reading through all that just to see what

Re: Timer

2014-02-17 Thread Dejan Lekic
On Monday, 17 February 2014 at 11:08:16 UTC, Chris wrote: The D way of implementing a timer? I need to (automatically) execute a function that performs a clean up, say every hour. if (file.older than 1 hour) { remove; } Here is a quick timer implementation that you can improve yourself:

Re: What does q{...} mean?

2014-02-24 Thread Dejan Lekic
Gary Willoughby wrote: I keep seeing this syntax used a bit and i'm stumped to what it means. What is it? enum foo = q{ // ??? }; q{} string literals (so-called token strings) are a nice D feature - D garantees that tokens in between brackets are valid D tokens. This makes them

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Dejan Lekic
On Tuesday, 25 February 2014 at 12:57:51 UTC, Dejan Lekic wrote: On Tuesday, 25 February 2014 at 12:45:06 UTC, Cherry wrote: Hello I want to define an enum int, but I want to make it possible to set its value when I run dmd from the command line. Is it possible in D? Regards Cherry D

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Dejan Lekic
On Tuesday, 25 February 2014 at 12:45:06 UTC, Cherry wrote: Hello I want to define an enum int, but I want to make it possible to set its value when I run dmd from the command line. Is it possible in D? Regards Cherry D offers version blocks: http://dlang.org/version.html#version It

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Dejan Lekic
On Tuesday, 25 February 2014 at 13:21:38 UTC, bearophile wrote: Dejan Lekic: And yes, if someone builds multiple modules, he/she would have to use fully-qualified name. Example: dmd foo.d bar.d -Dfoo.var1=5 -Dbar.var4=walter If you are interested in such things I suggest you to take a look

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Dejan Lekic
I don't like it. I would prefer a CTFE-able counter part to boost::program_options that generates thouse enums from a config file. If you want a config file, you do not need -D args. You simply import() it. Right?

Re: Template mixins - why only declarations

2014-03-06 Thread Dejan Lekic
Template mixins can't contain statements, only declarations, because they (template mixins) are a way to inject code into the context. Therefore it makes sense to forbid statements, as they can't appear in ANY context. -- http://dejan.lekic.org

Re: D project structure

2014-03-28 Thread Dejan Lekic
On Wednesday, 26 March 2014 at 16:13:15 UTC, Russel Winder wrote: Is it the case that the Dub recommended project structure is in fact the canonical D project structure? The Dub recommended structure doesn't mention test code as opposed to application/library source code, is it the case that

Re: A lot of people want to use D,but they only know MS SQL Server,what will help them to Learn D?

2014-04-14 Thread Dejan Lekic
On Monday, 14 April 2014 at 15:21:33 UTC, FrankLike wrote: Hello,everyone: A lot of people want to use D,but they only know MS SQL Server,what will help them to Learn D? So lots of people want to use D,who can help them? They want to connect MS SQL Server in D,then they will connect other

Re: Stop TypeTuple as template parameter from expanding

2011-11-04 Thread Dejan Lekic
bearophile wrote: Tobias Pankrath: How would you do this? Do I need an extra template TypeList? It's the design of typetuples, they are auto-flattening. I have never appreciated this design. Maybe Walter likes them this way, or they can't be designed in another way, I don't know. Bye,

Re: FIFO stack

2011-11-04 Thread Dejan Lekic
Dominic Jones wrote: Hello, I was looking for a FIFO stack in std.containers but only found SList and Array which both appear to essentially operate as LIFO stacks. Is there any standard container with which I can push items on to a list, then later pop them off from the bottom of that

Re: My new least favorite one-liner...

2011-11-07 Thread Dejan Lekic
Regan Heath wrote: You've also got std.ascii.digits which is 0123456789 and std.string.digits which is an alias of it, so you can say: import std.ascii; (or std.string) int x = 5; char c = std.ascii.digits[x]; I used similar solution to bearophile's before. I must admit i did not know

Re: extends and implements

2011-11-07 Thread Dejan Lekic
Andrej Mitrovic wrote: class Rectangle : IShape, Drawable {} It's pretty common in other languages, I've seen it used in D as well. I used the same naming convention for interfaces until I saw this presentation: http://www.infoq.com/presentations/It-Is-Possible-to-Do-OOP- in-Java (jump to

Re: web development in D programming

2011-11-09 Thread Dejan Lekic
bioinfornatics wrote: I am a little disapointed, so if you have many request for a web page this lib http://arsdnet.net/dcode/ is usable or not ? I am developing an implementation of the FastCGI protocol (http://www.fastcgi.com) in D2 with the main goal go have multiplexing support.

Is there a portable way to limit memory/cpu usage of a D application?

2011-11-09 Thread Dejan Lekic
I would be satisfied with something like POSIX.1-2001 setrlimit() . Sure nothing prevents me from using setrlimit() in my D app, but perhaps it is something to think about a portable way of doing that. One thing I like about my Java apps is that I can always specify (in the argument list) how

Re: Database API

2011-11-10 Thread Dejan Lekic
Somedude wrote: Hello, what is the currently DB API considered usable today ? http://prowiki.org/wiki4d/wiki.cgi?DatabaseBindings#ODBC d-dbapi looked quite decent, but the source code is no longer available :( Thank you Dude Try this alternative -

Re: Mutable enums

2011-11-14 Thread Dejan Lekic
so wrote: immutable a; sort(a); But with current design you can do: enum a; sort(a); Which is to me, quite wrong. It is not wrong at all.

Re: Generic array

2011-11-16 Thread Dejan Lekic
RenatoL wrote: ##[3] arr = [0, aa, 2.4]; What can i put instead of ##? In C#, just for example, i can write: object[] ar1 = new object[3]; ar1[0] = 1; ar1[1] = hello; ar1[2] = 'a'; and it works. But in D Object[3] arr0 = [0, aa, 2.4]; and compiler complains In D, the

Re: Fields size property

2011-11-18 Thread Dejan Lekic
Andrej Mitrovic wrote: .sizeof on a struct works nicely since it's a POD, but this can't work on classes since it just returns the pointer size. I don't know whether this is useful all that much, but I'm curious how large my classes are. Anyway, since I couldn't find anything in Phobos

Re: DFastCGI

2011-11-22 Thread Dejan Lekic
Good news! This should be a part of the Deimos organisation. :) Also, the post should be in the D.announce newsgroup. :) Well-done!

Re: Fields size property

2011-11-22 Thread Dejan Lekic
This one is not good either because it does not include TypeInfo, etc... __traits(classInstanceSize, T)) is better choice, as Ali said... :)

Re: piping processes

2011-12-01 Thread Dejan Lekic
NMS wrote: Is there a cross-platform way to create a new process and get its i/o streams? Like java.lang.Process? I doubt. However, you can use platform-specific popen() (POSIX) and _popen() (Windows) for that. I recently talked about this on IRC. At the moment Phobos uses system() ,

Re: piping processes

2011-12-01 Thread Dejan Lekic
We talked about that too on IRC - the conclusion was - we should have std.pipe module with (at least) AnonymousPipe, and NamedPipe classes.

Re: Compile time metaprogramming

2011-12-03 Thread Dejan Lekic
David, to be frank, your code is already useful! Something is better than *nothing*! I hope you or someone else will continue with these two modules, and include them in Phobos.

C++ vs D aggregates

2011-12-03 Thread Dejan Lekic
I recently stumbled on this thread: http://stackoverflow.com/ questions/5666321/what-is-assignment-via-curly-braces-called-and-can-it- be-controlled The important part is this: 8 - begin - The Standard says in section §8.5.1/1, An aggregate is an array or a class

Is D associative array thread safe, and will it relocate memory when add or delete a value?

2011-12-07 Thread Dejan Lekic
On 2011-Dec-07 02:17:17+00:00, raojm wrote: Is D associative array thread safe, and will it relocate memory when add or delete a value? Where I can find the implemention. Phobos and druntime are on GitHub, you can always check out the source...

Re: C++ vs D aggregates

2011-12-07 Thread Dejan Lekic
What does not? Yes, that kind of struct will work. :) Try to add a constructor...

Re: actors library?

2012-01-24 Thread Dejan Lekic
Xan, read this article please: http://www.informit.com/articles/article.aspx?p=1609144 You have exactly what you are looking for in the D runtime and standard library.

Re: learn D TDPL

2012-01-24 Thread Dejan Lekic
Many things changed since the book has been released. I is strange that you did not see the link to the TDLP errata (http://erdani.com/tdpl/errata/) by now. :)

Re: Calling a C++ Object from D

2012-01-24 Thread Dejan Lekic
Unfortunately, you cant use C++ namespaces. More about interfacing to C++ here: http://www.dlang.org/cpp_interface.html . The easiest way to solve this is to write a C function that will glue your code with the C++ library.

Re: floating-WTF

2012-01-24 Thread Dejan Lekic
No, it is not a bug. Here is a hint: import std.stdio; int main() { float f; writeln(f); return 0; } /+--- output --+ nan +--- end of output ---+/

Re: KeyType, ValueType traits for hashes

2012-01-24 Thread Dejan Lekic
Andrej, I agree, they should be in std.traits .

Re: DFL is the best UIcontrols for D,compare it to dwt, tkd,dtk,dlangui,anchovy......

2014-05-14 Thread Dejan Lekic via Digitalmars-d-learn
Although DFL not use on Linux or Mac os X,it's easy to do for high level Software Engineer. Well, go ahead and do it!

Re: Any chance to avoid monitor field in my class?

2014-05-14 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 13 May 2014 at 17:41:42 UTC, Yuriy wrote: On Tuesday, 13 May 2014 at 17:09:01 UTC, Daniel Murphy wrote: What exactly is the mangling problem with extern(C++) classes? Can't use D arrays (and strings) as function argument types. Can't use D array types as template arguments. extern

Re: dmd with shared lib

2014-05-26 Thread Dejan Lekic via Digitalmars-d-learn
bioinfornatics wrote: Hi, after building and installing dmd i fail to use generated executable because they are an undefined symbol. $ /opt/dmd/bin/dmd -L-lcurl testDelegate.d $ ./testDelegate ./testDelegate: symbol lookup error: /opt/dmd/lib/libphobos2.so.0.66: undefined symbol:

Re: Allowing Expressions such as (low value high)

2014-09-09 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote: Are there any programming languages that extend the behaviour of comparison operators to allow expressions such as if (low value high) ? This syntax is currently disallowed by DMD. I'm aware of the risk of a programmer

Re: ini library in OSX

2014-09-09 Thread Dejan Lekic via Digitalmars-d-learn
On Monday, 8 September 2014 at 06:32:52 UTC, Joel wrote: Is there any ini library that works in OSX? I've tried the ones I found. I think they have the same issue. Joels-MacBook-Pro:ChrisMill joelcnz$ dmd ini -unittest ini.d(330): Error: cannot pass dynamic arrays to extern(C) vararg

Re: ini library in OSX

2014-09-09 Thread Dejan Lekic via Digitalmars-d-learn
Or this one: http://dpaste.dzfl.pl/1b29ef20#

Re: Installing LDC on Windows

2014-09-09 Thread Dejan Lekic via Digitalmars-d-learn
On Saturday, 6 September 2014 at 11:13:20 UTC, Russel Winder via Digitalmars-d-learn wrote: OK I installed LDC pre-built on MinGW for Windows on Windows and then Installed MinGW for Windows but when I run ldc2 it tells me libgcc_s_dw2-1.dll is missing. Is this problem soluble by any means

Re: Beginner ?. Why does D suggest to learn java

2014-10-22 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 16 October 2014 at 22:26:51 UTC, RBfromME wrote: I'm a newbie to programming and have been looking into the D lang as a general purposing language to learn, yet the D overview indicates that java would be a better language to learn for your first programming language. Why? Looks

Re: How to use Fiber?

2015-02-25 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 24 February 2015 at 10:15:29 UTC, FrankLike wrote: There is a int[] ,how to use the Fiber execute it ? Such as : import std.stdio; import core.thread; class DerivedFiber : Fiber { this() { super( run ); } private : void run() { printf( Derived

Re: New to D - playing with Thread and false Sharing

2015-08-20 Thread Dejan Lekic via Digitalmars-d-learn
Keep in mind that in D everything is thread-local by default! :) For shared resources use __gshared or shared (although I do not know for sure whether shared works or not).

Re: __traits(allMembers) and aliases

2015-08-25 Thread Dejan Lekic via Digitalmars-d-learn
It is off-topic (sorry for that), but how you grab only those (say functions) in a module that are annotated with @ChoseMe ?? allMembers trait gives bunch of strings, and I could not find a way to use them with hasUDA template...

Re: Setting native OS thread name (eg, via prctl)

2015-12-22 Thread Dejan Lekic via Digitalmars-d-learn
Arun, isn't that what the 'name' property is there for?

Re: improve concurrent queue

2016-06-03 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 27 August 2013 at 17:35:13 UTC, qznc wrote: I can recommand this paper (paywalled though): http://dl.acm.org/citation.cfm?id=248106 The research paper can actually be freely downloaded from http://www.dtic.mil/cgi-bin/GetTRDoc?AD=ADA309412 . Good article, thanks!

Re: print function

2016-02-04 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote: It would be nice to have a simple writeln that adds spaces automatically like Python's 'print' in std.stdio, perhaps called print. There are many implementations of string interpolation in D (that is what you want, basically). One of

Re: Build a SysTime from a string

2016-07-06 Thread Dejan Lekic via Digitalmars-d-learn
On Wednesday, 6 July 2016 at 14:15:22 UTC, Andrea Fontana wrote: My problem is that from documentation I can't understand how to set +01:00 timezone on systime. I guess I'm missing something... As far as I know, you can't do that. Quote from the documentation: """ Unlike DateTime, the time

Re: What's the secret to static class members

2016-06-30 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 30 June 2016 at 01:11:09 UTC, Mike Parker wrote: I think it's safe to say this guy is just trolling and we can ignore him. I was about to say the same, Mike. He is either trolling, or genuinely did not even bother to learn some language basics...

Re: Using Dub

2017-01-16 Thread Dejan Lekic via Digitalmars-d-learn
On Monday, 16 January 2017 at 09:40:55 UTC, Russel Winder wrote: On the one hand Cargo works wonderfully with Rust so I had hoped Dub would work wonderfully with D. Sadly I am finding it doesn't. Possibly my fault, but still annoying. Cargo does not have multiple Rust compilers as an option.

Re: [Semi-OT] I don't want to leave this language!

2016-12-07 Thread Dejan Lekic via Digitalmars-d-learn
On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko wrote: Good D code should be nothrow, @nogc, and betterC. BetterC means that it must not require DRuntime to link and to start. I started Mir as scientific/numeric project, but it is going to be a replacement for Phobos to use D

Re: ndslice summary please

2017-04-13 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 13 April 2017 at 10:00:43 UTC, 9il wrote: On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote: I haven't played with ndslice nor followed its deprecation discussions. Could someone summarize it for us please. Also, is it still used outside Phobos or is Ilya or someone

Re: Optional parameters?

2018-04-04 Thread Dejan Lekic via Digitalmars-d-learn
On Sunday, 1 April 2018 at 15:54:16 UTC, Steven Schveighoffer wrote: I currently have a situation where I want to have a function that accepts a parameter optionally. This is what function overloading and/or default values are for, right?

Re: Singleton in Action?

2019-02-03 Thread Dejan Lekic via Digitalmars-d-learn
On Saturday, 2 February 2019 at 16:56:45 UTC, Ron Tarrant wrote: Hi guys, I ran into another snag this morning while trying to implement a singleton. I found all kinds of examples of singleton definitions, but nothing about how to put them into practice. Can someone show me a code example

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 10:34:54 UTC, BoQsc wrote: I'm quite new to the programming, and I'm getting unsure how to make SendMessageTimeoutW to work with D lang. Most of my attention right now resides around the Argument of the SendMessageTimeoutW function: "Environment", It seems that

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 11:06:54 UTC, Dejan Lekic wrote: std.utf module has all encoding/decoding you need (in this case UTF-16). I guess You need to convert your string using toUTF16 ( https://dlang.org/phobos/std_utf.html#toUTF16 ). I do not do Windows programming so I am not 100% sure

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 10:34:54 UTC, BoQsc wrote: All I know that there was toString16z function from tango project, that made it all work. Now that I browsed the std.utf more, I realised what fits your need best is the https://dlang.org/phobos/std_utf.html#toUTF16z

Re: dmd memory usage

2019-11-18 Thread Dejan Lekic via Digitalmars-d-learn
On Monday, 18 November 2019 at 00:20:12 UTC, Steven Schveighoffer wrote: I'm fighting some out of memory problems using DMD and some super-template heavy code. I have ideas on how to improve the situation, but it involves redesigning a large portion of the design. I want to do it

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-27 Thread Dejan Lekic via Digitalmars-d-learn
On Thursday, 27 May 2021 at 01:17:44 UTC, someone wrote: Yes, I know this is a question lacking a straightforward answer. Requirements: [...] I humbly believe the most complete one is GtKD. https://gtkdcoding.com/ https://gtkd.org We all wish there was a STANDARD D GUI library out there,

Re: Writing a simple text editor in D using a C tutorial

2023-08-29 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 29 August 2023 at 16:17:56 UTC, Răzvan Birișan wrote: Is there a better way to use `termios.h` inside D? Am I missing the point and there is a way to set these flags in D without using C libraries? I would try to use termios from druntime instead. Try: import

Re: C to D: please help translate this weird macro

2023-09-20 Thread Dejan Lekic via Digitalmars-d-learn
On Wednesday, 20 September 2023 at 13:55:14 UTC, Ki Rill wrote: On Wednesday, 20 September 2023 at 13:53:08 UTC, Ki Rill wrote: Here is the macro: ```C #define NK_CONTAINER_OF(ptr,type,member)\ (type*)((void*)((char*)(1 ? (ptr): &((type*)0)->member) - NK_OFFSETOF(type, member))) ``` I'm

Re: C to D: please help translate this weird macro

2023-09-20 Thread Dejan Lekic via Digitalmars-d-learn
On Wednesday, 20 September 2023 at 13:55:14 UTC, Ki Rill wrote: On Wednesday, 20 September 2023 at 13:53:08 UTC, Ki Rill wrote: Here is the macro: ```C #define NK_CONTAINER_OF(ptr,type,member)\ (type*)((void*)((char*)(1 ? (ptr): &((type*)0)->member) - NK_OFFSETOF(type, member))) ``` I'm

Re: How to use eventcore write an echo server?

2024-03-14 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 12 March 2024 at 05:13:26 UTC, zoujiaqing wrote: How to fix it? than you ;) Try the following: ``` class Connection { StreamSocketFD client; ubyte[1024] buf = void; // Add these two lines before the constructor: nothrow: @safe: