Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread ketmar via Digitalmars-d-learn
On Wed, 12 Nov 2014 12:40:30 + Chris via Digitalmars-d-learn wrote: > The following causes the DLL to crash on Windows: > > Input: immutable(short)* data (immutable because in separate > thread). > // Later > core.stdc.stdlib.free(cast(short *)data); > > (short* data is provided by the C l

Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread ketmar via Digitalmars-d-learn
On Wed, 12 Nov 2014 12:40:30 + Chris via Digitalmars-d-learn wrote: > The following causes the DLL to crash on Windows: > > Input: immutable(short)* data (immutable because in separate > thread). > // Later > core.stdc.stdlib.free(cast(short *)data); > > (short* data is provided by the C l

Re: Russian translation of the "range" term?

2014-11-12 Thread ketmar via Digitalmars-d-learn
On Wed, 12 Nov 2014 11:38:50 + thedeemon via Digitalmars-d-learn wrote: > some languages like F# and Clojure use this term (often shortened > to 'seq') "послед". rotfl. signature.asc Description: PGP signature

Re: Basically want to make a macro script

2014-11-12 Thread ketmar via Digitalmars-d-learn
On Wed, 12 Nov 2014 04:56:39 + Casey via Digitalmars-d-learn wrote: D has nothing to do with your task, WinAPI does. and you'll need alot of expirience in reverse engineering, 'cause f... punkbuster shits it's pants almost for anything. it's a rootkit, and very badly written one. what you hav

Re: Destructor/Finalizer Guarantees

2014-11-11 Thread ketmar via Digitalmars-d-learn
On Tue, 11 Nov 2014 22:31:17 + Maxime Chevalier-Boisvert via Digitalmars-d-learn wrote: > What I want to know is: what > guarantees can I expect from destructor behavior? destructors *may* be called eventually. or not. in any order. but never twice. think about object destructors as "finali

Re: Russian translation of the "range" term?

2014-11-11 Thread ketmar via Digitalmars-d-learn
On Tue, 11 Nov 2014 16:50:23 + Chris via Digitalmars-d-learn wrote: > On Tuesday, 11 November 2014 at 16:15:36 UTC, Dicebot wrote: > > On Tuesday, 11 November 2014 at 16:14:10 UTC, Chris wrote: > >> Does that entail the concept that ranges (in D) are > >> homogeneous (i.e. every member/item

Re: Russian translation of the "range" term?

2014-11-11 Thread ketmar via Digitalmars-d-learn
On Tue, 11 Nov 2014 16:10:12 + Dicebot via Digitalmars-d-learn wrote: > "последовательность" is solid generic term if you are not afraid > of making mathematicians mad and it is totally unusable in practice. it's just too long and hard to pronounce to be used anywhere except a dry boring boo

Re: Russian translation of the "range" term?

2014-11-11 Thread ketmar via Digitalmars-d-learn
On Tue, 11 Nov 2014 15:38:26 + Chris via Digitalmars-d-learn wrote: > On Tuesday, 11 November 2014 at 15:03:40 UTC, ketmar via > Digitalmars-d-learn wrote: > > On Tue, 11 Nov 2014 14:52:55 + > > Kagamin via Digitalmars-d-learn > > > > wrote: >

Re: Russian translation of the "range" term?

2014-11-11 Thread ketmar via Digitalmars-d-learn
On Tue, 11 Nov 2014 15:38:26 + Chris via Digitalmars-d-learn wrote: > What does "набор" mean literally? What is it? something like "(unordered) set of something similar but not same, which can (eventually) be counted and things can be extracted/added". like this. "набор ручек для писания", f

Re: Network scanner

2014-11-11 Thread ketmar via Digitalmars-d-learn
On Tue, 11 Nov 2014 15:35:28 + RuZzz via Digitalmars-d-learn wrote: > netstat reports that the socket is in the TIME_WAIT or CLOSE_WAIT > state. i'm not an expert in winsock, but did you tried to set SO_LINGER to "off"? signature.asc Description: PGP signature

Re: Russian translation of the "range" term?

2014-11-11 Thread ketmar via Digitalmars-d-learn
On Tue, 11 Nov 2014 14:52:55 + Kagamin via Digitalmars-d-learn wrote: > I was thinking about list comprehension, which is what > programming on ranges is. Isn't it? "list" is a good term, but it's already taken. so naming "range" as "list" will create unnecessary confusion. alas. yet "набор"

Re: Russian translation of the "range" term?

2014-11-11 Thread ketmar via Digitalmars-d-learn
On Tue, 11 Nov 2014 14:08:36 + Kagamin via Digitalmars-d-learn wrote: > Another synonym is "list". hm... i afraid that it's not suitable. "list" has a well-defined meaning in programming literature. ranges are definitely not lists (but list can be a range). ah! "набор"! it's short, it not co

Re: Russian translation of the "range" term?

2014-11-11 Thread ketmar via Digitalmars-d-learn
On Tue, 11 Nov 2014 11:50:16 + Ivan Kazmenko via Digitalmars-d-learn wrote: > Is there an "official" translation already? In TDPL, the (very > few) occurrences of "range" are translated as "диапазон" methinks that "последовательность"[0] is better, albeit longer. but nobody will use that ex

Re: Strictness of language styling

2014-11-10 Thread ketmar via Digitalmars-d-learn
On Mon, 10 Nov 2014 14:00:32 -0800 "H. S. Teoh via Digitalmars-d-learn" wrote: > I used to be an Egyptian-braces / tabs-only-indentation advocate. That > works reasonably well in C/C++, but I find that with idiomatic D, Phobos > style actually works much better. (Well, except that horrid camelCas

Re: Instructions for compilation from multiple source files

2014-11-10 Thread ketmar via Digitalmars-d-learn
On Mon, 10 Nov 2014 21:27:20 + Solomon E via Digitalmars-d-learn wrote: > (There is a dlang page http://wiki.dlang.org/GDC/Using_GDC that > gives some instructions, including how to compile hello world and > how to get a .o file, but strangely to me doesn't include any > examples or abstracte

Re: Strictness of language styling

2014-11-10 Thread ketmar via Digitalmars-d-learn
On Mon, 10 Nov 2014 11:35:04 -0800 "H. S. Teoh via Digitalmars-d-learn" wrote: > I have to say that I *hate* camelCase... it looks really ugly. But what > looks uglier is a mixture of camelCase and something else. And since > Phobos is all camelCased, and almost all D code uses Phobos, writing >

Re: is there any reason UFCS can't be used with 'new'?

2014-11-10 Thread ketmar via Digitalmars-d-learn
On Mon, 10 Nov 2014 19:07:38 + Suliman via Digitalmars-d-learn wrote: > /// How to use UFCS here? > userName.name.sayHello(); > /// you can't. a little explanation: UFCS substitutes only the first argument. and for class methods first argument is hidden 'this'. so you can't do it in this way

Re: Strictness of language styling

2014-11-10 Thread ketmar via Digitalmars-d-learn
On Mon, 10 Nov 2014 16:16:04 + "Adam D. Ruppe via Digitalmars-d-learn" wrote: > Personally, I don't really care about naming conventions. I > prefer the camelCase and it seems most D people do, but if you're > translating another library, there's value it keeping it the same > for ease of

Re: Instructions for compilation from multiple source files

2014-11-10 Thread ketmar via Digitalmars-d-learn
On Mon, 10 Nov 2014 16:49:26 + John Colvin via Digitalmars-d-learn wrote: > On Monday, 10 November 2014 at 12:10:37 UTC, Solomon E wrote: > > I don't trust the > > DMD Debian package enough to install it, considering it has > > Google adsense ads in its HTML pages, which is against even > > G

Re: Instructions for compilation from multiple source files

2014-11-10 Thread ketmar via Digitalmars-d-learn
On Mon, 10 Nov 2014 17:18:05 + Solomon E via Digitalmars-d-learn wrote: > I do know about how to use GCC and where the documentation for > that is. I know what .o files and .a files are in terms of GCC > for C, because there's tons of documentation about that. I > thought that there might be

Re: Instructions for compilation from multiple source files

2014-11-10 Thread ketmar via Digitalmars-d-learn
On Mon, 10 Nov 2014 14:12:12 + Solomon E via Digitalmars-d-learn wrote: > I keep saying I want documentation or specifications. and i keep saying that if you can't find those for you case, you'd better stick with IDE. you keep ignoring the fact that gdc is a part of GCC and you have to read G

Re: Instructions for compilation from multiple source files

2014-11-10 Thread ketmar via Digitalmars-d-learn
On Mon, 10 Nov 2014 13:29:02 + Solomon E via Digitalmars-d-learn wrote: > The problem that I'm having with this seems to be with GDC, not > the rest of the D community. The following is a quote of the > entire amount of information in the GDC man page on the following > compiler options and f

Re: Instructions for compilation from multiple source files

2014-11-10 Thread ketmar via Digitalmars-d-learn
On Mon, 10 Nov 2014 12:10:36 + Solomon E via Digitalmars-d-learn wrote: > If there aren't instructions or documentation on how to compile > more than one file into a finished D runnable project in a > correct way that can grow with larger projects, then I'll have to > take it as implied that

Re: Access Violation Tracking

2014-11-10 Thread ketmar via Digitalmars-d-learn
On Mon, 10 Nov 2014 11:13:11 + via Digitalmars-d-learn wrote: > On Sunday, 9 November 2014 at 14:45:11 UTC, ketmar via > Digitalmars-d-learn wrote: > > On Sun, 09 Nov 2014 09:33:29 -0500 > > Etienne via Digitalmars-d-learn > > > > wrote: > > >

Re: Cast to left hand side

2014-11-09 Thread ketmar via Digitalmars-d-learn
On Sun, 09 Nov 2014 22:17:33 + bearophile via Digitalmars-d-learn wrote: > eles: > > > I am also strongly in favor of introducing an "uncast". For > > example, in C++'x const_cast and in D's cast for removing, for > > example immutability: > > > > immutable int* p = ...; > > int* q = cast(

Re: Cast to left hand side

2014-11-09 Thread ketmar via Digitalmars-d-learn
On Sun, 09 Nov 2014 21:47:02 + eles via Digitalmars-d-learn wrote: > On Sunday, 9 November 2014 at 19:00:01 UTC, tcak wrote: > > In some cases, I need to cast right hand side expression to > > left hand side. While it looks/feels simple for basic data > > types, it requires long lines with

Re: Access Violation Tracking

2014-11-09 Thread ketmar via Digitalmars-d-learn
On Sun, 09 Nov 2014 09:33:29 -0500 Etienne via Digitalmars-d-learn wrote: > I've seen a lot more invalid memory operation errors since the GC calls > destructors. Letting the GC destroy objects out of order can be the > issue. We might have to make an associative array of static global flags >

Re: Live without debugger?

2014-11-09 Thread ketmar via Digitalmars-d-learn
On Sun, 09 Nov 2014 08:26:57 + Suliman via Digitalmars-d-learn wrote: > Do you often need debugger when you are writing code? besides, it's very hard to write code in debugger. even 'ed' is better for this task. ;-) signature.asc Description: PGP signature

Re: Live without debugger?

2014-11-09 Thread ketmar via Digitalmars-d-learn
On Sun, 09 Nov 2014 08:26:57 + Suliman via Digitalmars-d-learn wrote: > Do you often need debugger when you are writing code? almost never. > For which tasks debugger are more needed for you? inspecting coredumps. signature.asc Description: PGP signature

Re: Access Violation Tracking

2014-11-08 Thread ketmar via Digitalmars-d-learn
On Sat, 08 Nov 2014 15:51:58 + Gary Willoughby via Digitalmars-d-learn wrote: > On Wednesday, 5 November 2014 at 11:39:21 UTC, Marc Schütz wrote: > > If you're on Linux, you can turn SEGVs into Errors: > > > > import etc.linux.memoryerror; > > registerMemoryErrorHandler(); > > This i

Re: Access Violation Tracking

2014-11-08 Thread ketmar via Digitalmars-d-learn
On Sat, 08 Nov 2014 11:46:16 + Nikolay via Digitalmars-d-learn wrote: > > i also developed a habit of writing assert()s before > > dereferencing > > pointers first time (including class refs) in appropriate > > places, so > > i'll got that stack trace for free. ;-) and i never turning off

Re: Access Violation Tracking

2014-11-07 Thread ketmar via Digitalmars-d-learn
On Fri, 7 Nov 2014 22:58:38 -0800 "H. S. Teoh via Digitalmars-d-learn" wrote: > Some time ago deadalnix gave a neat (if scary) hack where the signal > handler overwrites its return address on the stack to redirect the code > to a handler that operates outside signal handler context, so it has no

Re: Access Violation Tracking

2014-11-07 Thread ketmar via Digitalmars-d-learn
On Sat, 08 Nov 2014 06:23:39 + Nikolay via Digitalmars-d-learn wrote: > I think, it is problem. Dland on windows gives stacktrace without > any problem. In general it is expected behavior for many people > from different languages (Java, C#). So from my point of view it > is bad idea has c

Re: Access Violation Tracking

2014-11-07 Thread ketmar via Digitalmars-d-learn
On Fri, 07 Nov 2014 13:52:33 + "Nordlöw" via Digitalmars-d-learn wrote: > On Friday, 7 November 2014 at 03:22:59 UTC, ketmar via > Digitalmars-d-learn wrote: > > crash+coredump is alot more useful than intercepting error > > and... > > trying to recover

Re: std.array.array and immutable elements

2014-11-07 Thread ketmar via Digitalmars-d-learn
On Fri, 07 Nov 2014 15:18:24 + anonymous via Digitalmars-d-learn wrote: > On Friday, 7 November 2014 at 14:57:56 UTC, ketmar via > Digitalmars-d-learn wrote: > > `map` cannot return range with immutable elements, 'cause they > > are > > obviously generated by

Re: std.array.array and immutable elements

2014-11-07 Thread ketmar via Digitalmars-d-learn
On Fri, 07 Nov 2014 14:32:57 + Jack Applegame via Digitalmars-d-learn wrote: > import std.array; > import std.algorithm; > > class Foo { > bool flag; > } > void main() { >immutable(Foo)[] foos; >foreach(i; 0..5) foos ~= new Foo; > >// compiles, typeof(bar1) == immuta

Re: std.array.array and immutable elements

2014-11-07 Thread ketmar via Digitalmars-d-learn
On Fri, 07 Nov 2014 14:32:57 + Jack Applegame via Digitalmars-d-learn wrote: ah, sorry, my bad, 'const' will not work to, for the same reason. signature.asc Description: PGP signature

Re: Access Violation Tracking

2014-11-07 Thread ketmar via Digitalmars-d-learn
On Fri, 07 Nov 2014 13:52:33 + "Nordlöw" via Digitalmars-d-learn wrote: > On Friday, 7 November 2014 at 03:22:59 UTC, ketmar via > Digitalmars-d-learn wrote: > > crash+coredump is alot more useful than intercepting error > > and... > > trying to recover

Re: Access Violation Tracking

2014-11-07 Thread ketmar via Digitalmars-d-learn
On Fri, 07 Nov 2014 08:49:34 -0500 Steven Schveighoffer via Digitalmars-d-learn wrote: > On 11/6/14 11:43 PM, ketmar via Digitalmars-d-learn wrote: > > On Thu, 06 Nov 2014 22:45:23 -0500 > > Steven Schveighoffer via Digitalmars-d-learn > > wrote: > > > >&

Re: Access Violation Tracking

2014-11-06 Thread ketmar via Digitalmars-d-learn
On Thu, 06 Nov 2014 22:45:23 -0500 Steven Schveighoffer via Digitalmars-d-learn wrote: > In an environment that you don't control, the default behavior is likely > to print "Segmentation Fault" and exit. No core dump, no nothing. > > This leads to unhelpful bug reports, and seeing if you can ge

Re: Access Violation Tracking

2014-11-06 Thread ketmar via Digitalmars-d-learn
On Thu, 06 Nov 2014 20:13:02 + "Nordlöw" via Digitalmars-d-learn wrote: > On Wednesday, 5 November 2014 at 11:39:21 UTC, Marc Schütz wrote: > > If you're on Linux, you can turn SEGVs into Errors: > > > > import etc.linux.memoryerror; > > registerMemoryErrorHandler(); > > Why isn't su

Re: scope exception do not rise

2014-11-05 Thread ketmar via Digitalmars-d-learn
On Wed, 05 Nov 2014 14:09:20 + Gary Willoughby via Digitalmars-d-learn wrote: > That shouldn't matter. See: http://dlang.org/exception-safe.html this indeed matter. and it should. signature.asc Description: PGP signature

Re: string, char[], overloaded functions.

2014-11-01 Thread ketmar via Digitalmars-d-learn
On Sat, 01 Nov 2014 08:36:40 + via Digitalmars-d-learn wrote: > No, it's `~=` that may or may not allocate, but `~` always does. you a right. sorry, i was wrong here. signature.asc Description: PGP signature

Re: string, char[], overloaded functions.

2014-10-31 Thread ketmar via Digitalmars-d-learn
On Sat, 01 Nov 2014 00:05:19 + "Adam D. Ruppe via Digitalmars-d-learn" wrote: > BTW one could argue that char[] ~ operator should yield something > that's implicitly convertable, since it allocates a new memory > block anyway, but that's not how it works right now. it's not necessarily allo

Re: Multiple declarations in a C++ namespace

2014-10-31 Thread ketmar via Digitalmars-d-learn
On Fri, 31 Oct 2014 19:23:06 -0400 "Paul O'Neil via Digitalmars-d-learn" wrote: > Thanks for the response. That does work. > > Should I file a bug report or create a PR for the docs? i think it will be fine. and i think that this is more like a bug, 'cause it's ovbious that user wants the same

Re: Dart bindings for D?

2014-10-30 Thread ketmar via Digitalmars-d-learn
On Thu, 30 Oct 2014 22:18:22 + Laeeth Isharc via Digitalmars-d-learn wrote: > Ah - makes sense. It is satisfyingly fast... the only bad thing is that it trashes /tmp/.rdmd-$UID dir. i wrote another simple script that is clearing that dir (but doesn't touch 'locked' dirs, as they are obviousl

Re: Dart bindings for D?

2014-10-30 Thread ketmar via Digitalmars-d-learn
On Thu, 30 Oct 2014 17:39:13 + Laeeth Isharc via Digitalmars-d-learn wrote: > BTW what was the story behind dscript? It seems to have changed > its name and no longer have so much connection to D: > http://forum.dlang.org/thread/422be824.6030...@nospam.org we have rdmd now, which can be use

Re: Dart bindings for D?

2014-10-29 Thread ketmar via Digitalmars-d-learn
On Thu, 30 Oct 2014 01:31:23 + "Adam D. Ruppe via Digitalmars-d-learn" wrote: > On Wednesday, 29 October 2014 at 22:22:39 UTC, ketmar via > Digitalmars-d-learn wrote: > > it's not lightning fast, though, but the code is understandable > > and it's

Re: Dart bindings for D?

2014-10-29 Thread ketmar via Digitalmars-d-learn
On Wed, 29 Oct 2014 22:12:30 + Laeeth Isharc via Digitalmars-d-learn wrote: it's OT, but haven't you tried Adam Ruppe's script.d? it has d-like syntax with influences from javascript, written entirely in D, and has simple interoperability with D code. it's not lightning fast, though, but the

Re: readln with buffer fails

2014-10-29 Thread ketmar via Digitalmars-d-learn
On Wed, 29 Oct 2014 21:14:13 + dcrepid via Digitalmars-d-learn wrote: > Now, I'm used to 'buffer' meaning one thing, but here it seems > that buffer means something more akin to a 'sink' object, or a > forced dynamic array type? Is there some way I can avoid dynamic > allocations? take a

Re: Tagged enums why reserved words are not permitted ?

2014-10-27 Thread ketmar via Digitalmars-d-learn
On Tue, 28 Oct 2014 00:31:43 + Domingo via Digitalmars-d-learn wrote: > Hello ! > > I'm not sure if I'm missing something here but for a tagged enum > it doesn't seem to make sense to forbid reserved keywords like: > > enum CrudOps {read, write, delete} > > The dmd compiler are complainin

Re: Problems with Mutex

2014-10-27 Thread ketmar via Digitalmars-d-learn
On Mon, 27 Oct 2014 09:24:13 -0400 Steven Schveighoffer via Digitalmars-d-learn wrote: > Just as a followup, for some reason Mutex is not callable as a shared > object, so you have to make it __gshared. > > This is unfortunate, but it is the only way to do it right now. > Because an actual mute

Re: Problems with Mutex

2014-10-27 Thread ketmar via Digitalmars-d-learn
On Mon, 27 Oct 2014 09:24:13 -0400 Steven Schveighoffer via Digitalmars-d-learn wrote: > Just as a followup, for some reason Mutex is not callable as a shared > object, so you have to make it __gshared. that's due to difference betwen plain type and shared type. `shared(Mutex)` is not the same a

Re: Implementing SmartPtr - compiler bug?

2014-10-27 Thread ketmar via Digitalmars-d-learn
On Mon, 27 Oct 2014 09:11:33 + Szymon Gatner via Digitalmars-d-learn wrote: > You have created dynamic array of SmartPtrs. nope. it's stack-allocated array. signature.asc Description: PGP signature

Re: Implementing SmartPtr - compiler bug?

2014-10-27 Thread ketmar via Digitalmars-d-learn
just checked this with gdc and dmd head. interesting that a = a.init; works the same in gdc and in dmd: just calls destructors for structs. but doing a[] = S.init works different. gdc does the same as in the first case: just calling destructors for all array elements. but dmd head calls pos

Re: passing non-dynamic arrays to variadic functions

2014-10-26 Thread ketmar via Digitalmars-d-learn
On Mon, 27 Oct 2014 03:07:12 + MachineCode via Digitalmars-d-learn wrote: > You're welcome :) what do you call git head is the dmd compiler > compiled from dmd's source code on github? yes. i'm updating my compiler on dayly basis, so my "git head" is really "head". ;-) but i also have alot

Re: passing non-dynamic arrays to variadic functions

2014-10-26 Thread ketmar via Digitalmars-d-learn
On Mon, 27 Oct 2014 02:25:50 +0200 ketmar via Digitalmars-d-learn wrote: for those who interested here is the patch that broke everything: https://github.com/D-Programming-Language/dmd/pull/3806/ i simply forgot that i included it for testing purposes, and it breaks something inside Phobos

Re: passing non-dynamic arrays to variadic functions

2014-10-26 Thread ketmar via Digitalmars-d-learn
On Mon, 27 Oct 2014 02:19:49 + MachineCode via Digitalmars-d-learn wrote: > It worked fine for me. Output: > > > abc > > abc > > Environment: Win 8.1 64-bit (but dmd target is 32-bit, IIRC), dmd > v2.066.0 yes, thank you too. that was one of my custom patches that broke this. i already fou

Re: passing non-dynamic arrays to variadic functions

2014-10-26 Thread ketmar via Digitalmars-d-learn
On Sun, 26 Oct 2014 17:41:28 -0700 Ali Çehreli via Digitalmars-d-learn wrote: > Yeah, works with git head. ah, thank you. seems that one of the custom patches i'm using broke that. i just checked this on unpatched DMD, and it works too. sorry for the noise. signature.asc Description: PGP signa

Re: passing non-dynamic arrays to variadic functions

2014-10-26 Thread ketmar via Digitalmars-d-learn
On Mon, 27 Oct 2014 00:33:13 + anonymous via Digitalmars-d-learn wrote: > On Monday, 27 October 2014 at 00:26:00 UTC, ketmar via > Digitalmars-d-learn wrote: > > Hello. > > > > let's assume we have this code: > > > > void doWrite(A...) (A args) {

Re: passing non-dynamic arrays to variadic functions

2014-10-26 Thread ketmar via Digitalmars-d-learn
On Mon, 27 Oct 2014 02:25:50 +0200 ketmar via Digitalmars-d-learn wrote: p.s. i know how to block using non-dynamic arrays in this case, but i don't want to. i found this when writing writef-like function with CTFE parsing of formatting string and spent alot of time looking for bug in my

passing non-dynamic arrays to variadic functions

2014-10-26 Thread ketmar via Digitalmars-d-learn
Hello. let's assume we have this code: void doWrite(A...) (A args) { import std.stdio; import std.conv; writeln(to!string(args[0])); } void main () { char[3] a0 = "abc"; char[3] a1 = ['a', 'b', 'c']; doWrite(a0); doWrite(a1); } i don't know why, but this code

Re: Problems with Mutex

2014-10-26 Thread ketmar via Digitalmars-d-learn
On Mon, 27 Oct 2014 02:07:09 +0200 ketmar via Digitalmars-d-learn wrote: > > Thank you for clearing this up. If I understand correctly, > > __gshared is more of a hack to get C-like global variables, > > whilst shared is typed shared variable and more preferred? > yes an

Re: Problems with Mutex

2014-10-26 Thread ketmar via Digitalmars-d-learn
On Sun, 26 Oct 2014 23:37:25 + Neven via Digitalmars-d-learn wrote: > >Mutex mutex; > >static this() > >{ > > mutex = new Mutex(); > >} > > I have synchronization problems with this one. Even when I > prepend __gshared Mutex mutex in this case. ah, there is another subtle thing. 'static th

Re: Problems with Mutex

2014-10-26 Thread ketmar via Digitalmars-d-learn
On Sun, 26 Oct 2014 22:53:07 + Neven via Digitalmars-d-learn wrote: > Why cannot I globally have auto mutex = new Mutex? And why it > works now when I put __gshared? this is because 'auto mutex = new Mutex' is not a global declaration, it's thread-local declaration. all D variables are threa

Re: specializing template with string variable in CTFE

2014-10-26 Thread ketmar via Digitalmars-d-learn
On Sun, 26 Oct 2014 20:16:18 + via Digitalmars-d-learn wrote: > The documentation specifically says that: > "Any functions that execute at compile time must also be > executable at run time. [...] This means that the semantics of a > function cannot depend on compile time values of the func

Re: specializing template with string variable in CTFE

2014-10-26 Thread ketmar via Digitalmars-d-learn
On Sun, 26 Oct 2014 12:46:06 + via Digitalmars-d-learn wrote: > Ok, I see two possibilities. The first is to make `prstr` into a > normal function. You cannot use `stringof` then, but need to > escape the string yourself. Luckily, std.format provides > functionality for this already, albei

Re: specializing template with string variable in CTFE

2014-10-26 Thread ketmar via Digitalmars-d-learn
On Sun, 26 Oct 2014 12:46:06 + via Digitalmars-d-learn wrote: > The second possibility doesn't exist right now. The core problem > is that the compiler needs to be able to generate runtime code > for `buildWriter()`, because it's just a function after all. but it's templated function, and i

specializing template with string variable in CTFE

2014-10-26 Thread ketmar via Digitalmars-d-learn
Hello. the following code is not working: template prstr(string s) { enum prstr = "write("~s.stringof~");\n"; } string buildWriter() (string fmt) { return prstr!(fmt[0..$-1]); } string writer(string fmt) () { enum s = buildWriter(fmt); return s; } void main () {

Re: template type deduction of static 2d arrays

2014-10-24 Thread ketmar via Digitalmars-d-learn
On Sat, 25 Oct 2014 00:38:37 + uri via Digitalmars-d-learn wrote: > On Saturday, 25 October 2014 at 00:00:54 UTC, ketmar via > Digitalmars-d-learn > > > > > we have a nice PR from Kenji that allows the following > > declarations: > > > > int[$][$

Re: template type deduction of static 2d arrays

2014-10-24 Thread ketmar via Digitalmars-d-learn
On Fri, 24 Oct 2014 23:46:27 + uri via Digitalmars-d-learn wrote: > On a related note, does the D spec guarantee the following will > be rectangular in memory? > > auto a = [ [1,2],[3,4] ]; ah, no, it's not. this is array of arrays, i.e. 'int[][]'. only static arrays are guaranteed to be pl

Re: template type deduction of static 2d arrays

2014-10-24 Thread ketmar via Digitalmars-d-learn
On Fri, 24 Oct 2014 22:32:57 + uri via Digitalmars-d-learn wrote: > Hi All, > > I was wondering why in the code below f1() works but f2 template > version called in the same manner does not. Is there a good > reason from a language/compiler perspective? > > Thanks. > uri > > > --- > aut

Re: template type deduction of static 2d arrays

2014-10-24 Thread ketmar via Digitalmars-d-learn
On Fri, 24 Oct 2014 22:32:57 + uri via Digitalmars-d-learn wrote: D doesn't try to convert types on template argument deduction. what you really get from '[[1,2],[3,4]]' is (int[][]), not (int[2][2]). note that static arrays are not the same thing as dynamic arrays. for 'f1' compiler doing th

Re: Patterns for functions in template parameters

2014-10-24 Thread ketmar via Digitalmars-d-learn
On Fri, 24 Oct 2014 16:00:41 + via Digitalmars-d-learn wrote: > On Friday, 24 October 2014 at 14:06:08 UTC, ketmar via > Digitalmars-d-learn wrote: > > On Thu, 23 Oct 2014 18:28:04 + > > Max Samukha via Digitalmars-d-learn > > > > wrote: > > > &g

Re: Patterns for functions in template parameters

2014-10-24 Thread ketmar via Digitalmars-d-learn
On Fri, 24 Oct 2014 17:05:57 +0300 ketmar via Digitalmars-d-learn wrote: > On Thu, 23 Oct 2014 18:28:04 + > Max Samukha via Digitalmars-d-learn > wrote: > > um-hm... maybe this: > > void Foo(T, U) (T delegate (U) a) { > // here T is bool, U is int

Re: Patterns for functions in template parameters

2014-10-24 Thread ketmar via Digitalmars-d-learn
On Thu, 23 Oct 2014 18:28:04 + Max Samukha via Digitalmars-d-learn wrote: um-hm... maybe this: void Foo(T, U) (T delegate (U) a) { // here T is bool, U is int for the following sample import std.stdio; writeln(a(3)); } Foo((int x) => x%2 == 0); signature.asc Description:

Re: Why do some language-defined attributes have @ and some not?

2014-10-23 Thread ketmar via Digitalmars-d-learn
On Thu, 23 Oct 2014 21:33:00 + Jonathan M Davis via Digitalmars-d-learn wrote: > On Thursday, 23 October 2014 at 07:54:05 UTC, ketmar via > Digitalmars-d-learn wrote: > > On Thu, 23 Oct 2014 07:47:00 + > > via Digitalmars-d-learn > > wrote: > > > >

Re: parser bug?

2014-10-23 Thread ketmar via Digitalmars-d-learn
On Thu, 23 Oct 2014 11:15:14 -0700 Charles Hixson via Digitalmars-d-learn wrote: > The code: > voidgo(ulongrecNum) > {assert (buf[0] == (fh.sizeof + recNo * buf.length) & 0x7f); > if(dirty) > yields the error message: > ells$ dmd test.d > test.d(78): Error:

Re: Returning a ref to a temporary already possible?

2014-10-23 Thread ketmar via Digitalmars-d-learn
On Thu, 23 Oct 2014 14:36:17 +0300 ketmar via Digitalmars-d-learn wrote: > On Thu, 23 Oct 2014 16:55:52 +0530 > Shriramana Sharma via Digitalmars-d-learn > wrote: > > > I'd really like to know what's exactly happening in that line: > > > > auto P =

Re: Returning a ref to a temporary already possible?

2014-10-23 Thread ketmar via Digitalmars-d-learn
On Thu, 23 Oct 2014 16:55:52 +0530 Shriramana Sharma via Digitalmars-d-learn wrote: > I'd really like to know what's exactly happening in that line: > > auto P = Pair(1, 2).handle ; object moving. add postblit (`this (this)`) and you'll see that. signature.asc Description: PGP signature

Re: How the memory layout of global variable is reliable ?

2014-10-23 Thread ketmar via Digitalmars-d-learn
On Thu, 23 Oct 2014 07:55:36 + Cjkp via Digitalmars-d-learn wrote: > I've probably badly explained the what and the why. I ask this > because of this draft: http://dpaste.dzfl.pl/e15305cbc32d > > Tool: generate a module with some static strings. (used as > ressources, e.g pictures, tables,

Re: Why do some language-defined attributes have @ and some not?

2014-10-23 Thread ketmar via Digitalmars-d-learn
On Thu, 23 Oct 2014 07:47:00 + via Digitalmars-d-learn wrote: > On Thursday, 23 October 2014 at 06:59:16 UTC, ketmar via > Digitalmars-d-learn wrote: > > besides, no "serious" language can live without "legacy". > > legacy is a sign of maturity. ;-) &

Re: Why do some language-defined attributes have @ and some not?

2014-10-23 Thread ketmar via Digitalmars-d-learn
On Thu, 23 Oct 2014 06:29:12 +0530 Shriramana Sharma via Digitalmars-d-learn wrote: > I submit that the syntax for attributes should be streamlined. Shall I > go and open a Bugzilla item? hehe. https://issues.dlang.org/show_bug.cgi?id=13388 https://issues.dlang.org/show_bug.cgi?id=13397 i must ad

Re: Destructor order

2014-10-22 Thread ketmar via Digitalmars-d-learn
On Wed, 22 Oct 2014 18:44:26 + via Digitalmars-d-learn wrote: > On Wednesday, 22 October 2014 at 18:14:54 UTC, ketmar via > Digitalmars-d-learn wrote: > > yes, this is the case. i believe that this should be explicitly > > documented in `scoped` ddocs. documentat

Re: Destructor order

2014-10-22 Thread ketmar via Digitalmars-d-learn
On Wed, 22 Oct 2014 18:03:44 + anonymous via Digitalmars-d-learn wrote: > On Wednesday, 22 October 2014 at 15:45:02 UTC, eles wrote: > > D version: > > > > { //displays ~A~B~C > > A foo = scoped!(A)(); > > B bar = scoped!(B)(); > > C caz = new C(); > > dest

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

2014-10-22 Thread ketmar via Digitalmars-d-learn
On Wed, 22 Oct 2014 07:58:49 + Kagamin via Digitalmars-d-learn wrote: > That's quite inadequate criticism. If you don't know, what > features generics have, you can't criticize them. i'm don't saying that "generics are bad", i'm saying that D has alot more anyway with it's CTFE magic. and ge

Re: bitmanip bigEndianToNative using a buffer slice?

2014-10-21 Thread ketmar via Digitalmars-d-learn
On Wed, 22 Oct 2014 01:30:48 + Lucas Burson via Digitalmars-d-learn wrote: > ketmar, we meet again! Your explanation is great and that solved > my problem. Thank you. Maybe I'll try out templates next... yep, i remember. i was glad to help you. ;-) signature.asc Description: PGP signature

Re: bitmanip bigEndianToNative using a buffer slice?

2014-10-21 Thread ketmar via Digitalmars-d-learn
On Wed, 22 Oct 2014 00:45:17 + Lucas Burson via Digitalmars-d-learn wrote: > I'm trying to create a primitive type given a specific buffer > slice. I can place the uint into a sliced buffer but I'm getting > compiler errors when using a slice to create the uint. Still new > to Dlang and un

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

2014-10-21 Thread ketmar via Digitalmars-d-learn
On Wed, 22 Oct 2014 00:57:59 +0300 ketmar via Digitalmars-d-learn wrote: > consitions i don't even know what this word means. honestly. signature.asc Description: PGP signature

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

2014-10-21 Thread ketmar via Digitalmars-d-learn
On Tue, 21 Oct 2014 21:48:14 + Kapps via Digitalmars-d-learn wrote: > I like D's templates, it's one of the things that makes me like D > more than C#. But they can definitely get quite complex. C# > limits templates to generic types, like List, and for a > beginner I think that's an easie

Re: Global const variables

2014-10-21 Thread ketmar via Digitalmars-d-learn
On Tue, 21 Oct 2014 16:47:04 + Solomon E via Digitalmars-d-learn wrote: > That's unsafe because the implementation might change, and > pointer arithmetic is unsafe in general. sure, ponter casting is implementation-dependend. but .ptr is guaranteed to work as expected. 'a' is just a `struct

Re: Global const variables

2014-10-21 Thread ketmar via Digitalmars-d-learn
On Tue, 21 Oct 2014 17:25:09 +0300 ketmar via Digitalmars-d-learn wrote: > On Tue, 21 Oct 2014 13:43:29 + > Solomon E via Digitalmars-d-learn > wrote: > > > `b[0] = 8;` or `b[] = 8;` changes a. Printing the values for &a > > and &b shows they're dif

Re: Global const variables

2014-10-21 Thread ketmar via Digitalmars-d-learn
On Tue, 21 Oct 2014 13:43:29 + Solomon E via Digitalmars-d-learn wrote: > `b[0] = 8;` or `b[] = 8;` changes a. Printing the values for &a > and &b shows they're different pointers, but (a is b) returns > true. So I still have more to learn about how it does that. that's 'cause '&b' taking a

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

2014-10-21 Thread ketmar via Digitalmars-d-learn
On Tue, 21 Oct 2014 11:51:16 + via Digitalmars-d-learn wrote: > The problem with template-programming in XSLT/C++/D is that if > you want to learn functional programming you are better off using > a good functional language. templates arent about FP only. yet i agree that Scheme is a very g

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

2014-10-21 Thread ketmar via Digitalmars-d-learn
On Tue, 21 Oct 2014 11:20:42 + Paulo Pinto via Digitalmars-d-learn wrote: > People think templates are magic, due to their skillset. and other people keep pointing at languages without templates and metaprogramming as "good for learing". it's closed circle. signature.asc Description: PGP si

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

2014-10-21 Thread ketmar via Digitalmars-d-learn
On Tue, 21 Oct 2014 09:01:32 + Kapps via Digitalmars-d-learn wrote: > no template magic that's very bad. it's time to stop making people think that templates are inevitably arcane. signature.asc Description: PGP signature

Re: [OT] the uses of computing

2014-10-19 Thread ketmar via Digitalmars-d-learn
On Sun, 19 Oct 2014 23:34:17 + Joakim via Digitalmars-d-learn wrote: > The desktop UI paradigm needs to be completely redone, from the > ground up. Current desktop GUIs are too limiting and the > terminal is powerful but antiquated. The problem is how best to > combine the two, since one

Re: [OT] the uses of computing

2014-10-18 Thread ketmar via Digitalmars-d-learn
On Sat, 18 Oct 2014 23:38:35 + Joakim via Digitalmars-d-learn wrote: don't you think that we are going in circles now? not that i'm tired of this conversation, but i see that we get each other's POVs, and have no more arguments to convince each other. ;-) i respect your opinions but just don

Re: [OT] the uses of computing

2014-10-18 Thread ketmar via Digitalmars-d-learn
On Sat, 18 Oct 2014 19:42:50 + Joakim via Digitalmars-d-learn wrote: > > most people are stupid. > No disagreement there, but even the smart ones can only learn so > much. that's why we should teach kids alot of things while their minds are "clear" and ready to absorb alot of knowledge. and,

Re: String created from buffer has wrong length and strip() result is incorrect

2014-10-18 Thread ketmar via Digitalmars-d-learn
On Sat, 18 Oct 2014 16:56:09 + Lucas Burson via Digitalmars-d-learn wrote: > Wow, your changes made it much simpler. Thank you for the > suggestions and expertise ketmar :) you're welcome. signature.asc Description: PGP signature

<    4   5   6   7   8   9   10   11   12   >