Re: alias overloaded function template

2014-11-11 Thread Basile Burg via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 19:36:12 UTC, Lemonfiend wrote: D is fine with alias this overloaded function: --- void foo(int t) {} void foo(int t, int i) {} alias bar = foo; --- But isn't as happy aliasing these function templates: --- void foo(T)(T t) {} void foo(T)(T t, int i) {} alias ba

Basically want to make a macro script

2014-11-11 Thread Casey via Digitalmars-d-learn
/Long/ story short, I want to pretty much make a macro using this program. I don't really have time to explain in further detail at the moment, but /no/ macro program out there will do what I'm trying to do. I want to basically make it so that when I press a hotkey, it'll send an in game chat

Re: Destructor/Finalizer Guarantees

2014-11-11 Thread Algo via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 22:31:17 UTC, Maxime Chevalier-Boisvert wrote: I have a situation where I have a VM (virtual machine) object, and several GCRoot (garbage collector root objects). The GCRoots are structs and will "register" themselves into a linked list belonging to the VM. I've

Re: Destructor/Finalizer Guarantees

2014-11-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/11/14 5:31 PM, Maxime Chevalier-Boisvert wrote: I have a situation where I have a VM (virtual machine) object, and several GCRoot (garbage collector root objects). The GCRoots are structs and will "register" themselves into a linked list belonging to the VM. I've made it so they unregister

kitchens for sale uk

2014-11-11 Thread rodomules via Digitalmars-d-learn
kitchens for sale uk. Thirty Ex Display Kitchens To Clear. www.exdisplaykitchens1.co.uk £ 595 Each with appliances.Tel 01616-694785 [url=http://www.kitchensforsale.uk.com]kitchens for sale uk[/url]

Re: passing duck-typed objects and retaining full type information

2014-11-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 01:50:07 UTC, Adam Taylor wrote: Adam Ruppe has an interesting example: What that does is defer the type work to runtime, so a lot of type information is lost there too. The big magic is that the wrapper object is a template, specialized for the compile tim

Re: passing duck-typed objects and retaining full type information

2014-11-11 Thread Adam Taylor via Digitalmars-d-learn
No, i'm specifically looking for a solution that is NOT inheritance based. I've been looking at solutions based on opDispatch or template mixins -- but so far haven't come up with anything. For example in this thread: http://forum.dlang.org/thread/mailman.410.1319536838.24802.digitalmar...@pu

Re: passing duck-typed objects and retaining full type information

2014-11-11 Thread Adam Taylor via Digitalmars-d-learn
Not entirly sure of what you asking for,but have you tried inhertance? interface Base(C){ /+...+/ } interface Derived(C):Base!C{ /+...+/ } No, i'm specifically looking for a solution that is NOT inheritance based. I've been looking at solutions based on opDispatch or temp

Re: passing duck-typed objects and retaining full type information

2014-11-11 Thread Freddy via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 19:23:39 UTC, Adam Taylor wrote: * i apologize in advance, this is my first post -- the code formatting probably wont turn out so great... I have a bunch of duck typed interfaces for "containers" similar to what you would find in std.range. i.e. template isCon

Re: insertInPlace differences between compilers

2014-11-11 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 20:53:51 UTC, John McFarlane wrote: I'm trying to write a struct template that uses `insertInPlace`. However, it doesn't work with certain template type / compiler combinations. Consider the following: import std.range; struct S { const int c; } S[]

Re: Destructor/Finalizer Guarantees

2014-11-11 Thread Dicebot via Digitalmars-d-learn
As for guarantees for class destructors - you have hard guarantees that if memory is reclaimed, destructor was called before. But no guarantees memory will actually be reclaimed.

Re: Destructor/Finalizer Guarantees

2014-11-11 Thread Dicebot via Digitalmars-d-learn
There is an issue with structs that are directly allocated on heap - destructors are never called for those. You will want to change those into classes for GC to do at least something about it. See also this bug report : https://issues.dlang.org/show_bug.cgi?id=2834

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

Destructor/Finalizer Guarantees

2014-11-11 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
I have a situation where I have a VM (virtual machine) object, and several GCRoot (garbage collector root objects). The GCRoots are structs and will "register" themselves into a linked list belonging to the VM. I've made it so they unregister themselves in their destructor. This works perfectly

insertInPlace differences between compilers

2014-11-11 Thread John McFarlane via Digitalmars-d-learn
I'm trying to write a struct template that uses `insertInPlace`. However, it doesn't work with certain template type / compiler combinations. Consider the following: import std.range; struct S { const int c; } S[] a; insertInPlace(a, 0, S()); With DMD64 D Compiler v2.066.1, I g

alias overloaded function template

2014-11-11 Thread Lemonfiend via Digitalmars-d-learn
D is fine with alias this overloaded function: --- void foo(int t) {} void foo(int t, int i) {} alias bar = foo; --- But isn't as happy aliasing these function templates: --- void foo(T)(T t) {} void foo(T)(T t, int i) {} alias bar = foo!int; --- Is there some way/other syntax to make an alias

Re: How to use map?

2014-11-11 Thread Lemonfiend via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 15:53:37 UTC, Marc Schütz wrote: Don't know whether it's documented, but it's a consequence of using string mixins. unaryFun (which is used internally by map) is implemented this way: auto unaryFun(ElementType)(auto ref ElementType __a) { mixin

passing duck-typed objects and retaining full type information

2014-11-11 Thread Adam Taylor via Digitalmars-d-learn
* i apologize in advance, this is my first post -- the code formatting probably wont turn out so great... I have a bunch of duck typed interfaces for "containers" similar to what you would find in std.range. i.e. template isContainer(C) { enum bool isContainer = is(typeof( (inout int

Re: Russian translation of the "range" term?

2014-11-11 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 18:39:09 UTC, Ali Çehreli wrote: The separate concepts "collection" and "range" better have separate words. Ali This is especially important because "collection" tends to have certain connotation with "container" and confusion between ranges and containers is

Re: Russian translation of the "range" term?

2014-11-11 Thread Ali Çehreli via Digitalmars-d-learn
On 11/11/2014 08:10 AM, ketmar via Digitalmars-d-learn wrote: >> What does "набор" mean literally? What is it? > ah, yes, "collection" is a good translation. yet the word "коллекция" > is used literally in some of the programming books. The separate concepts "collection" and "range" better have

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 Chris via Digitalmars-d-learn
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 is of the same type)? Yes (if you mean static type) ElementType!Range is used extensi

Re: Russian translation of the "range" term?

2014-11-11 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Nov 11, 2014 at 04:14:12PM +, Dicebot via Digitalmars-d-learn wrote: > On Tuesday, 11 November 2014 at 16:09:06 UTC, ketmar via Digitalmars-d-learn > wrote: > >"набор ручек для писания", for example, as "set of pens from which > >one pen can be taken and used (or another pen added to be

Re: Network scanner

2014-11-11 Thread via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 16:04:21 UTC, ketmar via Digitalmars-d-learn wrote: 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_LING

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 Dicebot via Digitalmars-d-learn
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 is of the same type)? Yes (if you mean static type) ElementType!Range is used extensively in Phobos

Re: Russian translation of the "range" term?

2014-11-11 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 16:09:06 UTC, ketmar via Digitalmars-d-learn wrote: "набор ручек для писания", for example, as "set of pens from which one pen can be taken and used (or another pen added to be used later)". pretty similar to what "range" in D is, methinks. Only if http://en.wi

Re: Russian translation of the "range" term?

2014-11-11 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 16:00:56 UTC, Ivan Kazmenko wrote: The suggested translations "диапазон" (diapason), "список" (list), "последовательность" (sequence), "набор" (collection) all have something in common with the range concept, but all of them seem to have a defined meaning in eith

Re: Russian translation of the "range" term?

2014-11-11 Thread Dicebot via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 14:52:56 UTC, Kagamin wrote: I was thinking about list comprehension, which is what programming on ranges is. Isn't it? No, not really. It only applies to specific subset of ranges and specific interpretation of "list" term. There is no straightforward equivale

Re: Russian translation of the "range" term?

2014-11-11 Thread Chris via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 16:10:33 UTC, ketmar via Digitalmars-d-learn wrote: 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

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: > > > >> I was thinking about list comprehen

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: Russian translation of the "range" term?

2014-11-11 Thread Ivan Kazmenko via Digitalmars-d-learn
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 "набор" is short and easy, and it's not widely used, as "set" is translated as "множ

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: cannot sort an array of char

2014-11-11 Thread via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 13:20:53 UTC, Steven Schveighoffer wrote: On 11/11/14 6:07 AM, Ivan Kazmenko wrote: IK>> Why is "char []" so special that it can't be sorted? SS> Because sort works on ranges, and std.range has the view that SS> char[] is a range of dchar without random access.

Re: How to use map?

2014-11-11 Thread via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 14:09:43 UTC, Lemonfiend wrote: Oh, no it doesn't. My bad. It was all about !(Foo) vs !(`Foo(a)`). Is there somewhere I can read more about this? Don't know whether it's documented, but it's a consequence of using string mixins. unaryFun (which is used inter

Re: Access Violation Tracking

2014-11-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/11/14 10:14 AM, Kagamin wrote: On Friday, 7 November 2014 at 03:45:23 UTC, Steven Schveighoffer 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. If you let the exception propagate into OS, by

Re: Russian translation of the "range" term?

2014-11-11 Thread Chris via Digitalmars-d-learn
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: 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 tak

Re: Network scanner

2014-11-11 Thread RuZzz via Digitalmars-d-learn
netstat reports that the socket is in the TIME_WAIT or CLOSE_WAIT state.

Re: Access Violation Tracking

2014-11-11 Thread Kagamin via Digitalmars-d-learn
On Saturday, 8 November 2014 at 15:51:59 UTC, Gary Willoughby wrote: This is really cool, (and at the risk of sounding foolish) what is the benefit of doing this? It turns segfault into normal exception with a stack trace, so you see where it failed right away.

Re: Access Violation Tracking

2014-11-11 Thread Kagamin via Digitalmars-d-learn
On Friday, 7 November 2014 at 03:45:23 UTC, Steven Schveighoffer 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. If you let the exception propagate into OS, by default Windows creates memory dump

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 Kagamin via Digitalmars-d-learn
I was thinking about list comprehension, which is what programming on ranges is. Isn't it?

Re: status of D optimizers benefiting from contracts ?

2014-11-11 Thread Kagamin via Digitalmars-d-learn
On Monday, 10 November 2014 at 10:27:19 UTC, bearophile wrote: In practice I prefer to avoid using hacks like setting a NDEBUG. It's better to have differently named operators if their behavour is different. So it's better to keep the assert() as it is commonly used (and I'd like it to refuse a

Re: Network scanner

2014-11-11 Thread RuZzz via Digitalmars-d-learn
OS WinXP

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: How to use map?

2014-11-11 Thread Lemonfiend via Digitalmars-d-learn
Oh, no it doesn't. My bad. It was all about !(Foo) vs !(`Foo(a)`). Is there somewhere I can read more about this?

Re: Russian translation of the "range" term?

2014-11-11 Thread Kagamin via Digitalmars-d-learn
Another synonym is "list".

Re: How to use map?

2014-11-11 Thread Lemonfiend via Digitalmars-d-learn
The code you were trying to write: struct Foo(T) { T t; } void main() { import std.stdio, std.algorithm, std.array; float[] vals = [1.1, 2.1, 3.1, 4.1]; auto arr = vals.map!(Foo!float).array; arr.writeln; } Sorry, my example had an unneeded template. Simply this (and also

Re: How to use map?

2014-11-11 Thread bearophile via Digitalmars-d-learn
Lemonfiend: If I instead do ie. map!`cast(int)a` it works fine. What am I missing? Generally don't use casts, unless you know what you are doing (and often you don't). The code you were trying to write: struct Foo(T) { T t; } void main() { import std.stdio, std.algorithm, std.arra

How to use map?

2014-11-11 Thread Lemonfiend via Digitalmars-d-learn
I'm trying to do something simple like creating an array of struct S from a float array via map: --- void main() { float[] vals = [1.1, 2.1, 3.1, 4.1]; import std.algorithm: map; auto arr = vals.map!`S(a)`.array; writeln(arr); } struct S(T) { T t; } ---

Re: cannot sort an array of char

2014-11-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/11/14 6:07 AM, Ivan Kazmenko wrote: IK>> Why is "char []" so special that it can't be sorted? SS> Because sort works on ranges, and std.range has the view that SS> char[] is a range of dchar without random access. Nevermind SS> what the compiler thinks :) SS> SS> I believe you can get what

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

Russian translation of the "range" term?

2014-11-11 Thread Ivan Kazmenko via Digitalmars-d-learn
Hi! I'm unsure what is the Russian equivalent for the term "range", as in "D range", the generalization of a pair of iterators. With "range" being such an overloaded term in source language and having no exact equivalent in the target language, its Russian translations I have come up with do

Re: cannot sort an array of char

2014-11-11 Thread Ivan Kazmenko via Digitalmars-d-learn
IK>> Why is "char []" so special that it can't be sorted? SS> Because sort works on ranges, and std.range has the view that SS> char[] is a range of dchar without random access. Nevermind SS> what the compiler thinks :) SS> SS> I believe you can get what you want with SS> std.string.representatio

Re: cannot sort an array of char

2014-11-11 Thread Ivan Kazmenko via Digitalmars-d-learn
IK>> For example, isRandomAccessRange[0] states the problem: IK>> - IK>> Although char[] and wchar[] (as well as their qualified IK>> versions including string and wstring) are arrays, IK>> isRandomAccessRange yields false for them because they use IK>> variable-length encodings (UTF-8 and UTF

Re: practicality of empirical cache optimization in D vs C++

2014-11-11 Thread John Colvin via Digitalmars-d-learn
On Monday, 10 November 2014 at 19:18:21 UTC, Kirill wrote: Dear D community (and specifically experts on cache optimization), I'm a C++ programmer and was waiting for a while to do a project in D. I'd like to build a cache-optimized decision tree forest library, and I'm debating between D a

Re: Live without debugger?

2014-11-11 Thread Bauss via Digitalmars-d-learn
On Monday, 10 November 2014 at 10:50:49 UTC, Chris wrote: On Sunday, 9 November 2014 at 08:26:59 UTC, Suliman wrote: I know that a lot of people are using for programming tools like Sublime. I am one of them. But if for very simple code it's ok, how to write hard code? Do you often need debug