« first day (146 days earlier)      last day (4803 days later) » 
08:00 - 16:0016:00 - 00:00

4:00 PM
inherit from a template..... then the compiler would inherit from all templates of types that the template has been used on....
Giving you a object that can be any type at any given time during compilation.
 
@Xaade: Generating the types occurs before generating ast/asm
but first, you would have to find out for which U this was used
then, if you had a std::vector<T>, where T has a base but the conversion to U is never used, the compiler never inherits and you don't pay any cost
 
For all U which are a base of T? Wouldn't that imply multi-inheritance?
 
not really
because interface<U> is a different type for every U
 
Oh... all Uwhich are a base of T, you really mean.... for all T: public U pairs
 
although I guess you do run into problems if you have complex inheritance hierarchies
you would have to respect virtual inheritance
 
4:04 PM
So you'd have a template, which for any given type, derives from a "base" template of it's own base type.

How would this allow you to change types before compile?
 
well
because when you're finished doing
template<typename T> class vector ... { ... }; you don't have the full type
it only instantiates the inheritance for each U for which that instantiation is actually requested
after all, if you have a type T which has an inheritance hierarchy, you may not need this feature just because T has inheritance
 
I got that... it creates new types for each "type" used by creating a variable of said template giving it a type.
 
@DeadMG, See aldor.org for a quite different approach on typing.
 
Kinda like a macro doesn't actually mean anything unless you use it, and it creates the code from what you give the macro.
 
I'm not really sure what you are trying to do. Thinking about potential extension of C++ or something less constrained?
 
4:08 PM
something less constrained
 
AH I got it
 
@Xaade: Not really
because macros don't change other macros
you can't have a macro that means X, unless I used macro Y down there, in which case it means Z
 
Looking at Aldor and Haskell is probably then a must if you want to know what has been done.
(and there are surely things I don't know which would be interesting)
 
You're trying to avoid building multiple classes with inheritance structures because then you incur the loss for each inheritance. So instead you have a template derive from another template giving each a base class.... which means the inheritance isn't compiled until you actually use a class of that type.
 
There is also the whole Aspect programming set of things which could be related.
 
4:11 PM
Why not instead give a template two "classes", then use inheritance by delegation.
 
@Xaade: What do you mean?
 
Well, you'd have to make the members public in the "base" class, then have the template cross the methods from one class to call the base class..... by delegation.
 
show me some code
even crappy pseudocode
 
Go interfaces and the old G++ signature extension could also be of value to you. (Instead of trying to have declared subtyping relationship, use an infered one -- very similar to the way C++ handle template argument validity and what the concept proposals where out to do, execepted as a dynamic behaviour)
 
Let me lookup template real quick, been a while since I made one.
 
4:15 PM
@AProgrammer: I'm doing both
or rather, ahem, considering both
technically, I'm not actually doing anything
right now, in C++, you can implement using proxy objects, for compile-time polymorphism
but it's hard to define how you could implement at run-time polymorphism
std::vector<std::vector<Object>* const> objects;
// Insert a pointer to a std::vector<Derived> and a std::vector<Derived1>?
ahem
damn, I always put that const in the wrong place
 
@DeadMG, look out for type erasure, that may help you.
 
Well, for right now the only way I could see my idea working is if you used methods that described whether the derived class handled the method call or not.
 
oh I know I can use type erasure
the problem is how to know which vector<T> needs it and to erase what types
hell, this is a type erasure system
 
Ok, I got it.
You'll have to use function pointers with the template. A method in the template that returns a method. If the template call doesn't return a method in the derived type because the method doesn't exist, it will check the base type. If neither has that method, then it returns NULL.

It would work similar to COM.
 
that occurs at run-time
this is a static system
 
4:28 PM
what occurs at runtime?
 
function pointers and blablabla
my concept is, the whole thing is determined at compile-time about what runtime polymorphism is involved
 
Well, it would eliminate the cost of inheritance. I'm sorry, I thought that's what you wanted.
 
no, no
the point is how to determine when to invoke inheritance
as in, the inheritance cost should not be paid for any type where the feature is not used
but regular inheritance is a perfectly valid cost and indeed the correct implementation method, if you can determine that it's necessary
 
You mean that you want the compiler to determine whether TYPE A needs to inherit from TYPE B?
 
yep
and a whole lot more too, but we'll stick to this specific example
 
4:32 PM
The only way I can think of that working is by using macros.... but then that's horrible to check compiling.
 
well
I had considered that it would be implemented by, like, implementing a new language
but that's far beyond the scope of what I can do in my spare time :P
 
Like, CREATENEWDERIVED (DerivedClass, BaseClass)
 
you still can't do that
 
I did that kind of thing for implementing interface implementing....
 
because once DerivedClass is defined, you can't make it inherit from BaseClass later
 
4:35 PM
yeah you can.... you make the definition of Derived class be the macro itself.... Like I said, horrible to compile but at least you can change it on the fly.
 
sure
 
MFC type checking does this kinda.
 
but if I define DerivedClass in the macro, how am I going to use it before the macro is invoked?
 
How do you use a type created by a template before the line of code that instantiates the object?
 
you can't
 
4:36 PM
So, what's the difference.
 
at least, not in C++
the difference is that I want to support that
 
You want to use an object before it's instantiated?
 
no, I want to instantiate it, then modify it's type later
 
How could the compiler ever know what methods to call, much less what methods are implemented..... forgiving linking the thing worrying about undefined externals?
Oh ok....
 
multiple pass compilation
 
4:38 PM
hmm....
Well let's see...
 
pass 1: oh look, std::vector<T> was converted to std::const_vector_interface<U>& here, let's make it inherit
 
As long as the types share member DATA.... it should be fine.
Hell, you can do this in regular C++ by casting to another class altogether bypassing type checking, and any methods you call will work, as long as the data structure is the same.
You just can't expect the compiler to do any type checking for you anymore.
 
which is completely unacceptable
the objective of the exercise is to drastically increase the power available to the compiler, not decrease it
 
That would be another problem you'd run into.... how would type checking work, since you can change it's type at any given time.... the compiler can't know when you'll call what method.... so it can't know the object's type for sure at any given point.
 
the compiler does a pass and finds all the type modifiers and runs them before checking whether or not the method calls are valid
 
4:41 PM
Like a recursion algorithm that may change an object's type before returning or not.... how would the compiler know what type the object is.
 
all the type modification takes place at compile-time, not run-time
 
I really don't think you can do this safely, even in a new language.
I understand that....
Ok.... here try this.
main
{
Car Object;
method(object);

Object.fly();
}

method(object)
{
if (system time % 2 == 0)
{
convert Object to Plane;
}
}

How does the compiler know there's an error?
 
uh
because you tried to convert at run-time?
 
...
How would you convert at compile time?
 
the compiler does the first pass, and then if the system time (at compiletime...? your example, not mine) is 0 modulo 2, then it replaces the Car type with the Plane type
I mean, that's not really something that I had in mind
each type dictates how it can or cannot be modified
and methods cannot be removed, only added
 
4:48 PM
So the only conditionals that could surround your "converts" must be those that can be determined at compile time?
 
yes
typically, a conversion would occur per template instantiation
 
And the class converted to must implement all methods and data that the first class had.
 
you can't convert types, I never said that you can convert them
they are template-based additions
class Vector {
    template<typename T> std::vector<T> vec;
};
int main() {
    Vector somevec;
    somevec.vec<float>.push_back(1.0f);
    somevec.vec<int>.push_back(1);
}
 
Well, why didn't you say that before.....
 
argh, I hate pseudocoding in this chat, the markdown problems suck
I did
 
4:51 PM
Sorry, didn't understand you
 
or rather, I never demonstrated any ability other than inheriting from additional bases
and certainly not total replacement
 
That seems eerily similar to Visual Basic's variant types
 
never used
 
it is what you want to be whenever you want it to be that.... except instead of implementing EVERYTHING like variant does.... you'd want the compiler to implement only what you ask it to.
 
it was my understanding that the VARIANT types were run-time polymorphic
yeah
 
4:53 PM
Ok, the way a variant works. It implements ALL possible types
Then whatever you put into it, it "makes" it that type as long as it stores that value.
 
like boost::any
 
This works by basically implementing a flag in the Variant that stores its type.
SOOOOOO......
What you could do, is make it somehow like a variant, except as you "change its type" the compiler would add that type to its list.... or as you said earlier, reimplement as the new type as long as that type encompassing the previous type.
Anything I can think of so far..... results in run-time checking.
 
yeah
the thing is that right now, you can't reflect upon your own program
like
you can't do, for every std::vector<int>, add 1 to this counter
unless you happen to own std::vector<int>
 
So, a multipass compile would check your "magic template" and compile it as the most encompassing type that it found your code using.
 
no, not really
the modification is not defined as how encompassing it is or something like that
it's defined in the modified class
 
4:58 PM
How's its defined doesn't matter
 
template<typename T> class vector : public template<typename U> interface<U> {}
 
The point is that the compiler would compile it as the type that encompassed everything you used it for...
 
I think we have a different definition of encompassing
but I think the answer is yes
 
It would compile it as the type that contained everything needed to execute the code the variable used.
 
if that type is legal
like, in my example with the member vector, not all types can be passed to a vector
 
5:01 PM
In that code above, T would have to implement everything U had in it's interface.
 
no
vector<T> would implement everything interface<U> had to offer, for all uses of it's inheritance of U
 
5:21 PM
Darn... I am interested in the discussion, but I don't have time to even read/understand what has been said today!
 
sbi
@DavidRodríguezdribeas I know the pain...
 
BTW, if the potential base object does not have data (nor virtual methods), there is no cost associated to always inheriting from it. Now the question is whether the whole thing that I have not read can be implemented without dynamic polymorphism
 
you really need to read the whole thing
 
5:58 PM
omg, how much conversation do you want! That just keeps on going :P
2
 
@thecoshman Sounds like something you would say to your girlfriend...
 
@FredO: lols
 
6:16 PM
@DeadMG Are you "Mark" on Channel9? I recognized your puppy :)
 
lol
why yes
and my puppy goes there?
wow, it does
 
7:20 PM
I like doing that with the star.....
mwa ha ha ha hah
@DeadMG Are you sure????
 
@Xaade: Am I sure about what?
 
Look at the starred column
hahahahhahah
I'm going to lose star privileges
 
lol
you are
 
Yeah.... I blanketed the thing.... but it's crackin me up
 
 
1 hour later…
sbi
8:30 PM
In the odd chance that one of you knows:
in C#, 9 mins ago, by sbi
A poll because the question just arose: Is it an inconsiderable possibility to find a .NET developer in the SF bay area who is able to communicate with customers as well as with developers, write a readable spec that makes sense according to those customers' needs, and hack C# code... all with spending <100k/year?
 
@sbi: I guess it's not inconsiderable possibility, but actually finding such is another matter?
 
sbi
@DeadMG Well, I've just been asked about my opinion to some code one candidate turned in. My opinion is "can't you find a better one" and the answer was "not in the bay area for that money". (Really, if you can't find a decent developer there for less than 100k, maybe I should move?)
 
9:00 PM
@sbi: I wouldn't really know
how much disruption are you gonna cause the wife & kids?
 
9:11 PM
@FredOverflow wait... do you know me in real life or something?
 
sbi
@DeadMG I wasn't being serious. (@Tony could explain the concept of exaggeration to you. :) ) I'm not going to do that to my kids unless the alternative is worse.
 
@sbi: lols
man
I wish I could do concurrency at university
 
:)
 
been assigned more PROLOG coursework and it makes me cry inside
 
hehe
 
9:24 PM
not funny :(
 
I'm proud to say I never got the hang of prolog :p
made my brain feel upside down
 
PROLOG sucks
it's unintelligible
 
it's an interesting language. It's just not something I want to write code in :p
 
I prefer to think as
the fundamental concept might be interesting or useful or something
but PROLOG is such a shitty execution that I'll leave well enough alone
 
:)
Yeah, I can't say I miss it either
 
sbi
9:26 PM
@DeadMG Didn't we have this discussion just the other day? You're not going to repeat all your "arguments" and expect us to reply, are you?
 
I wasn't there!
so I'm allowed to reply
 
@sbi: That was two months ago, and you completely misunderstood the arguments that I did make, and jalf wasn't here :P
 
sbi
@DeadMG Can't have been more than 10 days, and I wish I wasn't there.
 
@sbi: It was most definitely more than 10 days
it's been more than 10 days since I went home and visited my parents, and it was long before that
 
oo, a new and exciting argument
 
9:28 PM
I haven't been cursed with having to write PROLOG since my last assignment, which was a couple of months ago
so it's unlikely that I brought it up since
was it before I got sick? surely, cause that was exam time and I had bigger things to worry about
 
sbi
@DeadMG Then maybe it was another language? Or was it another user? :) It surely feels like last week.
 
lol
 
@sbi: Oh, there could have been some other discussion about it last week, I wouldn't really know
and last week/the week before, it was PHP
interesting question, do I hate PHP or PROLOG more
 
I'd go with PHP
because PROLOG is at least an interesting concept
 
there is that
but then PHP could be so much more with the addition of some static types
and a redefined library to be object-orientated
 
9:33 PM
yes, it could be a different kind of mess
 
lol
 
@DeadMG so what you're saying is, if PHP wasn't PHP, it wouldn't be so bad?
 
heh
there is that
it's true that PROLOG at least theoretically has a component which is new and different or something
see, I don't understand dynamic typing
like
just, who thought of it and decided it would be a good idea? why is it so popular?
 
sbi
@DeadMG I remember the PHP discussion. That wasn't unreasonable critic.
 
Dynamic typing is simple and easy and convenient, and you don't have to listen to a whiny compiler ;)
 
9:35 PM
you'd think that programmers would know better
 
not at all
also most people who favor dynamic typing do so because they don't realize that proper statically typed languages allow type inference
 
even if they didn't
 
they compare it against Java where you spend all your time writing types
List<int> list = new List<int>()
or C or depending on circumstances, C++
 
I'd still rather spend all my time writing types
because ultimately, type mismatch detected by compiler prevents bugs
 
Why? You're telling the compiler something it already knows better than you
 
9:37 PM
bugs that are gonna take me ten times as much time to fix at run-time
 
I want the compiler to tell me the types
 
@jalf: Compared to dynamic typing
not compared to my personal miracles of auto, decltype :P
 
I think the counter-argument is that because the language is so lenient, it's very easy to write lots of unit tests to compensate
 
only if the unit tests work
 
can be a pain to do that in C++, because if you set a foot wrong, one of your tests won't compile, and then none of them can be run
in python, you just write your tests, and if one of them has a problem, you'll find out when you run them, and it won't affect all the other tests
 
9:39 PM
but then you don't have to spend six hours debugging why the test won't work at run-time
don't have any experience with Python
and whilst it seems a silly language to me, I've never used it and thus will not criticise it
 
I don't think people usually spend 6 hours debugging tests in python ;)
that's kind of the point
 
unlike prolog or php
 
anyway, it seems to work in practice. People using those languages are productive
 
miracle how that happens
you know
dynamic typing worked OK in Lua
 
which kind of voids any argument about how it only leads to more time wasted
 
9:41 PM
productive != more productive than a statically typed language
 
well, most people seem to be more productive in (good) dynamically typed languages than in the clumsy old C-related statically typed ones
 
hmmm
 
I'm much more than competent in C++; learning and then using Python for some tasks increased my overall productivity
 
I'll admit, C++ has plenty of it's own pitfalls
 
But like I said, I don't think that's because dynamic typing is inherently better. Just because C-derived languages are terrible examples of static typing
 
9:42 PM
not necessarily
I think that C-derived languages just have a whole host of problems of being C-derived
especially C++
 
but most people have never encountered a good example of a statically typed language, and so they assume that only dynamically typed languages can take away the pain of having to specify types all over the place
 
then Java and C#, they have plenty of problems originating from the dynamic/JIT orgasm
 
Java and C# aren't dynamically typed
 
I know
 
and I consider both to be C-derived as well
 
9:44 PM
I meant, how they're built, as languages
like, everything off the heap, etc
because they're managed
 
they suffer from the same problems as C and C++ in that respect. Stupid syntax that requires the user to babysit the compiler
ah
that's a different discussion though
 
indeed it is
imo, it's not about stupid syntax per se
 
Anyway, I think I'm going to have to leave you before I pass out! 'night folks!
 
more like, the compiler technology isn't advancing as fast as what we can do with it
night
 
@DeadMG are you ranting again? I checked in earlier and you where on one :P
 
9:45 PM
It is stupid syntax. Compilers have been good enough to infer types for 15 years
it's just never been applied to the C family of languages because they suck syntax-wise
other statically typed languages solved the problem ages ago
 
@jalf: Bjarne said auto in 1983, but didn't because of compatibility with C
2
 
I would join in this, but I only really understand what statically and dynamically typed mean. And whilst I have used languages from both type, I can't rally say I noticed any preference. Dynamic is nice in that you don't need to worry about types, but their is the odd time it can trip you up. Static is nice because it means you are forced to think a bit more about what you are doing. As far as performance is concerned, I have no idea.
 
@thecoshman No, just a general observation.
"You" as in "one", not you specifically.
 
from a TDD point of view, at the very least, static typing is redundant busywork
I don't follow TDD exclusively, but it is valuable; and it's all too easy to focus on fixing compiler problems so that you either ignore or don't have time to explore other issues
 
@FredOverflow figured that would be what you meant. she does rant on about her sowing and knitting stuff. The strange thing is, I get hooked up on the 'knitting physics'
to the point I learnt to knit so I could understand it better :P
 
9:52 PM
@jalf Neither can you use int as a type argument in Java, nor can you instantiate interfaces ;)
 
10:36 PM
@FredOverflow Its much better, you don't need to provide the type at all! List l = new ArrayList();
 
10:58 PM
I just watched Herb Sutter's Lambdas talk he gave at PDC last year
I finally have an understanding on how to use Lambda's in C++. woot woot
 
:)
Have you used functors much? binders?
 
08:00 - 16:0016:00 - 00:00

« first day (146 days earlier)      last day (4803 days later) »