May 22, 2005 Re: Value-based function overloading - Going Fourth | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hasan Aljudy | In article <d6obsn$mlc$1@digitaldaemon.com>, Hasan Aljudy says... > >Nod wrote: >> Replies are scarce. How shall I interpret this silence? That the technique is perfect, and requires no further improvement? That the technique is useless, and not worth discussing? That no one really understands what the hell I'm on about? >> > >I was enthusiastic about the idea, but I got lost in the second take. Too complicated for me to follow. (I'm just lazy). Argh. Maybe I was getting too wound up in the nitty-gritty details. Point taken. -Nod- |
May 22, 2005 Re: Value-based function overloading - Going Fourth | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nod | "Nod" <Nod_member@pathlink.com> wrote in message news:d6oten$1255$1@digitaldaemon.com... > In article <d6nncg$8ps$1@digitaldaemon.com>, TechnoZeus says... > > You have understood things very well. And your example is a nice one too. The idea is much about making things more clear and maintainable. Wouldn't you agree that the following is easier to read and understand? > > void main() > { > int v; > /* assign a value to v ... */ > printf("%d",a(v)); > } > > int a(int v in int.min..-5) { /*...*/ } > int a(int v in -5..5) { /*...*/ } > int a(int v in 5..int.max) { /*...*/ } > *snip* > > > -Nod- > > About the same to me at this time, but I could deal with it, and if it's easier or more clear to someone else, then I'm all for it. In fact, with a small amount of actual usage, I could probably learn to prefer it... although I have a feeling it would be difficult to implement. The only things left to determine, in my opinion, are... a set of exact details for a proposed standard, and whether or not the amount of good it would do is worth the time and effort needed to implement the proposed standard. TZ |
May 22, 2005 Re: Value-based function overloading - Going Fourth | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nod | >>It also makes sure that the compiler
>>can supply the appropriate symbols for the linker as this already works with
>>explicit template calls.
>
>I don't fully understand this. Could you elaborate, or give an example?
>
Sure. The D spec already has a way of name-mangling templates, so that all the possible instances of templates are mapped to unique symbols. Piggybacking or extending templates as we understand them, via these predicate expessions, would be easier to implement than another form of function overloading altogether, IMO.
- EricAnderton at yahoo
|
May 23, 2005 Re: Value-based function overloading - Going Fourth | ||||
---|---|---|---|---|
| ||||
Posted in reply to pragma | In article <d6q5mg$21vb$1@digitaldaemon.com>, pragma says... > >>>It also makes sure that the compiler >>>can supply the appropriate symbols for the linker as this already works with >>>explicit template calls. >> >>I don't fully understand this. Could you elaborate, or give an example? >> > >Sure. The D spec already has a way of name-mangling templates, so that all the possible instances of templates are mapped to unique symbols. Piggybacking or extending templates as we understand them, via these predicate expessions, would be easier to implement than another form of function overloading altogether, IMO. > >- EricAnderton at yahoo Ah, yes indeed, from that perspective you are correct. Though I won't give up the more complex version just yet. It may be harder to implement, but it also has its share of additional benefits. Less typing and more integration with the language as a whole to name a few. -Nod- |
Copyright © 1999-2021 by the D Language Foundation