On 25/07/10 5:21 AM, BCS wrote:
Hello Trass3r,
Is D 2.0 still in alpha?
It's in beta. Somewhat.
The language? More like an RC. DMD? Beta.
And Phobos, I'd say, is still in alpha. Half the simple stuff in there
doesn't work, never mind anything that's complex. e.g. Array!int causes
a co
Peter Alexander Wrote:
> On 25/07/10 5:21 AM, BCS wrote:
> > Hello Trass3r,
> >
> >>> Is D 2.0 still in alpha?
> >>>
> >> It's in beta. Somewhat.
> >>
> >
> > The language? More like an RC. DMD? Beta.
> >
>
> And Phobos, I'd say, is still in alpha. Half the simple stuff in there
> doesn't work,
Walter Bright Wrote:
> Justin Johansson wrote:
> > It sounds like the D PL has invented the range idiom unlike any other PL.
>
> Pointer programming is deeply embedded into the C++ culture, and iterators
> segue
> nicely into that culture. For D, however, programming revolves around arrays,
>
On 25/07/10 12:11 PM, levenshtein wrote:
Walter Bright Wrote:
Justin Johansson wrote:
It sounds like the D PL has invented the range idiom unlike any other PL.
Pointer programming is deeply embedded into the C++ culture, and iterators segue
nicely into that culture. For D, however, programmi
Some people have proposed the introduction in Python of the 'where' statement.
It is quite used in Haskell:
printFreqsBySize genome keySize = do
ht0 <- htNew keySize
ht <- hashGenome genome keySize ht0
l <- htToList ht
htFree ht
return $ map draw (sortBy so
The language? More like an RC.
Well typedef is to be removed, delete has pretty much been deprecated as I
heard.
Now they seem to intend to remove scope too (didn't read the topic
thoroughly though, I'm sick of all those "remove every single keyword
there is in the language" threads)
c = sqrt(a*a + b*b) where:
a = retrieve_a()
b = retrieve_b()
That is equivalent to:
c = (retrieve_a() ** 2 + retrieve_b() ** 2) ** 0.5
You immediately give the counter-argument? ^^
Introducing a new keyword + whole new constructs gotta have substantial
merit. The 2nd concept is perfe
Peter Alexander Wrote:
> On 25/07/10 12:11 PM, levenshtein wrote:
> > Walter Bright Wrote:
> >
> >> Justin Johansson wrote:
> >>> It sounds like the D PL has invented the range idiom unlike any other PL.
> >>
> >> Pointer programming is deeply embedded into the C++ culture, and iterators
> >> seg
Trass3r:
>You immediately give the counter-argument? ^^<
I try to give both pros and cons :-)
I think when expressions get even more complex 'where' can help.
> Another possibility would probably be the following, but it's not as
> compact and nice:
>
> double c;
> {
> double a = ret
bearophile wrote:
But a bigger problem is that I can't see a way to define a conditionally
pure templated function, for example a map() that is pure if the given
function pointer is pure, and is not pure otherwise:
This is fairly simple currently:
template map( alias fn ) { // blah blah b
Trass3r:
> Now they seem to intend to remove scope too (didn't read the topic
> thoroughly though, I'm sick of all those "remove every single keyword
> there is in the language" threads)
The Scope!() replacement for scope is not good enough yet:
1) The compiler doesn't test for escapes (as dmd
On 2010-07-25 08:33:53 -0400, bearophile said:
D lambdas can be multiline, so that's not a problem.
But it can be useful to write more readable expressions when they are complex:
auto c = sqrt(a*a + b*b) where {
auto a = retrieve_a();
auto b = retrieve_b();
}
Is this really an improv
bearophile Wrote:
> auto c = sqrt(a*a + b*b) where {
> auto a = retrieve_a();
> auto b = retrieve_b();
> }
the where statement looks as a declaration statement, but scoped block allows
arbitrary statements.
This doesn't work:
int opIndex(int[][] m, uint i, uint j) { return m[i][j]; }
unittest {
auto m = [[9,8], [2,3]];
auto a = m[0,1];
}
It's so by design or by bug?
Tomek
p.s. Where on D page is uniform call syntax documented? Couldn't find it in
functions section.
Simen kjaeraas:
> This is fairly simple currently:
>
> template map( alias fn ) { // blah blah blah, whatever is necessary here
> static if ( isPure!fn ) {
> pure map( Range )( Range r ) { ... }
> } else {
> auto map( Range )( Range r ) { ... }
> }
> }
Do you mean
Tomek S.:
> This doesn't work:
> int opIndex(int[][] m, uint i, uint j) { return m[i][j]; }
That's cute, but in D overloaded operator can be defined inside
structs/classes/unions only (this is different from C++).
Bye,
bearophile
Michel Fortin:
> Is this really an improvement over using a delegate literal?
>
> auto c = {
> auto a = retrieve_a();
> auto b = retrieve_b();
> return sqrt(a*a + b*b);
> };
Cute :-) I have never seen this used in D code. I think you will need
Is this really an improvement over using a delegate literal?
auto c = {
auto a = retrieve_a();
auto b = retrieve_b();
return sqrt(a*a + b*b);
};
Even more clever.
bearophile wrote:
> Some people have proposed the introduction in Python of the 'where'
> statement. It is quite used in Haskell:
>
> printFreqsBySize genome keySize = do
> ht0 <- htNew keySize
> ht <- hashGenome genome keySize ht0
> l <- htToList ht
> htFree ht
> return $ map draw (sortBy sortRu
bearophile wrote:
Simen kjaeraas:
This is fairly simple currently:
[snip]
Do you mean code like this (this doesn't work yet)?
[snip]
Yeah.
I suggest all people in all D newsgroups, to write code that runs, not
uncompilable snippets. All errors in the last Walter's talk can be
avoided
On 07/25/2010 08:22 AM, bearophile wrote:
Trass3r:
Now they seem to intend to remove scope too (didn't read the topic
thoroughly though, I'm sick of all those "remove every single
keyword there is in the language" threads)
The Scope!() replacement for scope is not good enough yet: 1) The
compi
On Jul 25, 10 21:54, Tomek Sowiński wrote:
bearophile wrote:
Some people have proposed the introduction in Python of the 'where'
statement. It is quite used in Haskell:
printFreqsBySize genome keySize = do
ht0<- htNew keySize
ht<- hashGenome genome keySize ht0
l<- htToList ht
htFree ht
return
On 2010-07-25 09:48:21 -0400, bearophile said:
Michel Fortin:
Is this really an improvement over using a delegate literal?
auto c = {
auto a = retrieve_a();
auto b = retrieve_b();
return sqrt(a*a + b*b);
};
Cute :-) I have neve
Nice slides, "High Wizardry in the Land of Scala Presentation" by Daniel
Spiewak, in pages 4-36 he shows Higher-Kinds and Typeclasses, that can be
interesting for D programmers too:
http://assets.en.oreilly.com/1/event/45/High%20Wizardry%20in%20the%20Land%20of%20Scala%20Presentation.pdf
Bye,
be
On 7/25/2010 12:26 AM, BCS wrote:
Hello dsimcha,
Is there any simple PNG lib that's:
http://www.dsource.org/projects/scrapple/wiki/LodePngLibrary
1. Written in pure D.
I think so.
2. Licensed under the Boost or zlib/libpng license, or some other
license that is open-source, non-copyle
== Quote from Eric Poggel (dnewsgr...@yage3d.net)'s article
> On 7/25/2010 12:26 AM, BCS wrote:
> > Hello dsimcha,
> >
> >> Is there any simple PNG lib that's:
> >>
> >
> > http://www.dsource.org/projects/scrapple/wiki/LodePngLibrary
> >
> >> 1. Written in pure D.
> >>
> >
> > I think so.
> >
> >>
levenshtein wrote:
Peter Alexander Wrote:
On 25/07/10 12:11 PM, levenshtein wrote:
Walter Bright Wrote:
Justin Johansson wrote:
It sounds like the D PL has invented the range idiom unlike any other PL.
Pointer programming is deeply embedded into the C++ culture, and iterators segue
nicely
== Quote from Don (nos...@nospam.com)'s article
> levenshtein wrote:
> > Peter Alexander Wrote:
> >
> >> On 25/07/10 12:11 PM, levenshtein wrote:
> >>> Walter Bright Wrote:
> >>>
> Justin Johansson wrote:
> > It sounds like the D PL has invented the range idiom unlike any other
> > PL
dsimcha wrote:
Basically, my take as a practical programmer rather than a theoretical comp-sci
researcher is "Who cares if it's been done before if it's not implemented in any
practical language?".
There's rarely anything truly new in programming. I agree with you that turning
an idea into som
I'm trying to find justifications for keeping assumeSorted and friends
within Phobos. Background: assumeSorted(r) where r is some range returns
a value that wraps r and clarifies to the caller that it can assume r
has been sorted.
The obvious use case in Phobos is that find(haystack, needle) c
On 07/24/2010 08:36 AM, Justin Johansson wrote:
It sounds like the D PL has invented the range idiom unlike any other PL.
Since the dawn of PL's, which must be about 50 years now since Lisp
for example, it is hard to imagine a new PL inventing a completely
new idiom as "ranges" seem to purport.
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article
> Personally I'm not as much amazed about the time taken, as about the
> fact that many people _today_ don't figure what's good about the STL. My
> theory (which I expanded in my article On Iteration) is that STL
> requires
"Rainer Deyke" wrote in message
news:i2g3oo$vo...@digitalmars.com...
On 7/24/2010 15:34, Jim Balter wrote:
The point about difficulty goes to why this is not a matter of the
halting problem. Even if the halting problem were decidable, that would
not help us in the slightest because we are try
Andrei Alexandrescu wrote:
> I'm trying to find justifications for keeping assumeSorted and friends
> within Phobos. Background: assumeSorted(r) where r is some range returns
> a value that wraps r and clarifies to the caller that it can assume r
> has been sorted.
>
> The obvious use case in Pho
Andrei Alexandrescu wrote:
On 07/24/2010 08:36 AM, Justin Johansson wrote:
It sounds like the D PL has invented the range idiom unlike any other PL.
Since the dawn of PL's, which must be about 50 years now since Lisp
for example, it is hard to imagine a new PL inventing a completely
new idiom a
Andrei Alexandrescu wrote:
> median -> r[r.length / 2]
Generalize to quantile.
http://en.wikipedia.org/wiki/Quantile
Tomek
"bearophile" wrote in message
news:i2g42t$10c...@digitalmars.com...
Rainer Deyke:
(A function that performs I/O is
obviously not a candidate for CTFE.)
I don't fully agree, see this enhancement request of mine:
http://d.puremagic.com/issues/show_bug.cgi?id=3952
Bye,
bearophile
"performs
Andrei Alexandrescu wrote:
> but scope must go
But scope(exit) stays, right?
Hello Tomek,
Andrei Alexandrescu wrote:
but scope must go
But scope(exit) stays, right?
Totally different thing. :)
--
... <
"Walter Bright" wrote in message
news:i2flvi$4i...@digitalmars.com...
Don wrote:
Being marked as 'pure' is no guarantee that the function will terminate.
Right, and the compiler makes no attempt to check this, either.
Of course the compiler makes no attempt to check -- that *would* be the
"Peter Alexander" wrote in message
news:i2eqf1$1i6...@digitalmars.com...
On 24/07/10 2:13 PM, Jim Balter wrote:
"Peter Alexander" wrote in message
news:i27p32$dt...@digitalmars.com...
On 21/07/10 6:33 PM, Andrei Alexandrescu wrote:
Peter Alexander wrote:
== Quote from Walter Bright (news
Jim Balter wrote:
"Rainer Deyke" wrote in message
news:i2g3oo$vo...@digitalmars.com...
On 7/24/2010 15:34, Jim Balter wrote:
The point about difficulty goes to why this is not a matter of the
halting problem. Even if the halting problem were decidable, that would
not help us in the slightest
bearophile wrote:
> Tomek S.:
>
>> This doesn't work:
>> int opIndex(int[][] m, uint i, uint j) { return m[i][j]; }
>
> That's cute, but in D overloaded operator can be defined inside
> structs/classes/unions only (this is different from C++).
Yeah, I know, but why? What bad would happen if ope
BCS wrote:
> Hello Tomek,
>
>> Andrei Alexandrescu wrote:
>>
>>> but scope must go
>>>
>> But scope(exit) stays, right?
>>
>
> Totally different thing. :)
Phew.. He did say "it doesn't deserve a keyword" so I got scared ;)
Le 25/07/2010 22:40, BCS a écrit :
Hello Tomek,
Andrei Alexandrescu wrote:
but scope must go
But scope(exit) stays, right?
Totally different thing. :)
I must admit I had the same reaction as Tomek while reading Andrei's
post :) I am relieved scope (exit|failure|success) is not on the r
Andrei Alexandrescu wrote:
I strongly believe Walter got the STL and generic programming in
general. He might be fuzzy about some minor details, but he is plenty
good at plenty other things and always had a good listening ear for the
importance of genericity.
To be fair, it took me many years
Andrei Alexandrescu wrote:
> I'm trying to find justifications for keeping assumeSorted and friends
> within Phobos. Background: assumeSorted(r) where r is some range returns
> a value that wraps r and clarifies to the caller that it can assume r
> has been sorted.
>
> The obvious use case in Pho
I can't compile the stats example, it uses readf() (on page 22), but the
compiler complains that it's undefined. I found readf() in the library under
std.stream, but importing that won't work. I'm using DMD 2.047.
Andrei Alexandrescu Wrote:
> Andrej Mitrovic wrote:
> > Or, it has some database
Andrei Alexandrescu:
> In my humble opinion, the design of Java, C#, and Go is proof
> that their authors didn't get the STL. Otherwise, those languages would
> be very different.
I don't believe you. Among the designers of Java, C# and Go there are people
that are both experts and smart. C# de
Jim Balter wrote:
"Walter Bright" wrote in message
news:i2flvi$4i...@digitalmars.com...
Don wrote:
Being marked as 'pure' is no guarantee that the function will terminate.
Right, and the compiler makes no attempt to check this, either.
Of course the compiler makes no attempt to check -- th
We had a thread where a suggestion was made for a library defined typedef:
enum Type
{
Independent,
Super,
Sub,
Parallel,
}
struct Typedef( T, Type type = Type.Sub, T init = T.init, string _f =
__FILE__, int _l = __LINE__ )
{
T payload = init;
static if ( type != Type
Probably it's no bad idea to repeat these explanations from Andrei so they
don't get lost in the huge original thread:
1. Something that's just like another type yet "parallel" with it. This is
good for abstractions that encode different units of measurement that
aren't supposed to be mixe
bearophile wrote:
Andrei Alexandrescu:
In my humble opinion, the design of Java, C#, and Go is proof
that their authors didn't get the STL. Otherwise, those languages would
be very different.
I don't believe you. Among the designers of Java, C# and Go there are people
that are both experts a
If foo is private but its public alias poo exists, should you be able to use
poo? (currently you can't)
Tomek
> Andrei Alexandrescu wrote:
>
> > I'm trying to find justifications for keeping assumeSorted and friends
> > within Phobos. Background: assumeSorted(r) where r is some range returns
> > a value that wraps r and clarifies to the caller that it can assume r
> > has been sorted.
>
> > advantageous
I have been using std.concurrency for a while, and have been very
impressed by it. In particular, it was easy to get a complex
multi-threaded application going with std.concurrency. The
thread-local-storage behaviour of D is really cool too.
However, I have had some problems with std.concurren
cool, thanks for the updates
Made substantial further changes.
Which platform are you working on? If it is non-Windows please report
whether it works.
If you write sample code using cl4d resp. the underlying bindings please
also submit to me (via bitbucket).
bearophile wrote:
Andrei Alexandrescu:
In my humble opinion, the design of Java, C#, and Go is proof that their
authors didn't get the STL. Otherwise, those languages would be very
different.
I don't believe you. Among the designers of Java, C# and Go there are people
that are both experts and
On 07/25/2010 04:54 PM, bearophile wrote:
Andrei Alexandrescu:
In my humble opinion, the design of Java, C#, and Go is proof that
their authors didn't get the STL. Otherwise, those languages would
be very different.
I don't believe you. Among the designers of Java, C# and Go there are
people t
Graham St Jack Wrote:
> However, I have had some problems with std.concurrency (most of which
> I'm sure are already being addressed by Sean). In particular, I wanted a
> way to select on multiple file-descriptors so that I could (say) send
> commands to a thread that also reads from a blocking
bearophile Wrote:
> Andrei Alexandrescu:
> > In my humble opinion, the design of Java, C#, and Go is proof
> > that their authors didn't get the STL. Otherwise, those languages would
> > be very different.
>
> I don't believe you. Among the designers of Java, C# and Go there are people
> that
Sean Kelly Wrote:
> So you can do ridiculous things like:
>
> class A {
> void put(List x) {}
> }
>
> class B {
> void pass(List x) {
> (new A).put(x);
> }
> }
Change that to:
class A {
void put(List x) {}
}
class B {
void pass(List x) {
(new A).put(x);
"Tomek Sowinski" wrote in message
news:i2idhp$2jo...@digitalmars.com...
> If foo is private but its public alias poo exists, should you be able to
> use
> poo? (currently you can't)
>
>
I would think you should be able to (but I'm no authority on the issue).
On 26/07/10 13:48, Sean Kelly wrote:
Graham St Jack Wrote:
However, I have had some problems with std.concurrency (most of which
I'm sure are already being addressed by Sean). In particular, I wanted a
way to select on multiple file-descriptors so that I could (say) send
commands to a threa
64 matches
Mail list logo