Generalizing the original question to *all* member functions, it can be
desirable to to have non-polymorphic inheritance, at least not *runtime*
polymorphic. I get the impression that it wouldn't be used much by most
people who post on these newsgroups, but there are application areas it
can
On Sunday 13 February 2011 17:40:39 bearophile wrote:
> Jonathan M Davis:
> > And honestly, in most cases, I think that what you're trying to do is
> > just plain begging for bugs. It is kind of cool that C# found a
> > relatively clean way to deal with it, but I honestly don't know what
> > it's u
Jonathan M Davis:
> And honestly, in most cases, I think that what you're trying to do is just
> plain
> begging for bugs. It is kind of cool that C# found a relatively clean way to
> deal with it, but I honestly don't know what it's useful for. I'd be worried
> about a program which overrode
On Sunday 13 February 2011 13:34:04 Sean Eskapp wrote:
> Is there a way to specify that a function is nonvirtual, but can still be
> "overriden" in base classes? e.g.
>
> class A
> {
> void foo()
> {
> writeln("A");
> }
> }
>
> class B : A
> {
> void foo()
> {
>
I realize a parametrized constructor would be a better option:
this(T2)(const(Vector!(d,T2)) rhs) if (isNumeric!T2) { ... }
// e.g., auto i4 = int4(f4);
but I'd still prefer the casting syntax if possible.
Hi,
I'm implementing a generic Vector!(uint d, T) struct (wrapping a T[d] array).
For readability:
alias Vector!(4u,float) float4;
alias Vector!(4u,int) int4;
I'd like to be able to cast a float4 variable explicitly to an int4
(component-wise casting):
auto f4 = float4(1,2,3,4);
auto i4 = cast(
Hey guys,
I've the following source:
module filereader;
import std.file;
import std.stdio : writeln;
void main(string[] args) {
File f = new File("myFile.ext", FileMode.In);
while(!f.eof()) {
writeln(convertToUTF8(f.readLine()));
}
f.close();
}
s
Is there a way to specify that a function is nonvirtual, but can still be
"overriden" in base classes? e.g.
class A
{
void foo()
{
writeln("A");
}
}
class B : A
{
void foo()
{
writeln("B");
}
}
void main()
{
(new A).foo();
(new B).foo();
}
Should
== 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 use case.
> Bye,
> bearophile
The age
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 use case.
Bye,
bearophile
Hello,
I need to write one or more tool functions that produce standard notation for
strings. Something like python's repr(s). For instance:
`abc
def "ghi" jkl`
-->
"abc\ndef\t\"ghi\" jkl"
which, fed back into D code, reproduces the original string. I have actually
several formats in mind,
Sean Eskapp wrote:
> I remember in C++, I had to do double-dispatch using the visitor pattern.
> This is cumbersome, just because each subclass has to have the exact same
> singly-dispatched code that looks like:
>
> void dispatch(Base& other)
> {
>other.dispatch(*this);
> }
>
> Is there a n
Sean Eskapp wrote:
I remember in C++, I had to do double-dispatch using the visitor
pattern. This
is cumbersome, just because each subclass has to have the exact same
singly-dispatched code that looks like:
void dispatch(Base& other)
{
other.dispatch(*this);
}
Is there a nicer way to do
I remember in C++, I had to do double-dispatch using the visitor pattern. This
is cumbersome, just because each subclass has to have the exact same
singly-dispatched code that looks like:
void dispatch(Base& other)
{
other.dispatch(*this);
}
Is there a nicer way to do this in D, or am I stuck
tsukikage:
> For curiosity, would you explain/guess a possible reason for that?
I leave the answer to Don, I don't know the internals of D BigInts.
Multi-precision integers are basic bricks used to build many other programs.
How can you be sure they don't contain bugs that break your heavy nume
Am 12.02.2011 00:02, schrieb spir:
On 02/11/2011 10:33 PM, Mafi wrote:
I allways try to import 'algorythm' because of the german word
'Algorythmus'.
When this happend for the first time, I spent about five minutes to
find out
what's wrong.
It is spelled Algorithmus in German, no ypsilon ;-)
h
Greetings
I am getting this error when I am instantiating a struct array with a
single element inside another class and only if there is the
destructor for the struct is explicitly defined. Is it a known error?
Here is a minimized snippet that gives error:
$ rdmd --main -unittest test.d
Error: t
Dominic Jones wrote:
> Hello,
>
> I have a list of strings and I want to determine whether or not a
> particular string in the is in that list. Assuming I should store the list
> of strings in a binary tree to facilitate fast searching, I had a look at
> the std.container documentation and found
For curiosity, would you explain/guess a possible reason for that?
Thanks!
bearophile wrote:
tsukikage:
Is it my program bug or bigint broken?
http://d.puremagic.com/issues/show_bug.cgi?id=5568
Bye,
bearophile
> However, it's not generally an issue, because you shouldn't normally be
> keeping
> references around for stuff that isn't used anymore. The garbage collector is
> smart enough to deal with circular references and the like, so the biggest
> cases
> where you'd normally need weak references aren
On 02/13/2011 01:18 AM, Ali Çehreli wrote:
On 02/11/2011 04:55 PM, spir wrote:
Also, trees are not always O(logN): tries () are O(1) for access,
relative to number of elements, in fact their search is not related to
that factor, just like hash table instead to the length of keys
(O(log(leng
21 matches
Mail list logo