Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Sure why not? That's how all languages get created, someone finds a need for it. In all likelihood it will be more effort than its worth but it doesn't mean you shouldn't try.
 
You might be interested in Eero, modifications to the Clang Objective-C compiler that one guy has done to bend the Objective-C syntax into one more to his liking: http://eerolanguage.org

You and the community might be well served if you use & contribute to this (or fork it) and then work from scratch only on the interpretive shell part of your idea. I'd be interested in an immediate interactive environment for the Objective-C runtime (one that wasn't F-Script).

Also, let me plug this language whose development I was following for a while http://xlr.sourceforge.net Although I'm less of a fan now with how the author has evolved the syntax to be so pascal-y, some of the ideas there are brilliant. If nothing else, I believe this language compiles (translates?) down to C so the source code might be a good reference.
 
You might be interested in Eero, modifications to the Clang Objective-C compiler that one guy has done to bend the Objective-C syntax into one more to his liking: http://eerolanguage.org

You and the community might be well served if you use & contribute to this (or fork it) and then work from scratch only on the interpretive shell part of your idea. I'd be interested in an immediate interactive environment for the Objective-C runtime (one that wasn't F-Script).

Also, let me plug this language whose development I was following for a while http://xlr.sourceforge.net Although I'm less of a fan now with how the author has evolved the syntax to be so pascal-y, some of the ideas there are brilliant. If nothing else, I believe this language compiles (translates?) down to C so the source code might be a good reference.

Eero looks interesting - I like how much they've taken away from the existing syntax of obj-C. I'll have to look into how the parser works.
 
You might be interested in Eero, modifications to the Clang Objective-C compiler that one guy has done to bend the Objective-C syntax into one more to his liking: http://eerolanguage.org

You and the community might be well served if you use & contribute to this (or fork it) and then work from scratch only on the interpretive shell part of your idea. I'd be interested in an immediate interactive environment for the Objective-C runtime (one that wasn't F-Script).

The claim is that readability matters, well sure but so does maintainability, compatibility and portability among other things. I have not looked into it that much but some problems I see are reliance on white space, single quotes instead of double quotes even though they do not mean the same thing in C, removal of @ means introduction of new reserved words which can also break existing code.

If all you want is a scripting language for Cocoa there are already both Ruby and Python bindings.
 
Question:

What is the point of the import command in Python? I understand why most languages have it (for compilation), but it seems to me that as Python is interpreted, it has no need for import statements. When it comes to a variable that doesn't exist in the local, function, class, or global namespace, it should then attempt whatever it does when you type import.

Second (related) Question:

Does Smalltalk have an import command or anything equivalent?

What I'm getting at is that I'd like to not have any import command. It strikes me as needless boilerplate code. It'd be the equivalent of, before greeting someone, saying "import Greetings". (I understand that it can somehow avoid namespace collisions, but I have a different method of avoiding namespace collisions.)
 
Question:

What is the point of the import command in Python? I understand why most languages have it (for compilation), but it seems to me that as Python is interpreted, it has no need for import statements. When it comes to a variable that doesn't exist in the local, function, class, or global namespace, it should then attempt whatever it does when you type import.

It enables expansion beyond what is offered in the language itself with modules, and it allows code to be written in more than one file. That's the main uses I can think of right now.
 
It enables expansion beyond what is offered in the language itself with modules, and it allows code to be written in more than one file. That's the main uses I can think of right now.

But why not use the method I provided? IE, right now if I try using a module before the import statement for it, it'll fall on its face and throw errors about how it doesn't recognize the module, instead of attempting to implicitly import it.
 
But why not use the method I provided? IE, right now if I try using a module before the import statement for it, it'll fall on its face and throw errors about how it doesn't recognize the module, instead of attempting to implicitly import it.

What I can think of is avoiding having to text search all modules on the system every time the code is run. And beyond that, naming collisions. There may be more reasons that I have missed.
 
I swore back in my dBase II days (showing my age) I was going to write a language with 2 statements:

set bugs off
DoWhatIThink
 
My biggest issue with Obj-C/Cocoa, I think, are lines of code like this:

Code:
NSCharacterSet * characterSet = [NSCharacterSet characterSetWithCharactersInString:@".\r\n"];

This one line of code is totally useless by itself but is 93 characters long.

The three main issues I have with it are:
- It repeats what it is 3 times. The full class name is repeated twice, and then for some reason it was felt that it was necessary to have the name of the class method contain the class's name. This practice is repeated with many foundation classes, but NSCharacterSet is particularly annoying because of how long the name is.
- Why is the phrase "CharactersIn" in the method name? Why not just "WithString"? It's impossible for those words to have helped improved the user's understanding of how the method worked.
- What is "NS" supposed to mean to me, as the user of this class. Yes, I know what it means, but how is it useful to me in any way? The answer is it's not. It doesn't give me any greater insight into how it works - if anything it makes me confused about what it means and possibly makes me worry that it'll do something other than what I expect.

Ultimately, that line should look more like (this is written how the syntax of my language looks so far.):

Code:
CharacterSet named:characterSet usingString:".\n\r";

Just 52 characters.

Edit: Even worse, you could have an NSMutableCharacterSet, I just realized.

Code:
NSMutableCharacterSet *characterSet = [[NSCharacterSet whitespaceAndNewlineCharacterSet] mutableCopy];

102 characters.
 
Last edited:
I realize this might fall on deaf ears, but:
Verbosity isn't evil. I tend to prefer over-verbosity to extreme terseness.
In IDEs generally you get completion of classes and methods, so you aren't typing 102 characters, you type 20 or 30.
If you want a +withString:(NSString *) factory, by all means add one with a category. This is a great feature of Objective-C.
Name spacing in class names to avoid conflicts is a bit clumsy, but alternatives like packages in Java have downsides, too. If you need access to two classes with the same name in one file, one will appear fully-qualified throughout. Yuck. Again, NS feels a little clumsy, but certainly doesn't seem that confusing.

In general Apple seems to be working to simplify things, such as NSArray, NSDictionary, and NSNumber literals. This helps make things that should be easy feel that way.

I'd also like to point out that some gripes are with the APIs provided rather than the language itself. Many of these can likely be tweaked using your own helpers, wrappers, categories, etc. As an aside, C++ (so likely Objective-C++) has added auto for typing, to reduce some of the verbosity. So your example in an Obj-C++ file with a category might be:
Code:
auto characterSet = [NSCharacterSet withString:@".\r\n"];

Maybe the compiler would choke on inferring the type of a method pass, but I think it could handle it.

My general point is that most languages have rough edges, but generally using tools and your own code (that you can always bring in as a library) can smooth them out a bit.

-Lee
 
This isn't a difference between verbose and terse. This is a difference between concise and redundant.

The issue with the character count isn't writing them, it's reading them. There's twice as much code to read.
 
Yes, Cocoa APIs can be quite verbose. But, there is something to be said for the line:

Code:
NSCharacterSet * characterSet = [NSCharacterSet characterSetWithCharactersInString:@".\r\n"];

I don't need any additional comments to tell me what this line of code does. It get a new NSCharacterSet containing the characters ".", "\r", and "\n" copied from an NSString literal @".\r\n". This, however:

Code:
CharacterSet named:characterSet usingString:".\n\r";

Might leave me wondering: What does "usingString" mean in terms of resource ownership? Is the string being copied? Is the string being retained with a weak or strong reference? If I pass in a huge string and subsequently release it, does "usingString" imply that it will not necessarily be freed as a resource?
 
Hmm.
But this is not about the language -- it is about the libraries. If you make new librarys the same thing could be
Code:
T1 * c= [T1 I:@".\r\n"];

Better?


My biggest issue with Obj-C/Cocoa, I think, are lines of code like this:

Code:
NSCharacterSet * characterSet = [NSCharacterSet characterSetWithCharactersInString:@".\r\n"];

This one line of code is totally useless by itself but is 93
 
This, however:

Code:
CharacterSet named:characterSet usingString:".\n\r";

Might leave me wondering: What does "usingString" mean in terms of resource ownership? Is the string being copied? Is the string being retained with a weak or strong reference? If I pass in a huge string and subsequently release it, does "usingString" imply that it will not necessarily be freed as a resource?

I don't wonder at all. Those are all the responsibility of the class. If it's properly written, they aren't my responsibility. If it's improperly written, then that's a bug, and my only responsibility then is whether to use a buggy class or not.

The ownership issue, as well as copying, are already defined by Cocoa conventions. I see nothing that would lead me to expect anything different. This is especially so if the docs for the method say nothing special about ownership or copying.
 
Hmm.
But this is not about the language -- it is about the libraries. If you make new librarys the same thing could be
Code:
T1 * c= [T1 I:@".\r\n"];

Better?

No, you have a lot of Obj-C baggage (*, [, @, and ]), you still repeated the name of the class, and now your code is illegible.

Regarding the libraries, I have an issue with the fact that after I write my library, you're going to have to write many of the same functions for your own library, as will every other programmer have to write the same functions. That's a huge amount of wasted time. On top of DRY, there should also be DROP (Don't Repeat Other Programmers). The issue is that there's no good way of getting other peoples libraries. The quality is iffy, the legality is iffy, there's special conditions about how you can compile it, there's a lot of options, the documentation is poor, when an update is released are you going to get it, on and on. Bleh bleh bleh.

I have a lot more than just a language planned. Originally my idea was to just make a plugin for Xcode, but as my ideas multiplied I realized I needed to create an entire ecosystem for all my ideas to work together in. I need a new IDE, a new language, and a new version/package control system to make everything come together.
 
I know it's irrelevant at this point, but adapting a mature language vs. building your own seems way better.

I know none of this is impressive, but a
Code:
-(NSCharacterSet *) asCharacterSet
category on NSString. Then:
Code:
NSCharacter *set = [@". \r\n" asCharacterSet];
Yes, characterSet appears twice. If methods didn't describe this, nesting message passes would be indecipherable.
Again, I think auto would work, so even:
Code:
auto set = [@". \r\n" asCharacterSet];

Pretty concise, and leverages existing language features. You get to keep using all the existing libraries and support.

Again, more power to you, but having 0 people know a language and support it is rough.

-Lee
 
Not anything new. Check out what the perl programmers did in the library cpan.
http://www.cpan.org/


Regarding the libraries, I have an issue with the fact that after I write my library, you're going to have to write many of the same functions for your own library, as will every other programmer have to write the same functions. That's a huge amount of wasted time. On top of DRY, there should also be DROP (Don't Repeat Other Programmers). The issue is that there's no good way of getting other peoples libraries. The quality is iffy, the legality is iffy, there's special conditions about how you can compile it, there's a lot of options, the documentation is poor, when an update is released are you going to get it, on and on. Bleh bleh bleh.
.
 
Not anything new. Check out what the perl programmers did in the library cpan.
http://www.cpan.org/

I am aware that others have tried this before. As far as I can tell, all of them suck. 112k modules isn't necessarily something to brag about - I suspect there's a huge amount of useless code in there, although I confess I haven't been exposed to it so I may be wrong.
 
Add that you need a lot of friends helping you to write and insure the quality of the libraries. My guess is that getting those together is going to be really difficult part.

As you have already just about killed every other effort of cooperative programming, you really need to define something totally new. I wish you best of luck. The few that has succeeded, ie Linus Thorvald, will be remembered in computer history a long time.

// Gunnar

I have a lot more than just a language planned. Originally my idea was to just make a plugin for Xcode, but as my ideas multiplied I realized I needed to create an entire ecosystem for all my ideas to work together in. I need a new IDE, a new language, and a new version/package control system to make everything come together.
 
As you have already just about killed every other effort of cooperative programming,

I don't understand what you're saying here...

I'm not getting rid of cooperative programming - I'm going to coordinate it to make it as productive and non-redundant as possible.

More than having the entire ecosystem take off, I just want to make a Smalltalk 2.0 or something, where other people replicate the ideas that I introduce and popularize them - it's okay if my system falls into obscurity.
 
Last edited:
Well, sorry if I read you wrong. I read this and you sort of imply that all other librares ever created are included:

The issue is that there's no good way of getting other peoples libraries. The quality is iffy...

In contrast, I find that there is lot of high quality open source code freely available in the languages I have been working in. Only a few examples:

c: there is literally tons of very high quality code available in every thinkable application area. It might take a bit of time to find it, but that investment pays back several times. (in my experience, but YMMV ) .

perl: the library cpan has some really good code.

wordpress: the plugin library is full of very good functions and most of them are completely free.

Of course, in the open source, free world the quality varies. But generally, and again in my experience, the general quality is very high. Some areas of code has "gateways" of people guarding what code is published, some not. But if you look at as example the Linux / GNU area which has gateway keepers you will find professional level quality code well above what I myself will be able to produce.

Regardless, keep up your good work. You have high ambitions, which is a lot better than the alternatives.

// gunnar
 
Here's another fun one liner:

Code:
NSRegularExpression * tagWithClassRegex = [NSRegularExpression regularExpressionWithPattern:@"<[^>]*?class\\s*=\\s*(\"[^\">]+?\"|\\w+).*?>" options:NSRegularExpressionDotMatchesLineSeparators error:NULL];

203 characters. Again, totally useless on its own.

Code:
RegularExpression named:tagWithClassRegex usingPattern:"<[^>]*?class\s*=\s*(""[^"">]+?""|\w+).*?>";

(It seems to me the dot preference should be assumed... I don't understand why it's not in most implementations of regex. It seems to me you should need to explicitly set the opposite.)

Down to 99 characters. Although I may not stick with this way of escaping double quotes in strings... I can imagine problems it could cause.
 
Code:
auto tagWithClassRegex = [@"<[^>]*?class\s*=\s*(""[^"">]+?""|\w+).*?>" asRegularExpression];

Regexs always suck.

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.