Re: " is not mutable" when using ref return type

2011-05-18 Thread Jonathan M Davis
On 2011-05-18 21:52, Mehrdad wrote: > On 5/18/2011 9:22 PM, Jonathan M Davis wrote: > > On 2011-05-18 20:55, %u wrote: > >> Hi! > >> > >> Is this a bug, or is it intentional that this fails? I can't come up > >> with any case where it would cause a problem, but the compiler doesn't > >> > >> like

Re: " is not mutable" when using ref return type

2011-05-18 Thread Mehrdad
On 5/18/2011 9:22 PM, Jonathan M Davis wrote: On 2011-05-18 20:55, %u wrote: Hi! Is this a bug, or is it intentional that this fails? I can't come up with any case where it would cause a problem, but the compiler doesn't like the fact that there's a const in the structure: struct Temp { c

Re: Generators in D

2011-05-18 Thread Sean Kelly
On May 18, 2011, at 5:21 PM, Piotr Szturmaj wrote: > Jose Armando Garcia wrote: >>> >>> If serialization will be clever enough, these fibers could even be shared >>> across different servers! This is really a requirement in load balanced >>> environments. >>> >> >> A very old research paper (I

Re: Generators in D

2011-05-18 Thread Sean Kelly
On May 18, 2011, at 5:07 PM, Piotr Szturmaj wrote: > Sean Kelly wrote: >> >> On May 18, 2011, at 8:00 AM, Piotr Szturmaj wrote: >> >>> Sean Kelly wrote: On May 17, 2011, at 2:37 PM, Piotr Szturmaj wrote: > > But couldn't Fiber's stack be scanned for references to itself and >

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Jonathan M Davis
On 2011-05-18 21:09, Jesse Phillips wrote: > Jonathan M Davis Wrote: > > The huge advantage of assert over writeln is that it shows you what the > > result is supposed to be. If you're reading the code or documentation, > > that's extremely valuable, whereas writeln is useless. However, if what > >

Re: " is not mutable" when using ref return type

2011-05-18 Thread Jonathan M Davis
On 2011-05-18 20:55, %u wrote: > Hi! > > Is this a bug, or is it intentional that this fails? I can't come up > with any case where it would cause a problem, but the compiler doesn't > like the fact that there's a const in the structure: > > struct Temp { const int a; int b; } > > auto r

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Jesse Phillips
Jonathan M Davis Wrote: > The huge advantage of assert over writeln is that it shows you what the > result > is supposed to be. If you're reading the code or documentation, that's > extremely valuable, whereas writeln is useless. However, if what you're > concerned about is running the code an

" is not mutable" when using ref return type

2011-05-18 Thread %u
Hi! Is this a bug, or is it intentional that this fails? I can't come up with any case where it would cause a problem, but the compiler doesn't like the fact that there's a const in the structure: struct Temp { const int a; int b; } auto ref foo(Temp* t) { return *t; } //Error

Re: Article Review: Migrating from std.date to std.datetime

2011-05-18 Thread Jonathan M Davis
On 2011-05-18 12:37, Steven Schveighoffer wrote: > On Wed, 18 May 2011 00:36:26 -0400, Jonathan M Davis > > wrote: > > A minor update with a few corrections: http://is.gd/GNELTZ > > > > Naturally, it's also up on my github account: > > https://github.com/jmdavis/d- > > programming-language.org/t

Re: Testable ddoc snippets?

2011-05-18 Thread Andrei Alexandrescu
On 05/18/2011 08:07 PM, Adam D. Ruppe wrote: I haven't spent the time to figure out github yet! Hopefully you'll do that soon. You've done great work, and integrating it is top priority. Thanks, Andrei

Re: Testable ddoc snippets?

2011-05-18 Thread Adam D. Ruppe
I haven't spent the time to figure out github yet!

Testable ddoc snippets?

2011-05-18 Thread Andrei Alexandrescu
We should finalize the testable doc snippets. Adam, do you think you could work on a pull request to integrate your work with d-programming-language.org? You've done some great work that deserves finalization. Thanks, Andrei

Re: Generators in D

2011-05-18 Thread Piotr Szturmaj
Jose Armando Garcia wrote: If serialization will be clever enough, these fibers could even be shared across different servers! This is really a requirement in load balanced environments. A very old research paper (I think it was for the amoeba project) wrote a long time ago (I don't remember

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Jonathan M Davis
> Steven Schveighoffer Wrote: > > I always wonder about that. One of the issues with assert for people > > "feeling" out the language is, a passing assert doesn't seem to do > > anything. > > > > For instance, in this example, if you take the code I wrote, and compile > > it, you'll get a loud ass

Feedback/Suggestions for std.log

2011-05-18 Thread Gary
1. Background Hi all, first time posting. This message is in response to Andrei's first call for feedback on the proposed std.log interface. I'm piping up on the log topic because of recent experience using a logging library ("log4cxx") on a project at work. I'll attempt to identify our tea

Re: Generators in D

2011-05-18 Thread Piotr Szturmaj
Sean Kelly wrote: On May 18, 2011, at 8:00 AM, Piotr Szturmaj wrote: Sean Kelly wrote: On May 17, 2011, at 2:37 PM, Piotr Szturmaj wrote: But couldn't Fiber's stack be scanned for references to itself and readjusted? Without type information, there's no way to be sure that something is ac

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Jesse Phillips
Steven Schveighoffer Wrote: > I always wonder about that. One of the issues with assert for people > "feeling" out the language is, a passing assert doesn't seem to do > anything. > > For instance, in this example, if you take the code I wrote, and compile > it, you'll get a loud assertion

Re: Builtin regex (Was: How to complex switch?)

2011-05-18 Thread bearophile
Andrei: > One possibility that I hadn't thought before is to use ";" for > separating tuple elements. Upon a casual inspection, it turns out no > statement can be enclosed directly in "(" and ")" so there's no > ambiguity. It would also take care of the issue "did you mean to pass > them as fu

Re: Curl wrapper

2011-05-18 Thread Andrei Alexandrescu
On 5/18/11 5:29 PM, jdrewsen wrote: Den 18-05-2011 16:53, Andrei Alexandrescu skrev: On 5/18/11 6:07 AM, Jonas Drewsen wrote: Select will wait for data to be ready and ask curl to handle the data chunk. Curl in turn calls back to a registered callback handler with the data read. That handler fi

Re: libcurl

2011-05-18 Thread Andrei Alexandrescu
On 5/18/11 5:34 PM, jdrewsen wrote: Den 18-05-2011 19:59, Walter Bright skrev: On 5/18/2011 10:50 AM, Andrei Alexandrescu wrote: I sat down to write an announcement to the libcurl mailing list that we have support for it starting with 2.053. To my surprise, when I tried to provide a link to the

Re: libcurl

2011-05-18 Thread jdrewsen
Den 18-05-2011 19:59, Walter Bright skrev: On 5/18/2011 10:50 AM, Andrei Alexandrescu wrote: I sat down to write an announcement to the libcurl mailing list that we have support for it starting with 2.053. To my surprise, when I tried to provide a link to the documentation, there wasn't any avai

Re: Curl wrapper

2011-05-18 Thread jdrewsen
Den 18-05-2011 16:53, Andrei Alexandrescu skrev: On 5/18/11 6:07 AM, Jonas Drewsen wrote: Select will wait for data to be ready and ask curl to handle the data chunk. Curl in turn calls back to a registered callback handler with the data read. That handler fills the buffer provided by the user.

[OT] JavaScript x86 Linux emulator

2011-05-18 Thread Piotr Szturmaj
http://bellard.org/jslinux/ Written in JS, emulates x86 CPU without FPU/MMX/SSE. Linux 2.6.20. Even has C compiler (tcc)! Anyone to run some D code on the client side? ;)

Re: Builtin regex (Was: How to complex switch?)

2011-05-18 Thread Andrei Alexandrescu
On 5/18/11 5:12 PM, Timon Gehr wrote: Timon Gehr: Library code should make use of the language to implement its semantics. Not the other way round. Why? Short story: Obvious? Do you really want to make some non-built-in types more equal than others? Why would you want to have a dependency

Re: Builtin regex (Was: How to complex switch?)

2011-05-18 Thread Timon Gehr
> Timon Gehr: > > > Library code should make use of the language to implement its semantics. > > Not the other way round. > > Why? Short story: Obvious? Do you really want to make some non-built-in types more equal than others? Why would you want to have a dependency cycle between std and the com

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Johann MacDonagh
On 5/18/2011 2:03 PM, Steven Schveighoffer wrote: Having seen quite a few incorrect descriptions of how D slices work (particularly regarding appending), I wrote an article that tries to describe how D slices work, and why they behave the way they do. Being one of the only places where I have we

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Andrej Mitrovic
Asserts are kind of like going to court and interpreting the silence of the jury as a not guilty verdict. :p

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 16:47:47 -0400, Alex_Dovhal wrote: Nice article, very pleasured to read. One thing that strained my mind - this exaple: import std.stdio; char[] fillAs(char[] buf, size_t num) { if(buf.length < num) buf.length = num; // increase buffer length to be able to hold

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 16:37:49 -0400, Jesse Phillips wrote: Steven Schveighoffer Wrote: Having seen quite a few incorrect descriptions of how D slices work (particularly regarding appending), I wrote an article that tries to describe how D slices work, and why they behave the way they do. S

Re: Curl wrapper

2011-05-18 Thread jdrewsen
Den 18-05-2011 14:52, Johannes Pfau skrev: Jonas Drewsen wrote: On 18/05/11 10.09, Johannes Pfau wrote: jdrewsen wrote: Please see comments below. Den 17-05-2011 16:42, Andrei Alexandrescu skrev: Thanks for the response! A few more answers and comments within (everything deleted counts as "s

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 16:22:50 -0400, Andrej Mitrovic wrote: Well consider me enlightened. From all the things I've read before this article, I thought a slice is a special feature that is only introduced when you take an [n..m] from an array, e.g. my understanding was something like: int[] a

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Alex_Dovhal
"Steven Schveighoffer" ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:op.vvou3fbgeav7ka@localhost.localdomain... > Having seen quite a few incorrect descriptions of how D slices work > (particularly regarding appending), I wrote an article that tries to > describe how D slices work, and why they

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Jesse Phillips
Steven Schveighoffer Wrote: > Having seen quite a few incorrect descriptions of how D slices work > (particularly regarding appending), I wrote an article that tries to > describe how D slices work, and why they behave the way they do. Still reading, but the example should use assertions whic

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Andrej Mitrovic
Well consider me enlightened. From all the things I've read before this article, I thought a slice is a special feature that is only introduced when you take an [n..m] from an array, e.g. my understanding was something like: int[] a = new int[5]; // a is definitely a dynamic array auto b = a[1..3

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 14:44:33 -0400, David Gileadi wrote: I do have a couple of nits: Fixed -Steve

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Andrej Mitrovic
On 5/18/11, David Gileadi wrote: > There is at least one other place in the document that also make this mistake. The first sentence! :]

Re: Alias templates and anonymous delegates in pipe/map

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 15:11:56 -0400, Adrien Chauve wrote: Hi, anyone on the alias difference? I have a feeling that alias needs to be a symbol, and int is a keyword. a template alias can be any symbol, including a variable, function, delegate, etc. Though it does seem unintuitive that

Re: Article Review: Migrating from std.date to std.datetime

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 00:36:26 -0400, Jonathan M Davis wrote: A minor update with a few corrections: http://is.gd/GNELTZ Naturally, it's also up on my github account: https://github.com/jmdavis/d- programming-language.org/tree/article_datetime One comment: 'It should be noted however tha

Struct constructor, static opCall and object opCall

2011-05-18 Thread kenji hara
I'm challenging to fix title issue. Related issues in bug tracking system: http://d.puremagic.com/issues/show_bug.cgi?id=3680 http://d.puremagic.com/issues/show_bug.cgi?id=4053 http://d.puremagic.com/issues/show_bug.cgi?id=4253 I think that follows are correct behavior of dmd. Please point out to

libcurl

2011-05-18 Thread Andrei Alexandrescu
I sat down to write an announcement to the libcurl mailing list that we have support for it starting with 2.053. To my surprise, when I tried to provide a link to the documentation, there wasn't any available. Furthermore, when I tried to generate documentation it came messed up. Obviously ddo

Re: libcurl

2011-05-18 Thread Walter Bright
On 5/18/2011 10:50 AM, Andrei Alexandrescu wrote: I sat down to write an announcement to the libcurl mailing list that we have support for it starting with 2.053. To my surprise, when I tried to provide a link to the documentation, there wasn't any available. Furthermore, when I tried to generat

[Article Contest, first draft] D Slices

2011-05-18 Thread Steven Schveighoffer
Having seen quite a few incorrect descriptions of how D slices work (particularly regarding appending), I wrote an article that tries to describe how D slices work, and why they behave the way they do. Being one of the only places where I have web space, it's on my dcollections site, I prob

Re: Best build tool for D projects

2011-05-18 Thread Jesse Phillips
Can you build a simple hello world program with just: dmd hello.d The build can't find the phobos/druntime libraries for linking. Chris Molozian Wrote: [Stuff]

Re: Builtin regex (Was: How to complex switch?)

2011-05-18 Thread bearophile
Timon Gehr: > Library code should make use of the language to implement its semantics. > Not the other way round. Why? > Another reason I dislike it: it looks different to other "tuple literals" > that are already built-in: > > foo (note, how, this, is, a, tuple, "!"); Looking different from

Re: Alias templates and anonymous delegates in pipe/map

2011-05-18 Thread Adrien Chauve
Hi, anyone on the alias difference? Thanks, Adrien On Sat, May 14, 2011 at 20:12, Adrien Chauve wrote: > Hi, > > I've been playing with templates and I get some (really dumb) questions. > By the way, I'm using dmd 2.053 64 bits on linux 64 bits. > > > First, I didn't really get the difference b

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread David Gileadi
On 5/18/11 11:03 AM, Steven Schveighoffer wrote: Please, if you have any comments or recommendations, let me know. First off, this is a fantastic article. Thanks for clearly explaining a fairly subtle concept. I'm especially happy to finally understand how appending to a slice can avoid rea

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 14:44:33 -0400, David Gileadi wrote: On 5/18/11 11:03 AM, Steven Schveighoffer wrote: Please, if you have any comments or recommendations, let me know. First off, this is a fantastic article. Thanks for clearly explaining a fairly subtle concept. I'm especially happ

Re: Generators in D

2011-05-18 Thread Sean Kelly
On May 18, 2011, at 8:00 AM, Piotr Szturmaj wrote: > Sean Kelly wrote: >> On May 17, 2011, at 2:37 PM, Piotr Szturmaj wrote: >>> >>> But couldn't Fiber's stack be scanned for references to itself and >>> readjusted? >> >> Without type information, there's no way to be sure that something is >

Re: Implementing std.log

2011-05-18 Thread Andrei Alexandrescu
On 5/18/11 8:00 AM, Jose Armando Garcia wrote: I also think that having competing logging module is a good thing. This process will result in a better module for phobos and as a result a better module for the user. Clearly there are advantages to competing proposals, but I have mixed feelings

Re: Best build tool for D projects

2011-05-18 Thread Chris Molozian
Thanks to everyone for the help and advice on choosing a build tool for my D+LLVM project. I settled on Jam (ftjam) in the end, the major factor being cross-platform support and prebuilt binaries for a variety of operating systems. The documentation for Jam I've found is very lacking but have

Re: keywords "objconst" and "objimmutable" vs. const(Object) ref

2011-05-18 Thread Michel Fortin
On 2011-05-18 10:46:19 -0400, Timon Gehr said: Given that reference types do not support the semantics asked for at all (with transitive const/immutable), I think this is as consistent as it can get. (also way better than "obj" all over the place.) Am I correct when I assume that, if Foo is a c

Re: Generators in D

2011-05-18 Thread Piotr Szturmaj
Sean Kelly wrote: On May 17, 2011, at 2:37 PM, Piotr Szturmaj wrote: Sean Kelly wrote: On May 11, 2011, at 3:06 PM, Piotr Szturmaj wrote: Andrei Alexandrescu wrote: * can you implement save() to make this a forward range (e.g. by creating a new fiber that has its own state)? It is not tha

Re: Curl wrapper

2011-05-18 Thread Andrei Alexandrescu
On 5/18/11 6:07 AM, Jonas Drewsen wrote: Select will wait for data to be ready and ask curl to handle the data chunk. Curl in turn calls back to a registered callback handler with the data read. That handler fills the buffer provided by the user. If not enough data has been receive an new select

Re: keywords "objconst" and "objimmutable" vs. const(Object) ref

2011-05-18 Thread Timon Gehr
> On 2011-05-17 23:48:35 -0400, Andrej Mitrovic > said: > > > So how do functions which take such a parameter look like? > > What do you mean by what they'll look like? They'll look like how you > wrote them. I'm not sure I understand the question... but I'll still > try to answer. > > > > void ba

Re: Some features should NOT include from GO/Java.

2011-05-18 Thread Matthew Ong
On 5/16/2011 10:37 PM, Matthew Ong wrote: Hi All, The reason I am starting this thread is to gather some valid/experience that people do not like about using Go or even Java. Naturally D-programming might not wants to repeat the same error. Java: 1) Swing API --- The inheritance tree is too dee

Re: keywords "objconst" and "objimmutable" vs. const(Object) ref

2011-05-18 Thread Michel Fortin
On 2011-05-17 23:48:35 -0400, Andrej Mitrovic said: So how do functions which take such a parameter look like? What do you mean by what they'll look like? They'll look like how you wrote them. I'm not sure I understand the question... but I'll still try to answer. void bar(ref Foo a, c

Re: Implementing std.log

2011-05-18 Thread Jose Armando Garcia
This is a review of std.log. Overall, I really like the API exposed by this module because it allows efficient compile time and run time configuration. I have limited the review to the API and how the API affects the implementation. I will review the implementation once the API is close to final.

Re: Builtin regex (Was: How to complex switch?)

2011-05-18 Thread Timon Gehr
> Timon Gehr: > >> Tuple literals would indeed be very nice. > > I have asked for tuple unpacking syntax (and other things like some support > from the type system). Tuple literals are less needed. > >> (having syntactic sugar for phobos functionality in the language >> seems like a very bad desig

Re: Implementing std.log

2011-05-18 Thread Jose Armando Garcia
std.logging is still alive! After posting my first attempt at a logging module I went back and spent a lot of time on how I could improve the API. I would like to say that Andrei's std.log module had a great influence on the final outcome. There are some aspect of std.log's API that I really like.

Re: Curl wrapper

2011-05-18 Thread Johannes Pfau
Jonas Drewsen wrote: >On 18/05/11 10.09, Johannes Pfau wrote: >> jdrewsen wrote: >>> Please see comments below. >>> >>> Den 17-05-2011 16:42, Andrei Alexandrescu skrev: Thanks for the response! A few more answers and comments within (everything deleted counts as "sounds great").

Re: keywords "objconst" and "objimmutable" vs. const(Object) ref

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 02:20:16 -0400, Christopher the Magnificent wrote: On 5/17/11 9:07 PM, Michel Fortin wrote: For another, it's perfectly in line with how you do it for pointers. Also, it'll work for 'shared' and 'inout' too (once 'inout' works properly). Are you saying that objconst and

Re: Accessing Private Fields from Outside

2011-05-18 Thread Jacob Carlborg
On 2011-05-18 12:32, gölgeliyele wrote: On 5/18/11 5:30 AM, Jacob Carlborg wrote: You can have a look at my serialization library, Orange: http://www.dsource.org/projects/orange I don't think it works with the latest compilers but you have have a look at the source: http://www.dsource.org/proj

Re: keywords "objconst" and "objimmutable" vs. const(Object) ref

2011-05-18 Thread Steven Schveighoffer
On Tue, 17 May 2011 21:26:38 -0400, Jesse Phillips wrote: Syntax has definitely been a major problem for this feature. Walter's stance has been that he has tried many times to get the semantics and syntax to work and has given up. michelf (Sorry don't know his real name) has created a b

Re: Resolution of core.time.Duration...

2011-05-18 Thread Alexander
On 18.05.2011 12:12, Jonathan M Davis wrote: > To my knowledge, using the system's monotonic clock is the absolute best that > you're going to get for stuff like benchmarking. It depends. If system is not busy, then it doesn't really matter - which clock to use, especially if you take average

Re: Curl wrapper

2011-05-18 Thread Jonas Drewsen
On 18/05/11 10.09, Johannes Pfau wrote: jdrewsen wrote: Please see comments below. Den 17-05-2011 16:42, Andrei Alexandrescu skrev: Thanks for the response! A few more answers and comments within (everything deleted counts as "sounds great"). On 5/17/11 3:50 AM, Jonas Drewsen wrote: 14. Isn'

Re: Accessing Private Fields from Outside

2011-05-18 Thread gölgeliyele
On 5/18/11 5:30 AM, Jacob Carlborg wrote: You can have a look at my serialization library, Orange: http://www.dsource.org/projects/orange I don't think it works with the latest compilers but you have have a look at the source: http://www.dsource.org/projects/orange/browser/orange/util/Reflectio

Re: keywords "objconst" and "objimmutable" vs. const(Object) ref

2011-05-18 Thread sclytrack
const(deref(Object)) ref obj; deref(Object) a; //hehe.

Re: Resolution of core.time.Duration...

2011-05-18 Thread Jonathan M Davis
On 2011-05-18 02:13, Alexander wrote: > On 18.05.2011 01:18, Jonathan M Davis wrote: > > A monotonic clock is as good as you're going to get for accurate > > stopwatch functionality. The system cannot possibly do any better than > > that. Context switching can always get in the way. Increasing prec

Re: Accessing Private Fields from Outside

2011-05-18 Thread Jacob Carlborg
On 2011-05-18 01:47, Mehrdad wrote: Is there any (hacky) way of accessing a private field from outside a data type? (The equivalent of reflection in managed languages.) I'm trying to write a piece of marshaling code that needs access to a data type's fields, but can't access them because it's no

Re: Resolution of core.time.Duration...

2011-05-18 Thread Alexander
On 18.05.2011 01:18, Jonathan M Davis wrote: > A monotonic clock is as good as you're going to get for accurate stopwatch > functionality. The system cannot possibly do any better than that. Context > switching can always get in the way. Increasing precision doesn't help that. Probably, you

Re: Implementing std.log

2011-05-18 Thread Jacob Carlborg
On 2011-05-17 22:15, Andrei Alexandrescu wrote: On 5/17/11 4:02 AM, Jacob Carlborg wrote: On 2011-05-16 02:05, Andrei Alexandrescu wrote: Thanks for your work. I think there's an important distinction to be made. There are two "API"s being discussed. One is the client interface and the other i

Re: Curl wrapper

2011-05-18 Thread Johannes Pfau
jdrewsen wrote: >Please see comments below. > >Den 17-05-2011 16:42, Andrei Alexandrescu skrev: >> Thanks for the response! A few more answers and comments within >> (everything deleted counts as "sounds great"). >> >> On 5/17/11 3:50 AM, Jonas Drewsen wrote: 14. Isn't the max redirect configu