Welcome, Guest. Please login or register.

Author Topic: Native Blitz Basic for AROS ever?  (Read 5186 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Native Blitz Basic for AROS ever?
« on: June 15, 2010, 10:44:47 AM »
Quote from: xeron;564665
He wants to program on AROS. 'Learn C' may not be what he wants to hear, but its the best answer.


Correct. Plus, once learnt, it opens up a lot of other languages too.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Native Blitz Basic for AROS ever?
« Reply #1 on: June 15, 2010, 12:17:57 PM »
Quote from: bloodline;564667
Yeah totally!!! Like Obj-C :lol: I'll get me coat ;)


Well, provided you don't mind mixing it up with smalltalk.

I have to say, Objective-C is the ugliest mash of two unrelated syntaxes ever. Worse still is Objective-C++.

Although it's doubtless regarded as the pinnacle of beauty by acolytes of the Cult of Jobbs.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Native Blitz Basic for AROS ever?
« Reply #2 on: June 15, 2010, 01:33:27 PM »
Quote from: persia;564671
Worse still is the non-objective version of C++, that is ordinary C++.

I couldn't disagree more strongly, and neither could the software industry as a whole. C++ is so widely used because it is a 99% compatible superset of C89 with additional features useful for building large applications (OOP, generic programming etc).

Syntactically, C++ is far cleaner than Objective C/C++ although the ugliest syntactical aspect (template) is pretty bad. That aside, it introduces new syntax primarily through additional keywords. It doesn't, unlike Objective C, radically redefine the meaning of existing C syntax when used within the context of classes.

Lastly, absolutely no major company uses Objective-C save for apple. Which doubtless suits their business model just fine.

Quote
All attempts to implement objects in C fail because C is, in many ways, antagonistic towards the idea.

Creating runtime polymorphic objects in C is pretty straightforward if you don't mind function pointers. I used to do that a fair bit before moving to C++.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Native Blitz Basic for AROS ever?
« Reply #3 on: June 15, 2010, 02:54:32 PM »
Well, GCC supports Objective C as far as I know. I haven't looked into it for a long time though. Objective-C v2.x is developed and maintained by apple but as far as I know is still open.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Native Blitz Basic for AROS ever?
« Reply #4 on: June 15, 2010, 03:30:01 PM »
Quote from: bloodline;564677
Clam down guys! I happen to have used both C++ and Obj-C... When I first use Obj-C it was a horrible verbose mess of a language, which seemed to lack the more obvious design of C++, but after using Obj-C a lot, I came to undertand the design goals of the designers.

I do understand the design aims of Objective-C, I just think it's a hideous abortion of a language, especially as a superset of C.

Even the most basic OO operations have a syntax a drunken alien could not have made a worse hash of. Instantiating an object on the free store:
Code: [Select]
Foo* foo = [[Foo alloc] init];
The left hand side of the above assignment is C, right hand side is... gibberish.

Or, in v2 parlance:

Foo* foo = [Foo new];

A bit better, but what the feck is with the square bracket syntax?

Now, in C++
Code: [Select]
Foo* foo = new Foo();
The only unusual thing above from a C perspective is operator new.

Quote
I now think that C++ is the more logical evolution of C, but that Obj-C is a purer vision of what an OOP programming language is supposed to be. Neither is a better language, they simply have different design goals.

I wouldn't call either language an evolution of C. They are both supersets that aim to provide support for paradigms other than basic procedural programming. C++ gives you a strongly typed OOP model with a wide gamut of OOP features many other languages have shied away from (things like multiple inheritance and operator overloading spring to mind), generic programming and metaprogramming, but comparatively weak support for reflective programming. From this we get strongly typed, compile-time dominated optimisation that leads to efficient code but with some limitations on runtime flexibility.

Objective-C brings what I'd define as "narrow" OOP, akin to the Java model of singular inheritance with interfaces and reflection. From this we get a somewhat weaker typed system with emphasis on runtime flexibility rather than performance. Having runtime loadable classes and the like is certainly nice.

Both are decent aims; my argument is purely about the syntax. Objective-C's OOP syntax is simply alien if you come from a C background. One cannot claim with any credibility that resembles traditional C.

Consider a simple C function used as an interface to some structure to discourage direct poking about:
Code: [Select]
struct Foo {
  int bar;
};

int Foo_getBar(const struct Foo* foo)
{
  return foo->bar;
}
In C++, you might have reworked Foo as a class and have a simple inline getter:

Code: [Select]
class Foo
{
  private:
    bar;

  public:
    int getBar() const
    {
      return bar;
    }
};

The basic C function syntax is still perfectly recognisable within the class context. The only unusual thing above is the const qualifier for the code block which provided a guarantee that calling this method will not change the instance of the class. In the end, a nice simple method that will always be optimized away by the compiler to a safe, read-only access to the member value 'bar';

Then we get Objective-C (there may be a few errors here, I haven't used it for years):
Code: [Select]
@interface Foo {
    int bar;
}
 
-(int)getBar;
@end
There's already a fair degree of WTF going on here, but we aren't done yet since as you don't generally have simple inline methods, you must implement your interface elsewhere:
Code: [Select]
@implementation Foo
-(int)getBar
{
  return bar;
}
@end
So, the class to which a member function belongs is delimited with '@', the indication that the function is not an instance method but a class method is the '-' prefix, return type is parenthesised and none given for the arguments taken (if any). How could that look less like C, other than by removing the braces and elemental type names?

Lastly, where are the accessor levels? Even Java has those.

I'm sorry but as far as C goes, all of this is just an utter abortion.

Quote
Personally I now prefer Obj-C, as I fid it easier to come back to a project after not lookin at it for a while and get back into it without having to reread my design notes!
« Last Edit: June 15, 2010, 03:35:32 PM by Karlos »
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Native Blitz Basic for AROS ever?
« Reply #5 on: June 15, 2010, 03:54:00 PM »
Quote from: bubblebobble;564693
WTF, were are the ;'s ?? Eeek ;)


Like JS, in that regard. Personally, I rather like my statements to have some visible terminator.

Imagine what English would be like without the full stop...
int p; // A