Hi,
I just have started diving in D. Exploring the contract feature I
stumbled upon the fact that a class invariant does not apply to properties:
import std.stdio;
void main(string[] args) {
Time t = new Time();
t.hours = 24; // works; why?
writeln(t.hours is , t.hours);
On 16.02.2011 11:03, Michael Engelhardt wrote:
Hi,
I just have started diving in D. Exploring the contract feature I
stumbled upon the fact that a class invariant does not apply to properties:
Welcome on board :)
Invariant gets called on every public method call (at begin end if I'm
not
Yes, they just happen to look identical: but that's the crux: How it
looks is the *only* thing that parser/grammar are concerned with.
If it worked like this:
Array Decl ::= Type '[' Ident ']' Ident ';'
Assoc Array Decl ::= Type '[' Ident ']' Ident ';'
...*Then* it would no longer be
On 02/16/2011 07:22 AM, Denis Koroskin wrote:
On Tue, 15 Feb 2011 06:35:21 +0300, Andrej Mitrovic n...@none.none wrote:
import std.stdio, std.algorithm, std.range;
void main()
{
writeln( find([5, 1, 2, 3, 4, 5, 1], 5) );
writeln( find(retro([5, 1, 2, 3, 4, 5, 1]), 5) );
}
Output:
[5, 1, 2,
Hello,
Is there a library function for min/max for integers. I would rather not use
the ?-operator, it's rather clumsy. I looked in the standard lib and only
found f(min|max).
Thank you,
Dominic Jones
Am 16.02.2011 10:54, schrieb Dominic Jones:
Hello,
Is there a library function for min/max for integers. I would rather not use
the ?-operator, it's rather clumsy. I looked in the standard lib and only
found f(min|max).
Thank you,
Dominic Jones
They're in 'std.algorithm'. They work for all
On 2/15/11 10:09 PM, Lars T. Kyllingstad wrote:
https://github.com/schacon/libgit
That'd rather be http://libgit2.github.com/, though I have no idea how
usable it is already.
David
Hello,
Which characters are to be escaped:
* inside [] classes
* outside such classes
?
Also, is there for D regexes a free form format (where whitespace can be used
to present formats more legibly, but must be escaped as literals)?
Denis
--
_
vita es estrany
spir.wikidot.com
On 2011-02-16 5:48, spir wrote:
Hello,
Which characters are to be escaped:
* inside [] classes
* outside such classes
?
Also, is there for D regexes a free form format (where whitespace can
be used to present formats more legibly, but must be escaped as literals)?
Denis
This is a comment
On 2011-02-16 11:26, David Nadlinger wrote:
On 2/15/11 10:09 PM, Lars T. Kyllingstad wrote:
https://github.com/schacon/libgit
That'd rather be http://libgit2.github.com/, though I have no idea how
usable it is already.
David
I've seen that, but hoped for something easier to use. Was hoping
On 2011-02-15 21:32, Jacob Carlborg wrote:
Maybe a little off topic but does anyone know about a git library, I'll
only need to do checkouts?
If it makes any difference I actually meant clone a git repository.
--
/Jacob Carlborg
On 2/16/11, spir denis.s...@gmail.com wrote:
for any reason, I would prefere
findBack(haystack, needle);
:-)
Or maybe find should have an extra parameter that decides if the
search begins from the beginning or the end of the range.
On Wed, 16 Feb 2011 11:14:27 -0500, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
On 2/16/11, spir denis.s...@gmail.com wrote:
for any reason, I would prefere
findBack(haystack, needle);
:-)
Or maybe find should have an extra parameter that decides if the
search begins from the
Poor implementation, but wouldn't this work?:
import std.stdio;
import std.range;
import std.array;
auto findBack(alias pred = a == b, R, E)(R haystack, E needle)
if (isBidirectionalRange!R)
{
R result;
size_t index;
auto reversed = retro(haystack);
foreach (item; reversed)
spir Wrote:
Hello,
Which characters are to be escaped:
* inside [] classes
* outside such classes
?
Also, is there for D regexes a free form format (where whitespace can be
used
to present formats more legibly, but must be escaped as literals)?
Though you are probably asking
My code is a little bit broken though because if nothing is found the
entire range is returned.
Quick fix:
import std.stdio;
import std.range;
import std.array;
auto findBack(alias pred = a == b, R, E)(R haystack, E needle)
if (isBidirectionalRange!R)
{
R result;
size_t index;
auto reversed = retro(haystack);
bool found;
foreach (item; reversed)
{
Dmitry Olshansky Wrote:
Now to properties, this is actually shouldn't be allowed:
@property int hours;
@property is a annotation applied to functions (getter/setter), to allow
calling it with omitted () and a natural assign syntax like this:
Why shouldn't it be allowed? While it
On 16.02.2011 20:47, Jesse Phillips wrote:
Dmitry Olshansky Wrote:
Now to properties, this is actually shouldn't be allowed:
@property int hours;
@property is a annotation applied to functions (getter/setter), to allow
calling it with omitted () and a natural assign syntax like this:
On Wed, 16 Feb 2011 12:37:04 -0500, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
Quick fix:
import std.stdio;
import std.range;
import std.array;
auto findBack(alias pred = a == b, R, E)(R haystack, E needle)
if (isBidirectionalRange!R)
{
R result;
size_t index;
auto
On 15/02/2011 18:22, Simon wrote:
On 14/02/2011 22:47, Nick Sabalausky wrote:
Anyone know what DMD/OPTLINK's default stack size on windows is? Or
how to
find out?
Dunno.
Actually if you have visual studio installed you can use the dumpbin
utility. the /headers switch prints out the initial
On 02/16/2011 05:14 PM, Andrej Mitrovic wrote:
On 2/16/11, spirdenis.s...@gmail.com wrote:
for any reason, I would prefere
findBack(haystack, needle);
:-)
Or maybe find should have an extra parameter that decides if the
search begins from the beginning or the end of the range.
Yes,
On 02/16/2011 05:24 PM, Steven Schveighoffer wrote:
On Wed, 16 Feb 2011 11:14:27 -0500, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
On 2/16/11, spir denis.s...@gmail.com wrote:
for any reason, I would prefere
findBack(haystack, needle);
:-)
Or maybe find should have an extra
On 02/16/2011 06:22 PM, Andrej Mitrovic wrote:
Poor implementation, but wouldn't this work?:
import std.stdio;
import std.range;
import std.array;
auto findBack(alias pred = a == b, R, E)(R haystack, E needle)
if (isBidirectionalRange!R)
{
R result;
size_t index;
auto
On Wednesday, February 16, 2011 09:47:32 Jesse Phillips wrote:
Dmitry Olshansky Wrote:
Now to properties, this is actually shouldn't be allowed:
@property int hours;
@property is a annotation applied to functions (getter/setter), to allow
calling it with omitted () and a natural
On Wed, 16 Feb 2011 13:43:57 -0500, spir denis.s...@gmail.com wrote:
On 02/16/2011 05:24 PM, Steven Schveighoffer wrote:
On Wed, 16 Feb 2011 11:14:27 -0500, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
On 2/16/11, spir denis.s...@gmail.com wrote:
for any reason, I would prefere
On Wed, 16 Feb 2011 12:47:32 -0500, Jesse Phillips
jessekphillip...@gmail.com wrote:
Dmitry Olshansky Wrote:
Now to properties, this is actually shouldn't be allowed:
@property int hours;
@property is a annotation applied to functions (getter/setter), to
allow calling it with omitted
The only thing I could come up with is exhausting the entire range to
get the length of a bidirectional range. But that's inefficient.
Anyway here's the dull thing:
import std.stdio;
import std.range;
import std.array;
R findBack(alias pred = a == b, R, E)(R haystack, E needle)
if
On Wed, 16 Feb 2011 14:24:36 -0500, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
The only thing I could come up with is exhausting the entire range to
get the length of a bidirectional range. But that's inefficient.
Anyway here's the dull thing:
import std.stdio;
import std.range;
I've seen discussions on buffered ranges, std.parallelism, replacement
of std.xml, std.process and std.stream and probably several other things
I've already forgotten.
DMD seems to have a quite updated roadmap in the wiki:
http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel#Roadmap
Does
On Wed, 16 Feb 2011 20:24:36 +0100, Andrej Mitrovic wrote:
The only thing I could come up with is exhausting the entire range to
get the length of a bidirectional range. But that's inefficient. Anyway
here's the dull thing:
import std.stdio;
import std.range;
import std.array;
R
On 2/16/11, jam gr0v3e...@gmail.com wrote:
void main()
{
auto a = [5,1,2,3,4,5,1];
auto index = countUntil(retro(a),5);
writeln(a[a.length-1-index .. a.length]);
}
That works for random-access ranges.
But I was under the impression that bidirectional ranges don't
necessarily
On Wednesday, February 16, 2011 13:00:13 Andrej Mitrovic wrote:
On 2/16/11, jam gr0v3e...@gmail.com wrote:
void main()
{
auto a = [5,1,2,3,4,5,1];
auto index = countUntil(retro(a),5);
writeln(a[a.length-1-index .. a.length]);
}
That works for random-access ranges.
On Wednesday, February 16, 2011 12:13:59 simendsjo wrote:
I've seen discussions on buffered ranges, std.parallelism, replacement
of std.xml, std.process and std.stream and probably several other things
I've already forgotten.
DMD seems to have a quite updated roadmap in the wiki:
On Wednesday, February 16, 2011 13:36:54 Jonathan M Davis wrote:
On Wednesday, February 16, 2011 13:00:13 Andrej Mitrovic wrote:
On 2/16/11, jam gr0v3e...@gmail.com wrote:
void main()
{
auto a = [5,1,2,3,4,5,1];
auto index = countUntil(retro(a),5);
On 02/16/2011 09:42 PM, jam wrote:
On Wed, 16 Feb 2011 20:24:36 +0100, Andrej Mitrovic wrote:
The only thing I could come up with is exhausting the entire range to
get the length of a bidirectional range. But that's inefficient. Anyway
here's the dull thing:
import std.stdio;
import
On Wed, 16 Feb 2011 22:00:13 +0100, Andrej Mitrovic wrote:
On 2/16/11, jam gr0v3e...@gmail.com wrote:
void main()
{
auto a = [5,1,2,3,4,5,1];
auto index = countUntil(retro(a),5);
writeln(a[a.length-1-index .. a.length]);
}
That works for random-access ranges.
But I was
On 2/16/11, jam gr0v3e...@gmail.com wrote:
import std.stdio,std.algorithm,std.range,std.container;
void main()
{
auto a = [5,1,2,3,4,5,1];
auto index = countUntil(retro(a),5);
auto R = retro(take(retro(a),index+1));
writeln(R);
R[0] = 6;
writeln(a);
}
but this
On Thu, 17 Feb 2011 00:05:15 +0100, Andrej Mitrovic wrote:
On 2/16/11, jam gr0v3e...@gmail.com wrote:
import std.stdio,std.algorithm,std.range,std.container;
void main()
{
auto a = [5,1,2,3,4,5,1];
auto index = countUntil(retro(a),5);
auto R = retro(take(retro(a),index+1));
On Wednesday, February 16, 2011 15:19:01 jam wrote:
On Thu, 17 Feb 2011 00:05:15 +0100, Andrej Mitrovic wrote:
On 2/16/11, jam gr0v3e...@gmail.com wrote:
import std.stdio,std.algorithm,std.range,std.container;
void main()
{
auto a = [5,1,2,3,4,5,1];
auto index =
On 13/02/11 9:32 PM, Sean Eskapp wrote:
== Quote from bearophile (bearophileh...@lycos.com)'s article
Sean Eskapp:
Is there a nicer way to do this in D, or am I stuck with the same thing?
Andrei has recently said no one needs double dispatch (in D) :-) So Andrei will
be interested in your
41 matches
Mail list logo