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
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
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
=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
forgot, and got the same error.
Torarin
-static Result structs. Would it be a
good idea to make them static, where possible?
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
with this!
Torarin
prefer minimalistic logos, like Haskell's, but
this one is so fun. It's balanced and it works.
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
, 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
! 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
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
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
Congratulations, Jonas!
Torarin
regards, 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
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
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
arguments.
For instance, it has HttpClient!AsyncSocket and HttpClient!Socket.
Torarin
warm grey
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
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
.
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
))
This will of course only work for methods, not properties or aliases,
so you still need constraints in some cases.
Torarin
, but that doesn't
sound like a common case.
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
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
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
want to
mark a bunch of functions const inside {}?
Torarin
all of them
to go there, like Jonathan suggested.
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
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
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
Divide? As in dividing a pie chart.
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
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
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?
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
in the traditional sense. The
interface is just the concept.
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
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
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
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.
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)
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:
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.
I feel as and to are too similar, they could both be interpreted
as simple casting for example.
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
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
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
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
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
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
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
, 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
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! :)
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
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
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
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
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?
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
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
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
65 matches
Mail list logo