Language:
switch to room list switch to menu My folders
Go to page: First ... 26 27 28 29 [30] 31 32 33 34 ... Last
[#] Wed Apr 29 2009 15:42:57 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

except that it isn't actually garbage collection.

Yeah, it's really the same thing as c++ except you HAVE to take care of it yourself.
In C++ you can make a locally scoped instance of an object that magically goes away correctly when it goes out of scope. You can't do that in objective C. You have to specifically allocate it and specifically deallocate it.
The list trick which pete describes I think is how apache does it, probably how iplanet does it as well.
the destructor being called when the ref count goes to zero is effectivly a smart pointer, kind of backwards from what C++ does where the compiler takes care of that shit for you (where applicable)

[#] Wed Apr 29 2009 16:50:47 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Well, I got through the tutorial, and assuming they covered everything, you can see what they were thinking, and how it would be implemented as a precompiler (lots and lots of void *'s) and I bet theres at least a few people who wanted a shot to do it over again.

The lists peter was speaking of, at least nowadays is a standard class (and I hate to use the word class here, because it really seems to be a bit of a reach) called NSAutoreleasePool
So if you derive from NSObject which I assume is the defacto standard, you can throw yourself into the 'autorelease' pool which basically adds you to the list, and at the end of your program when you say pool release, it all goes away for you. and autorelease is really just a class method in nsobject.
so there's nothing magical in objective-c that does anything cool for you, although they do implement finally which is sorely missing from C++.

If anything I'd call objective C simple C++ or grandpa C++.
But I guess it is C like in that you get to do all the dirty work yourself.
One of the things I like about C++ is that it does some of the dirty work for you, but you're still pretty low level.
But if that's what I have to do to make money with the iphone, I'm all for it.

I'll let you all know when I make my first million.

[#] Wed Apr 29 2009 22:07:35 EDT from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

 

Wed Apr 29 2009 15:42:57 EDT from Ford II @ Uncensored
except that it isn't actually garbage collection.

Yeah, it's really the same thing as c++ except you HAVE to take care of it yourself.
In C++ you can make a locally scoped instance of an object that magically goes away correctly when it goes out of scope.

It's even better than that, really, as this implies that someone is simply doing malloc/dealloc calls 'automatically' or something.

It's actually applicable to nearly everything.

You could create a kind of FILE* object that automatically calls fclose on the FILE* when the thing goes out of scope.  I love things like that.

Or, you could have a kind of mutex that locks on allocation, and unlocks when the object goes out of scope.  Create the object before you go to do anything, and it will automatically unlock the mutex when the object goes out of scope.  That's really cool, to me.

All those asinine function calls you have to track when dealing with Windows' GDI (dealing with fonts, drawing bitmaps, etc) is seriously eased with this kind of trick.  You don't have to worry anymore about not having called such-and-so function to free up the drawing routines, or put things back the way they were before you mucked around with them... C++ constructor/destructor idiom handles all of that 'automatically' in a fashion that's quite sane... even working through rude things like exceptions.

Of course, someone people don't want to use C++ because that one benefit doesn't outweigh all of its other problems.  I guess.

I still think the language has come a long way.  I have to work with both VC++ 6.0 and the current Visual C++ (where they fixed a lot of crap to work the way C++ really should).  I curse working with the 6.0 compiler... man, what a turd.  I can easily see why people hated C++ if they had to deal with *that* crap.  Today, though, the language feels downright elegant.  I can get a lot of work done quickly, especially when I use the boost libraries.

Eh, but someone is going to call me a fan-boy for C++.  Probably LoanShark.



[#] Wed Apr 29 2009 22:53:47 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

I don't think you're a fanboy, but I think you like boost so much it makes C++ look good.
I've not looked at boost, but I've seen roguewave and while I can appreciate what they were trying to do... it just wasn't the right thing.
I've written the filecloser class, and the mutex class (which is interesting because you ahve to have read and write mutexes, and then of course I wisely stopped using threads and life got a lot less complex. :-)
the putting-in-a-list to be dealloced at the end is probably the nicest way to do it without having the compiler do it for you.
I was furiously pissed when I found out java had no destructors, but then I found out they had finally, which is basically destructors for code sections instead of classes, so you can arrange your methods to function as if they had destructors, you open the file saving the file handle as a class member, then put the next function call in a try finally so that no matter how it dies, you always get your file closed.
I don't like the noisy syntax of try/catch/finally, I prefer class destructors, but it would be nice to have finally in C++ also just so you can choose where appropriate.
Heh, I just found this:
http://www.research.att.com/~bs/bs_faq2.html#finally

[#] Wed Apr 29 2009 22:55:15 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

http://www.research.att.com/~bs/bs_faq2.html#object

ooh, that page is all sorts of interesting.

[#] Wed Apr 29 2009 22:58:03 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

http://www.research.att.com/~bs/bs_faq2.html#virtual
This is great, all those mythical questions I've always asked...

[#] Thu Apr 30 2009 00:20:54 EDT from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

I always thought the use of the word "finally" was amusing.

[#] Thu Apr 30 2009 06:27:06 EDT from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Yeah, I like boost.  A lot.  For me, it fixes a lot of things that annoyed me about working in C++.

But then, I always sort of thought that the only real problem with C++ was that it didn't have very good support libraries.  I think, with the benefit of time and interest, this has changed a bit.

Now, if only someone could come up with a sane GUI library for C++...



[#] Thu Apr 30 2009 09:48:33 EDT from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Now, if only someone could come up with a sane GUI library for C++...

People who use Qt tend to speak very highly of it. I haven't had the opportunity to try it out myself, but I don't recall ever hearing anyone complain about having to work with it.

[#] Thu Apr 30 2009 11:41:38 EDT from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Except that Troll's handling of the Qt 3-to-4 transition was completely asinine.

So there's your first complaint...

[#] Thu Apr 30 2009 12:02:05 EDT from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Qt doesn't feel right to me... or, at least, when I last looked at it, it felt all wrong.  It felt like an attempt to bend C++ to its whim, rather than to build something that fits into the language comfortably.  It's almost like a cross-platform version of MFC, except admittedly done better.

I tried working with Ultimate++, which was much, much closer to what I wanted to find, but kept running into subtle little bugs and surprises when I tried to use their GUI library with boost... they're doing weird things, and I'm not sure I appreciate it.

I need to more seriously look at SmartWin... except that I do not like the idea of a library that only works in Windows (or requires WINE).

I dunno... maybe this is some kind of holy grail thing that nobody will ever create.



[#] Thu Apr 30 2009 12:26:54 EDT from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

felt all wrong. It felt like an attempt to bend C++ to its whim, rather
than
to build something that fits into the language comfortably. It's almost
like

Example?

[#] Thu Apr 30 2009 13:46:29 EDT from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

 

Thu Apr 30 2009 12:26:54 EDT from LoanShark @ Uncensored
felt all wrong. It felt like an attempt to bend C++ to its whim, rather
than
to build something that fits into the language comfortably. It's almost
like

Example?

Doesn't Qt require these BOM or BCS or some kind of file that holds 'meta' information related to assembling the GUI?  And doesn't that file have to go through some pre-compiler that they build, before you can make any use of it in C++?

Or does Qt have these weird macros all over the place that you have to assemble in some fashion?  Sort of like MFC?

Again, maybe things have changed, and it isn't anything like I recall ('cause I did look at an awful lot of choices out there).  I just remember not quite liking the way it was put together.



[#] Thu Apr 30 2009 15:59:34 EDT from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Doesn't Qt require these BOM or BCS or some kind of file that holds 'meta'

information related to assembling the GUI? And doesn't that file have to
go
through some pre-compiler that they build, before you can make any use of
it
in C++?

Ah, that's "moc". Not really sure how it works. You may have a point there.

[#] Thu Apr 30 2009 21:22:20 EDT from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

 

Thu Apr 30 2009 15:59:34 EDT from LoanShark @ Uncensored

Ah, that's "moc". Not really sure how it works. You may have a point there.

Right... 'moc'.

It's wxWindows that uses those darned macros that look kind of like MFC.  I get those two mixed up, as they're both fairly popular.



[#] Sat May 02 2009 22:48:38 EDT from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

As an aside, wxWindows is now called wxWidgets, because Microsoft got all in their face about the use of the word "windows"

One of the neat things about Qt is how more and more stuff that originally was part of KDE keeps finding its way into Qt proper (WebKit is probably the best example).

I'd love to see KDE end up getting really really tiny because all of the good parts ended up in Qt, because then all of the apps would be able to run on Mac and Windows with very little (if any) modification.

[#] Sun May 03 2009 06:41:28 EDT from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Ha... figures wxWindows had to change their name to wxWidgets.  That's a better name anyway, in my opinion.



[#] Mon May 04 2009 09:48:30 EDT from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

I agree it's a better name, but no one enjoys being bullied.

[#] Mon May 04 2009 09:59:58 EDT from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Oh, yeah, nobody likes that to be sure. Sucks they felt the need.

Go to page: First ... 26 27 28 29 [30] 31 32 33 34 ... Last