Re: The best programming advice I ever got

2012-08-29 Thread Torarin
2012/8/29 Andrei Alexandrescu seewebsiteforem...@erdani.org: Not directly related to D, but hopefully a hook :o). http://www.informit.com/articles/article.aspx?p=1945828 Andrei Loved it! Torarin

Re: What guarantees does D 'const' provide, compared to C++?

2012-08-16 Thread Torarin
declared mutable (7.1.1) can be modified, any attempt to modify a const object during its lifetime (3.8) results in undefined behavior. Torarin

Re: const ref and rvalues

2012-02-15 Thread Torarin
2012/2/16 Trass3r u...@known.com: I posted this question several times already and no answer yet, why is allowing temporaries bind to ref const params bad again? To give you the option, I think. const ref doesn't bind to r-values, while const auto ref does. Torarin

Re: typedef deprecated - now what ?

2011-12-30 Thread Torarin
=5467 thats too bad. pull request looks good. i voted for the ticket, but i guess that no one gives shit about that either :( Sure they give a shit. :-) I think Andrei is currently looking into ProxyOf for a new reference-counting type constructor. Torarin

Re: A nice way to step into 2012

2011-12-27 Thread Torarin
forgot, and got the same error. Torarin

2.057 regression and Result structs in std.algorithm

2011-12-16 Thread Torarin
-static Result structs. Would it be a good idea to make them static, where possible? Torarin

Re: D Programming Language Specification ebook

2011-07-04 Thread Torarin
2011/7/5 Andrei Alexandrescu seewebsiteforem...@erdani.org: It's whom :o). Andrei Are you sure? The people in people ... are complete idiots are the subjects of the sentence, so surely the subjective case of who is appropriate? Torarin

Re: D brand identity repository

2011-07-02 Thread Torarin
with this! Torarin

Re: D brand identity repository

2011-06-30 Thread Torarin
prefer minimalistic logos, like Haskell's, but this one is so fun. It's balanced and it works. Torarin

Re: Flag proposal

2011-06-10 Thread Torarin
: false, thisOneIsntRequired: true); Would all be valid. The second call is problematic because it still allows bad style in calls. Andrei I agree, introducing a syntax for required named parameters sounds like it would entail baggage of similar weight. Torarin

Re: How about a Hash template?

2011-04-28 Thread Torarin
, especially if search will be optimized to series of comparisons for small item count.  Perhaps we should file a feature request? :) /Alexander This has been discussed before, see: http://www.mail-archive.com/digitalmars-d@puremagic.com/msg38779.html Torarin

Re: [Article Context, First Draft] Concurrency, Parallelism and D

2011-04-09 Thread Torarin
! And I like that you linked to other articles that go into more detail on relevant subjects. I wouldn't mind a couple more examples. Torarin

Re: image processing in D

2011-04-07 Thread Torarin
2011/4/4 Emil Madsen sove...@gmail.com: And a more specific question; say one wants to blur a picture with Gaussian blur, how would D ranges deal with the 2d array? foreach (r; image.rows) convolute1d(r, gaussianKernel); foreach (c; image.cols) convolute1d(c, gaussianKernel); Torarin

Re: [GSoC Proposal draft] High-Level Networking

2011-04-07 Thread Torarin
as well, but several sources say that overlapped IO is more efficient, and it probably is cleaner. But it's still nice to have a reactor that wraps select and friends, and then specialize the individual proactors as needed. Was that what you were thinking, Max? Torarin

Re: Jonas Drewsen has been accepted as a GSoC 2011 mentor for Digital Mars

2011-04-07 Thread Torarin
Congratulations, Jonas! Torarin

Re: [GSoC Proposal draft] High-Level Networking

2011-04-05 Thread Torarin
regards, Torarin

Re: GSoC: Containers and Ranges

2011-04-02 Thread Torarin
if I don't get the chance - I take it serious :-) If you haven't read it already, I recommend Andrei Alexandrescu's great article introducing ranges: http://www.informit.com/articles/article.aspx?p=1407357 Torarin

Re: Asynchronicity in D

2011-04-01 Thread Torarin
2011/3/31 Jonas Drewsen jdrew...@nospam.com: On 31/03/11 21.19, Torarin wrote: I'm currently working on an http and networking library that uses asynchronous sockets running in fibers and an event loop a la libev. These async sockets have the same interface as regular Berkeley sockets, so

Re: null Vs [] return arrays

2011-04-01 Thread Torarin
not interested in the difference, and you need performance, you simply use 'null'.  Everybody is happy. :) R For associative arrays it certainly would be nice to be able to do something like string[string] options = [:]; so that functions can manipulate an empty aa without using ref. Torarin

Re: Asynchronicity in D

2011-03-31 Thread Torarin
arguments. For instance, it has HttpClient!AsyncSocket and HttpClient!Socket. Torarin

Re: [OT] Webpage design and Name That Color!

2011-02-19 Thread Torarin
warm grey

appendToFront semantics

2011-02-15 Thread Torarin
would lose the ability to limit the amount read from the underlying stream, which could be useful for a e.g. a protocol switch, but I'm inclined to think that's less important than the efficiency of the common case. Did I miss the reason why this doesn't work well? Torarin

Re: appendToFront semantics

2011-02-15 Thread Torarin
data available. But isn't the reason you're supplying a value to appendToFront that you do want a specific amount? If not, you can use appendToFront(0) until you get what you want. Torarin

Re: appendToFront semantics

2011-02-15 Thread Torarin
. Andrei If the stream ends it would return short. Anyway, my main point was to allow it to read more than n elements. So if you give it the definition try to append n elements or more it caters for the don't block and don't consume more memory than this situation as well. Torarin

Re: higher-order funcs for ranges (with usual interface)

2011-02-07 Thread Torarin
)) This will of course only work for methods, not properties or aliases, so you still need constraints in some cases. Torarin

Re: buffered input

2011-02-06 Thread Torarin
, but that doesn't sound like a common case. Torarin

Re: buffered input

2011-02-06 Thread Torarin
2011/2/7 Andrei Alexandrescu seewebsiteforem...@erdani.org: On 2/6/11 9:47 PM, Torarin wrote: 2011/2/7 Robert Jacquessandf...@jhu.edu: On Sun, 06 Feb 2011 10:43:47 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org  wrote: On 2/6/11 6:01 EST, Tomek Sowiński wrote: Nick Sabalausky

Re: buffered input

2011-02-06 Thread Torarin
2011/2/7 Robert Jacques sandf...@jhu.edu: On Sun, 06 Feb 2011 21:47:48 -0500, Torarin torar...@gmail.com wrote: 2011/2/7 Robert Jacques sandf...@jhu.edu: On Sun, 06 Feb 2011 10:43:47 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 2/6/11 6:01 EST, Tomek Sowiński wrote

Re: buffered input

2011-02-05 Thread Torarin
the stream to add any number of elements at its own discretion. This is really cool. I realise now that appendToFront fills the gap in the design providing only shiftFront/advance. I also thought their names were well-chosen. Torarin

Re: const/immutable member functions

2011-01-24 Thread Torarin
want to mark a bunch of functions const inside {}? Torarin

Re: const/immutable member functions

2011-01-24 Thread Torarin
all of them to go there, like Jonathan suggested. Torarin

Re: const/immutable member functions

2011-01-24 Thread Torarin
funcName inputParams - outputParams { body } This is the typical functional language design. It is arguably more consistent to have the return type come first, as in variable declarations: int a = 4; int foo() { return 5; } Both foo() and a are now of type int. Torarin

Re: Opt-out closures

2011-01-23 Thread Torarin
think you can use this hack: import std.traits; auto scopeDelegate(D)(scope D d) if (isDelegate!D) { return d; } int main() { StructWithDtor s; trustedFunction(scopeDelegate({s.a = 5;}); // No heap allocation } Torarin

Re: more naming

2011-01-22 Thread Torarin
function, not a runtime parameter to the existing function. This is because the function that replaces only one occurrence only requires nail to be an input range. Andrei It sounds like the current replace should be named replaceAll. Torarin

Re: Python's partition

2011-01-22 Thread Torarin
Divide? As in dividing a pie chart. Torarin

Re: more naming

2011-01-22 Thread Torarin
2011/1/22 Andrei Alexandrescu seewebsiteforem...@erdani.org: That's what I'm fearing - changing current replace to replaceAll and adding replace with the meaning of replaceFirst would silently change the semantics of existing code. Andrei Yeah, I see that problem. I'm just so used to

Re: emscripten

2010-12-15 Thread Torarin
message in each thread. It also preloads the first few words of every message as a preview. I'll give you that it could have fetched everything, though. Torarin

Re: C#'s greatest mistakes

2010-11-27 Thread Torarin
2010/11/27 Andrei Alexandrescu seewebsiteforem...@erdani.org: We use template constraints for that kind of stuff. Andrei Yes, and that's great, but is there a way to check whether a template argument matches a defined interface?

Re: C#'s greatest mistakes

2010-11-27 Thread Torarin
2010/11/28 Jonathan M Davis jmdavisp...@gmx.com: If you have a set of functions that are expected to be there (for instance, to verify that the given type is a certain type of range), then just create template which checks for each of the functions that are supposed to be there and use the

Re: C#'s greatest mistakes

2010-11-27 Thread Torarin
in the traditional sense. The interface is just the concept. Torarin

Re: C#'s greatest mistakes

2010-11-27 Thread Torarin
2010/11/28 Michel Fortin michel.for...@michelf.com: Well, if you consider the previously discussed 'adaptTo' function template, all types can be adapted to an interface (via a template-generated wrapper class). So implements for structs isn't too far off, as you can use the struct to implement

Re: C#'s greatest mistakes

2010-11-26 Thread Torarin
Static interfaces (same thing as c++ 0x's ditched concepts) seem very useful. Did you consider them at some point? Torarin 2010/11/27 Walter Bright newshou...@digitalmars.com: Andrei Alexandrescu wrote: http://oredev.org/2010/sessions/c-s-greatest-mistakes A summary for those who don't want

Re: Apache mod_d needs C to instantiate D interpreter?

2010-11-08 Thread Torarin
2010/11/9 Andrei Alexandrescu seewebsiteforem...@erdani.org: People at Facebook told me that the adoption of D inside the company might be helped if they could simply write ?d ... ? to insert D code into a page. I'm not sure how difficult such a plugin would be to implement. Also, D code

Re: shorter foreach syntax - C++0x range-based for

2010-11-01 Thread Torarin
Pilsy: D is as much Java++ as it is C+=2. Andrei: Java did a lot of things right (be they novel or not) that are present in D Even if Java did only a single thing right, it would be silly to not adopt it just to avoid embarrassment. Anyway, I think it's a nice syntax.

Re: Associative array .get with .init as default second argument

2010-10-21 Thread Torarin
2010/10/18 bearophile bearophileh...@lycos.com: In what cases is this useful? Are you able to show me an example of situation where it is useful? Bye, bearophile Bearophile, I probably didn't make it very clear, so I'll try again: Now: if (headers.get(transfer-encoding, ) == chunked)

Associative array .get with .init as default second argument

2010-10-18 Thread Torarin
The AA .get function is defined like this: Value get(Key key, lazy Value defaultValue) { auto p = key in *cast(Value[Key]*)(p); return p ? *p : defaultValue; } Can we also have an overload that uses Value's init value as fallback? That would simplify checks like this:

Re: Associative array .get with .init as default second argument

2010-10-18 Thread Torarin
The useful situation is when you care only about the presence of a certain value in a given key. I actually gave an example of it.

Re: duck!

2010-10-16 Thread Torarin
I feel as and to are too similar, they could both be interpreted as simple casting for example.

Re: in everywhere

2010-10-08 Thread Torarin
2010/10/7 Andrei Alexandrescu seewebsiteforem...@erdani.org: In the end I figured there was only _one_ quadratic operation - appending to a vectorsize_t that held document lengths. That wasn't even the bulk of the data and it was the last thing I looked at! Yet it made the run time impossible

Re: Am I doing it wrong?

2010-10-03 Thread Torarin
2010/10/3 Emil Madsen sove...@gmail.com: Well the result is assigned to an immutable int, shouldn't that be a compile const too? Immutable means that the variable, or the memory it points to, will not change. You can still assign run-time values to it: void main(string[] args) { immutable

Re: Am I doing it wrong?

2010-10-03 Thread Torarin
2010/10/3 Emil Madsen sove...@gmail.com: ah ofc! I shoulda know :) - So I were doing it wrong :) Say I'm doing that enum a = calcPrimes(); then a will be an enum with 1 element, that I can use as an int right? Yes, effectively you are declaring an anonymous enum with one element. By default an

Re: The Wrong Stuff

2010-09-25 Thread Torarin
2010/9/24 Jonathan M Davis jmdavisp...@gmx.com: However, we're not going to double the number of keywords that we have, and the @ syntax has allowed us to remove some keywords and will allow us to add more stuff later without having to add keywords. Why are attributes not considered

Re: The Wrong Stuff

2010-09-25 Thread Torarin
2010/9/25 Jonathan M Davis jmdavisp...@gmx.com: Part of the point of attributes was to make it so that they weren't keywords and therefore didn't make the list of keywords any longer. If they make the attribute list longer, what do you gain from making the keyword list shorter, other than

Re: The Wrong Stuff

2010-09-25 Thread Torarin
2010/9/25 Jérôme M. Berger jeber...@free.fr:        Basically, all it does is defining a namespace for keywords. Since you can't define identifiers with an @, then whenever Walter wants to add a new keyword, he only has to pick one that start with @ to make sure that he won't break anyone's

Re: std.mixins

2010-09-01 Thread Torarin
TDPL says it should work for any type. http://d.puremagic.com/issues/show_bug.cgi?id=3382 2010/9/1 Nick Sabalausky a...@a.a: dsimcha dsim...@yahoo.com wrote in message news:i5jtdn$1g4...@digitalmars.com... Isn't this a core language feature that's in the spec but is only currently

Re: std.mixins

2010-09-01 Thread Torarin
, 2010 at 20:59, Nick Sabalausky a...@a.a wrote: Torarin torar...@gmail.com wrote in messageTDPL says it should work for any type. http://d.puremagic.com/issues/show_bug.cgi?id=3382 /me squeals with excitement like a schoolgirl Any type, really? Even the basic built-in types, not only class

Re: std.mixins

2010-09-01 Thread Torarin
2010/9/1 Philippe Sigaud philippe.sig...@gmail.com: I just tried this:     int i;     writeln(i.max); // writes int.max ! So it seems you can access the type properties through a value of that type. Man, I learnt two new things in two minutes... Yay, looks pretty good, then! :)

Re: [Slight OT] TDPL in Russia

2010-08-31 Thread Torarin
So reviews are useless? 2010/8/31 BCS n...@anon.com: Hello Kagamin, dsimcha Wrote: Of course everyone thinks ~60-70% of what Hollywood puts out is crap. The problem is that everyone thinks that about a **different** ~60-70% because different movies cater to different niches.  Having a

Re: [Slight OT] TDPL in Russia

2010-08-31 Thread Torarin
2010/8/31 BCS n...@anon.com: Hello Torarin, So reviews are useless? Without context, yes they are useless. With context, your just looking at correlation: i.e we like/dislike the same things. I can understand the premise of the view that art cannot be quality-assessed, but I think

Re: std.algorithm move() struct emptying

2010-08-30 Thread Torarin
Currently you can take its address, so doesn't that mean that it's an lvalue? 2010/8/30 Jonathan M Davis jmdavisp...@gmail.com: On Sunday, August 29, 2010 11:51:51 Torarin wrote: Even in this case, or in some special case? Torarin 2010/8/29 Andrei Alexandrescu seewebsiteforem...@erdani.org

Re: std.algorithm move() struct emptying

2010-08-30 Thread Torarin
Yeah, I get the enum case, but what I forgot to mention is that the example from move() is enclosed in static if (is(T == struct)) Which makes me wonder what kind of struct would have an rvalue .init. Torarin 2010/8/30 Stanislav Blinov stanislav.bli...@gmail.com: You may be able to take

std.algorithm move() struct emptying

2010-08-29 Thread Torarin
Hi, in std.algorithm move(), this is the operation used to set the source of a struct move to .init: static T empty; memcpy(source, empty, T.sizeof); Is there any particular reason why the more compact T.init is not used?

Re: std.algorithm move() struct emptying

2010-08-29 Thread Torarin
Yes, you are right! Looking at the assembly, T.init creates a struct on the stack. 2010/8/29 Stanislav Blinov stanislav.bli...@gmail.com Torarin wrote: Hi, in std.algorithm move(), this is the operation used to set the source of a struct move to .init:  static T empty;  memcpy(source

Re: std.algorithm move() struct emptying

2010-08-29 Thread Torarin
Even in this case, or in some special case? Torarin 2010/8/29 Andrei Alexandrescu seewebsiteforem...@erdani.org: On 08/29/2010 12:00 PM, Torarin wrote: Hi, in std.algorithm move(), this is the operation used to set the source of a struct move to .init:   static T empty;   memcpy(source

Socket.shutdown() error handling

2010-08-22 Thread Torarin Hals Bakke
Perhaps Socket.shutdown() in std.socket should throw an exception in case of an error? Unlike close(), it may fail before you are done with the socket. One may, for instance, want to wait for a confirmation message from the client after sending the FIN packet with shutdown(SocketShutdown.SEND). If