In my experince C++ is a huge and complicated language and programs can soon become overwhelming. I don't think there is a single living human being who understands all the nuances of all C++ features. Perhaps I just haven't graspped the nack of keeping things under control and simple.
Qt add the signals and slots mechanism to C++ which complicates things further, but does a nice job of connecting GUI elements to actions. It just seems that needing to add signals and slots to the language and a preprocessor to compile it shows that C++ is flawed.
The Qt libraries are huge. So it can take a while to get your head around it all.
Still, even I with limitted C++/Qt experience managed to make a nice app fairly easily. Including networking and threads and OpenGl accelerated graphics.
Ha, you just remeinded me that I once had a book teaching how to create Win32 GUI apps in assembler!
I worked through some of the examples and found it easier to understand than the same stuff in C++:)
Shame I can't recall the author or title now.
hmmm thanks phil, i read a python book a while back to do some cgi with and found the language quite nice but never looked beyond the basic command line stuff had no need im going to look into this could be a better rad than vb6, if tkinker is win/linux only thing about python is the the windows vs linux way of doing things makes serial access un portable but thata an easy fix. im just not a perl guy, both perl and now fourth make me shutter
Qt is very much C++and oop. It is possible link regular C code into C++ app. If you have a lot of C code that might be worth the hassle. Google "extern C".
You can use Python to build GUI apps with Qt. Your button application is only seven lines long in PyQt. http://www.diotavelli.net/PyQtWiki/HelloWorld
Well holly molly! I was looking in to some thing called robot basic to or maybe processing to do tghe front end for my robotics stuff on the PC but I think we have a clear winner here.
i remmber reading about go when it first came out a few years ago, just seemed like any other language. im curious whats so special about thats gaining popularity now? am i missing the next revalution as im a google fan boy
Big things that attract me to go just now are:
1) Nice and simple looking source code. Like they ironed out the ugly wrinkles from C and not that horrible, verbose, multi-linje object oriented uglyness of C++ or Java.
2) It feels like working with a scriping language like Python as the compilations are so fast but it has the type safety and error checking of a compiled language like Pascal or Ada.
3) Garbage collection. No more worries about who is going to delete which objects in a multithreaded program.
4) The biggy, concurrency. Very easy to create threads and have threads communicate. Those threads can be within a single processor or running on may cores in your multi-core machine.
5) Makes it very easy to create web servers, web services, websockets and a bunch of other network things. Which is something I have to do on a project now.
6) It's compiled so has C like performance.
That concurrency thing is also usefull for simplifying algorithms even if you don't really need parallelsism.
Check out golang.org. You can play with Go on line.
In addition to your items which I agree with, I like the way they handle modules and the library items. Just name a module if you are going to use it and just write the code and put it a module. None of those silly .h files that have the same declarations as the .c files.
I need to work more with it...too many other distractions going on.
Yes I forgot, none of that messing about with header files. That's one of the things that speeds up the build dramatically.
There is a front end for Go for GCC so perhaps, possibly maybe, one day we will see Go on the Propeller. If those goroutines could start COGs that would be great. Eric has done that for the C compiler using OpenMP so it must be possible with Go. Go already runs on quite small systems sitting on top of the RTEMS operating system.
I don't know for sure, but I highly doubt it. I was answering to the original post which said:
What program should I use?
Here's what I want: I'd like an IDE which has a toolbar and I'd like to click "New Project" and grab a button, and a textbox, and then I'd like to click on the button and some skeleton code should appear, and I'd like to print "Hello World" in the textbox. I'd also like some syntax highlighting, auto indentation and auto finding of class methods if I type a . or :: or whatever. And then, once Hello World works, I'd like to to send that text out the serial port.
In front of me is an XP and a Win 8 machine and I'm running both side by side as I want the program to run in both. And I've got Ubuntu running on Virtual Box.
Exactly. It specifically says there is Ubuntu with the implication that the IDE should work there as well. Looks like a job for C++ and Qt to me. Visual studio is a dead end if you are thinking cross-platform.
I have not read the whole thread, but grammatically in the quote I provided, he states that he wants the program to run on both XP and 8. As for the Ubantu, he is just stating a fact. Each sentence should stand on it's own, grammatically speaking of course. And the final sentence states:
And I've got Ubuntu running on Virtual Box.
I see a sentence containing a statement with no implications, however a person could consider the context, so perhaps he may want the ide to run on that as well, but he does not specifically state that desire.
That is true, the way it is written we can not rigorously determine what he means. Casually however I read the implication that the suggested IDEs should also run on Ubuntu. I would not suggest Visual Studio as it will only lead to much re-writing of apps when he realizes it's time to move off of Windows.
I see a sentence containing a statement with no implications, however a person could consider the context, so perhaps he may want the ide to run on that as well, but he does not specifically state that desire.
Yes I should have clarified that more. I don't have a dedicated linux box (mainly due to my desk space being filled up with propeller stuff!) so the next best thing is to run linux/ubuntu from virtualbox. It is more convenient that a dual boot box.
In a general sense, I guess what I am trying to do is future-proof code. I've ported huge applications from Quick Basic to VB5, only to find microsoft then moved to the .net framework and everything had to be rewritten again. There is an inbuilt obsolescence. But there is something bigger going on at the moment, and that is the movement to multiple platforms. I love the .net framework but it isn't going to work on linux or a mac or android or whatever is going to come along next.
It seems there are competing forces - on the one hand certain companies want to lock you into their system. Windows is one, but Macs seem even worse, and even within Linux there is a bit of a vibe of 'why would you want to run on any other platform?'.
But fighting against this are individuals and groups who want to run code on as many platforms as possible. If a new operating system comes along, these boffins are keen to get their code working on that platform. I don't think any one company is driving that - it seems a more open source movement than anything else.
So I guess this thread is not a question of "what is your favorite language". It is more about what language is likely to be around in 10 years time, running on multiple platforms, many of which don't even exist yet.
And for a more immediate and practical goal, I want to write some code to put a button on a screen, run that on a PC and then have the same program run on a propeller. That is a huge challenge and there are lots of bits of the puzzle to pull together but I think it is possible.
To my knowledge, there is nothing more powerful than C++, irregardless of the platform. If there is a difficult programming task to be accomplished, then C++ is the tool for the job.
Way back when, I played the cross platform game myself, in varying degrees. To put it bluntly, you will drive yourself nuts trying to satisfy everyone, and spend a lot of time, money, and effort trying to accomplish it. And if it is just a one guy operation, trying to accomplish it all, it will be constant screen and keyboard time. The best suggestion that I can give you is to define your target and don't just say everyone. When you have defined your target, then build the software to suit them. I have always chose Windows, because it had a large following, but then that was a different venue for what I was attempting. In other words, if I was to go back to writing software, I would target Window users that had a particular need for the software that I was going to create. I did not care that Mac users wouldn't be able to use my software, because the Windows user population is HUGE and I was familiar with the system. I figured let a Mac programmer create some similar software for Mac computers. I do not know what your own personal goals are, but if you are programming for self-gratification then pluck away until your heart is content by trying to cross platform. On the other hand, if your goal is to make money, then target one group of users, and design your software very well, instead of spreading yourself thin by trying to satisfy everyone. Once again, I say Visual Studio C++, and focus.
I use processing sometimes for multi platform http://processing.org/, it complies for windows, linux, mac, and has an export for eclise for android.
The IDE is the same as the Arduino IDE and it tries to simplify java in the same way the Arduino tries to simplify c
i know i said i was sold by PyQt which i am for a "real language" but yesterday i watched a 15 part arduino thing on youtube by this guy Jermy Blumb and in some of the tutoriqls he had you use Processing and i gotta say ot really reminds me of when i first picked up VB4 as a jr high kid to write "AOL progs" its so simple to pick up on and just get working in without reading much, although the ease at which Arduino/Processing has come may be attributed to years of C/dabbling in C++. I think for a quick and dirty language where your making front ends to hardware its pretty darn niffty... the post above says it can some how be used with Android I must look into this!!!
I really have to agree with the MSVC camp here though for a full featured setup, if platform cross compatibilty isnt an issue. I really wish MSVC worked on linux I hate to say it but this is one place commercial software excels MS makes great dev tools they are just setup to work on a bliated convaluted platform!
C++ seems to be where many roads point. It runs on windows *and* it runs on other computers too.
In a moment of frustration I thought I would design my own language. Famous last words. How about a language with hardly any rules at all. I was going to call it "dogs breakfast" as a result. Intriguingly, both Go and Processing seem to have many features of my new language. Maybe others are thinking along the same lines?
I started with the very simple idea that all keywords are classes. Take the BASIC loop
FOR A = 1 TO 5 STEP 1
and compare with the C version
for (i = 0; i < 6; i++)
The C version looks more like a function. It almost could be if the "i++" were replaced with "1", and the receiving routine would know it was referring to "i". So we could start with a class called "loop" and a method in that function could be "for" and you could pass all the parameters like
loop.for(i,10,1)
Then you could add the .repeat .while .do and other loop functions to the loop class.
C starts off as a simple language and then adds things in libraries such as stdio and math. This takes the concept further and has even the most basic constructs of a language in libraries.
Maybe you need a few rules. Braces to do indents and signal the end of loops.
Here's one of my bugbears. = vs == vs :=
I have a theory that they are all different because the writers of the compilers were a bit lazy and wanted a way of distinguishing between "if a = b" and "a=b". I had an idea that you can bypass the whole argument by adding this as a new class. Thanks to the links above, take a look at what processing does
...Put briefly, if you want to compare two Strings you should always use:
if (name.equals(BEST_NAME)) {}
and never:
if (name == BEST_NAME) {}
Go looks kind of similar too.
Why on earth do this? Well, some years back I wrote a compiler and it is good mental exercise and I feel like doing it all again *grin*. No, seriously, I want to get close to the metal for speed and I'd like a language that compiles easily. So, take the "equals" class which replaces == and think about it from a machine language point of view.
if a = b then {}
which in assembly is something like
compare a,b
if flag not zero skip to closing brace
{
}
Let's borrow something nifty from Spin - the ability to rename objects. So you might have the "compare." class and that is what you write in code, but in a folder you have a bunch of different files, eg compareZ80, compareSpin, comparePasm, compareC++, compareVB, and at the beginning you declare which one you are going to use.
Then, within that class, you write the code in whatever your favourite language is. It might be only one line of code. The aim is for a compiler to largely do a copy/paste of that code.
The IDE needs to have an autocomplete function any time it finds a . and it matches a library already declared. That makes learning the language much easier and saves rummaging around in .h files trying to find what it can do. (I'm borrowing that idea from vb.net where a few years back all string functions got deleted from the basic language. But they were reinstated with the strings. class which then could be used in C# as well. A neat example of the convergence of Basic and C).
So this is my crazy idea - a language that starts off with virtually no keywords at all!
Intriguing that Go and Processing seem to be working on the same idea.
Oh, and heater would like this - I'm also thinking of a virtual machine that is a hybrid stack/register engine, borrowing bits of Forth and bits of Zog as well. Actually, it might be easier just to use Zog. I wonder if we could get a Zog emulation on a real Z80...
Where this might be heading is the ability to write a program that uses a button class, so button.font, button.text, button.press and have an object which might be buttonc++ (maybe write that in Qt or code::blocks/wxsmith) but with one simple change at the beginning of the program to buttonLMMPasm, have that running on a propeller..
Or maybe I need to try to work out what is going on at the deep inside the GCC compiler which seems to have the same ugly hack I used in Catalina where you precompile pasm code then copy and paste it into C code as a completely unintelligible hex array. You can't use assembly because it isn't C, all the boffins correctly say.
All roads point to C++. Trouble is it's a huge and complex language in which you have to write verbose code that most of the world seems to be trying to get away from, hence Java, C# and so on. Having a language than runs on all the machines you want it to is only the begining of solving your problem, you still need all that GUI stuff working on all those machines and you'll probably want an IDE to do it in. I can't see any such system working on the Prop as well.
I wish we could stop calling refering to "Processing", "wiring" and so on as languages. They are in fact Java aand C++. Those other names more correctly refer to sets of libraries, run time support and IDE's.
Go has a lot in common with many other languages. I guess it has no features that have not existed in another language somewhere. However it does do a very good job of cleaning up that "Dogs breakfast", simplifying and slimming down the language with little in the way of redundant features.
Then you have a load of stuff that seems very "out there" I have to ponder on it....
As for the = vs == vs := thing. It's not because compiler writers are lazy it's because they are actually diffent things.
In C "= " is an assignment. In Pascal ":=" is an assignement. In C "==" is a comparison. Mathematically I think they are all wrong. In maths "=" is a statement of fact e.g. in "4 = 2 + 2" I am not assigning the result of "2 + 2" to "4" I am stating that it is so.
Anyway, In C I can write "A = B == C" and so on. I might want to actually write "if (a = b)" which is not a comparison but an assignment. Confusing and should not be done but there it is.
It get's even better. In Go we have:
"=" Is an assignment.
"==" Is a comparison
":=" will declare a new variable of the type of the thing on the right hand side and assin that value to it. So for example:
"a := 5 * 3" will create a new integer "a" and assign the value 15 to it. It's the same as "int a; a = 5 * 3"
Zog, or rather the ZPU is already a hybrid stack/register machine. Admittedly it only ever uses it's couple of registers ver rarely and they are actually defined in RAM space. But anyway pretty much any recent CPU architecture is a stack/register machine now a days.
Zog on the Z80. Easily done. Could be a tad slow as the ZPU is strictly 32 bit.
Finally, if you want to get really down and simple you only need a single instruction op code in a computer and hence only a single keyword in a high level language. Of course the keyword can be omitted because it's always the same:)
See this fascinating article on the "one instruction set instruction computer": http://en.wikipedia.org/wiki/One_instruction_set_computer
Here is a paper on actually building a single instruction computer and writing a compiler for it for a C like language: http://mazonka.com/st/lcss.pdf
...an Open Source, simple, fast and powerful programming language, easy to learn and to feel comfortable with, and a scripting engine ready to empower mission-critical multithreaded applications.
Falcon provides six integrated programming paradigms: procedural, object oriented, prototype oriented, functional, tabular and message oriented. And you don't have to master all of them; you just need to pick the ingredients you prefer, and let the code follow your inspiration.
I know it is a bit outdated, but I have a Standard Version of Visual Studio C++ 6.0 just sitting on the shelf and collecting dust. It would be the perfect software to tiptoe into C++, before jumping all the way in. I know it will work on your XP machine, but I have serious doubts about 8. Whatever the case, you could do some very serious programming with this software and learn a large portion of the interface, the various classes, the syntax, etc... I would be happy to just give it to you free of charge, but you must pay for the shipping
I know it is a bit outdated, but I have a Standard Version of Visual Studio C++ 6.0
Thanks for the offer. I rummaged round on my computer and I have this too. But thanks for the offer. I need to fire it up and see how it compares to C#.
code:blocks and widgets is pure C++ and it will be interesting to see how much one can copy and paste back and forth to visual studio C++.
I love brainstorming this stuff, heater!
Zog on the Z80 easy? Hey that sounds cool. I've got some boards that add a Z80 to a prop as a co-processor so it would be cool to think about such a thing. In a general sense, I guess it is emulating a 32 bit processor on an 8 bit one. The Z80 has too many instructions IMHO. 8080 is better with 256 instructions. Zog is better again. 1 instruction is a nightmare and I may find myself waking up in a cold sweat at 3am dreaming about one instruction code. Yikes!
Ok - emulators for the prop. Back in the day when C first started, memory was expensive. So you declared variables at the beginning of a function and threw them away at the end. But it takes time to create them and throw them away. It also takes away some determinism when memory is constrained as the code space grows and the stack space grows too. Maybe that is why so many routers need rebooting every few weeks? Anyway, could it be more deterministic to create variables but never throw them away? Maybe they are global variables, but for code neatness only the function that created them can use them? I'll have to think about that. I have done something already with the touchscreen where all strings are declared in external memory and there are routines to access them that make them behave as if they are in hub. Throwing away is a pain as it involves garbage collection, and what I realised when coding the touchscreen is there is so much memory that it is ok to even do awful things like declare all strings as 80 bytes long and only use 5 or 10 of those bytes. It could result in a speed increase as well if variables never need to be cleaned up or ram 'defragged'. . So if you are thinking of another emulator, how about a hybrid stack and register system? Declare a fixed number of registers, maybe 16, and call them r0-r15. That fits nicely into pasm. In code, these are the ubiquitous i,j,k variables that are used in loops. And yes, you have to be more careful not to reuse them. But generally they appear in nested loops on a single page of code so you can see if there are problems. If a nested loop contains a call to another function, ok, then you have to push all the registers onto the stack. But there are some things that stack computers do well and some that register computers do well, and given the constraints of pasm, having a number of variables that sit in a cog and don't need wrlong and rdlong could make for efficient code in some circumstances.
In a moment of frustration I thought I would design my own language. Famous last words. How about a language with hardly any rules at all. I was going to call it "dogs breakfast" as a result. Intriguingly, both Go and Processing seem to have many features of my new language. Maybe others are thinking along the same lines?
Noooooooooo.
I'm going to have to paraphrase OBC..."Projects NOT Languages!!!"
"Computing" and I use that term loosely I fear is on it's last leg.
We have reached a level of complexity where the language itself isn't really all that important, it's all the libraries and tools that go with it.
And that is the problem, all the plethora of libaries, tools, GUI controls, etc. are usually very poorly documented, if at all, and that leads to so much frustration that people find it easier too just build their own.
It seems a lot of this started with "javadoc", I really think whoever came up with that should at a minimum be drawn and quartered. You can see it as the point when documentation became horrid. The last useful "help" for Visual Studio was VS6, why? Because MS ripped of Java when they made .Net even to the level of copying the horrid documentation. Now docs look like some bad spec document that just list names of members and a little bit about parameters. They usually end up doing what a tech writer that I work with calls a cardinal sin; they define a word using the same damn word...
Anyway, what I 'm saying is because of the level of complexity we have reached in computing coupled with horrid documentation, people find it easier to just build something new. And all that leads to more complex and poorly documented stuff that leads to more....
Wiring and Processing are good because they abstract a lot of the ugly complexity that is in C++ and Java and make them usable for non professionals which is a good thing.
I see the same thing with mBed C/C++ compiler. It allowed a non-professionals to access a micro controller that was notoriously hard for non pros to work with.
Comments
http://qt-project.org/wiki/How_to_Use_QPushButton
In my experince C++ is a huge and complicated language and programs can soon become overwhelming. I don't think there is a single living human being who understands all the nuances of all C++ features. Perhaps I just haven't graspped the nack of keeping things under control and simple.
Qt add the signals and slots mechanism to C++ which complicates things further, but does a nice job of connecting GUI elements to actions. It just seems that needing to add signals and slots to the language and a preprocessor to compile it shows that C++ is flawed.
The Qt libraries are huge. So it can take a while to get your head around it all.
Still, even I with limitted C++/Qt experience managed to make a nice app fairly easily. Including networking and threads and OpenGl accelerated graphics.
I worked through some of the examples and found it easier to understand than the same stuff in C++:)
Shame I can't recall the author or title now.
qt looks alot more simple than a win32 skeleton, it c++ only? looks very oop and not c compatible?
You can use Python to build GUI apps with Qt. Your button application is only seven lines long in PyQt.
http://www.diotavelli.net/PyQtWiki/HelloWorld
And here is a nice tutorial:
http://www.cs.usfca.edu/~afedosov/qttut/
Sounds like just the ticket.
Heater a Go-Go?? Interesting!!
1) Nice and simple looking source code. Like they ironed out the ugly wrinkles from C and not that horrible, verbose, multi-linje object oriented uglyness of C++ or Java.
2) It feels like working with a scriping language like Python as the compilations are so fast but it has the type safety and error checking of a compiled language like Pascal or Ada.
3) Garbage collection. No more worries about who is going to delete which objects in a multithreaded program.
4) The biggy, concurrency. Very easy to create threads and have threads communicate. Those threads can be within a single processor or running on may cores in your multi-core machine.
5) Makes it very easy to create web servers, web services, websockets and a bunch of other network things. Which is something I have to do on a project now.
6) It's compiled so has C like performance.
That concurrency thing is also usefull for simplifying algorithms even if you don't really need parallelsism.
Check out golang.org. You can play with Go on line.
Sadly it has no means of creating GUI's yet.
Let's not forget perl!!
In addition to your items which I agree with, I like the way they handle modules and the library items. Just name a module if you are going to use it and just write the code and put it a module. None of those silly .h files that have the same declarations as the .c files.
I need to work more with it...too many other distractions going on.
There is a front end for Go for GCC so perhaps, possibly maybe, one day we will see Go on the Propeller. If those goroutines could start COGs that would be great. Eric has done that for the C compiler using OpenMP so it must be possible with Go. Go already runs on quite small systems sitting on top of the RTEMS operating system.
Visual Studio runs under linux?
I don't know for sure, but I highly doubt it. I was answering to the original post which said:
I see a sentence containing a statement with no implications, however a person could consider the context, so perhaps he may want the ide to run on that as well, but he does not specifically state that desire.
Yes I should have clarified that more. I don't have a dedicated linux box (mainly due to my desk space being filled up with propeller stuff!) so the next best thing is to run linux/ubuntu from virtualbox. It is more convenient that a dual boot box.
In a general sense, I guess what I am trying to do is future-proof code. I've ported huge applications from Quick Basic to VB5, only to find microsoft then moved to the .net framework and everything had to be rewritten again. There is an inbuilt obsolescence. But there is something bigger going on at the moment, and that is the movement to multiple platforms. I love the .net framework but it isn't going to work on linux or a mac or android or whatever is going to come along next.
It seems there are competing forces - on the one hand certain companies want to lock you into their system. Windows is one, but Macs seem even worse, and even within Linux there is a bit of a vibe of 'why would you want to run on any other platform?'.
But fighting against this are individuals and groups who want to run code on as many platforms as possible. If a new operating system comes along, these boffins are keen to get their code working on that platform. I don't think any one company is driving that - it seems a more open source movement than anything else.
So I guess this thread is not a question of "what is your favorite language". It is more about what language is likely to be around in 10 years time, running on multiple platforms, many of which don't even exist yet.
And for a more immediate and practical goal, I want to write some code to put a button on a screen, run that on a PC and then have the same program run on a propeller. That is a huge challenge and there are lots of bits of the puzzle to pull together but I think it is possible.
To my knowledge, there is nothing more powerful than C++, irregardless of the platform. If there is a difficult programming task to be accomplished, then C++ is the tool for the job.
Way back when, I played the cross platform game myself, in varying degrees. To put it bluntly, you will drive yourself nuts trying to satisfy everyone, and spend a lot of time, money, and effort trying to accomplish it. And if it is just a one guy operation, trying to accomplish it all, it will be constant screen and keyboard time. The best suggestion that I can give you is to define your target and don't just say everyone. When you have defined your target, then build the software to suit them. I have always chose Windows, because it had a large following, but then that was a different venue for what I was attempting. In other words, if I was to go back to writing software, I would target Window users that had a particular need for the software that I was going to create. I did not care that Mac users wouldn't be able to use my software, because the Windows user population is HUGE and I was familiar with the system. I figured let a Mac programmer create some similar software for Mac computers. I do not know what your own personal goals are, but if you are programming for self-gratification then pluck away until your heart is content by trying to cross platform. On the other hand, if your goal is to make money, then target one group of users, and design your software very well, instead of spreading yourself thin by trying to satisfy everyone. Once again, I say Visual Studio C++, and focus.
The IDE is the same as the Arduino IDE and it tries to simplify java in the same way the Arduino tries to simplify c
I really have to agree with the MSVC camp here though for a full featured setup, if platform cross compatibilty isnt an issue. I really wish MSVC worked on linux I hate to say it but this is one place commercial software excels MS makes great dev tools they are just setup to work on a bliated convaluted platform!
In a moment of frustration I thought I would design my own language. Famous last words. How about a language with hardly any rules at all. I was going to call it "dogs breakfast" as a result. Intriguingly, both Go and Processing seem to have many features of my new language. Maybe others are thinking along the same lines?
I started with the very simple idea that all keywords are classes. Take the BASIC loop
and compare with the C version
The C version looks more like a function. It almost could be if the "i++" were replaced with "1", and the receiving routine would know it was referring to "i". So we could start with a class called "loop" and a method in that function could be "for" and you could pass all the parameters like
Then you could add the .repeat .while .do and other loop functions to the loop class.
C starts off as a simple language and then adds things in libraries such as stdio and math. This takes the concept further and has even the most basic constructs of a language in libraries.
Maybe you need a few rules. Braces to do indents and signal the end of loops.
Here's one of my bugbears. = vs == vs :=
I have a theory that they are all different because the writers of the compilers were a bit lazy and wanted a way of distinguishing between "if a = b" and "a=b". I had an idea that you can bypass the whole argument by adding this as a new class. Thanks to the links above, take a look at what processing does
Go looks kind of similar too.
Why on earth do this? Well, some years back I wrote a compiler and it is good mental exercise and I feel like doing it all again *grin*. No, seriously, I want to get close to the metal for speed and I'd like a language that compiles easily. So, take the "equals" class which replaces == and think about it from a machine language point of view.
which in assembly is something like
Let's borrow something nifty from Spin - the ability to rename objects. So you might have the "compare." class and that is what you write in code, but in a folder you have a bunch of different files, eg compareZ80, compareSpin, comparePasm, compareC++, compareVB, and at the beginning you declare which one you are going to use.
Then, within that class, you write the code in whatever your favourite language is. It might be only one line of code. The aim is for a compiler to largely do a copy/paste of that code.
The IDE needs to have an autocomplete function any time it finds a . and it matches a library already declared. That makes learning the language much easier and saves rummaging around in .h files trying to find what it can do. (I'm borrowing that idea from vb.net where a few years back all string functions got deleted from the basic language. But they were reinstated with the strings. class which then could be used in C# as well. A neat example of the convergence of Basic and C).
So this is my crazy idea - a language that starts off with virtually no keywords at all!
Intriguing that Go and Processing seem to be working on the same idea.
Oh, and heater would like this - I'm also thinking of a virtual machine that is a hybrid stack/register engine, borrowing bits of Forth and bits of Zog as well. Actually, it might be easier just to use Zog. I wonder if we could get a Zog emulation on a real Z80...
Where this might be heading is the ability to write a program that uses a button class, so button.font, button.text, button.press and have an object which might be buttonc++ (maybe write that in Qt or code::blocks/wxsmith) but with one simple change at the beginning of the program to buttonLMMPasm, have that running on a propeller..
Or maybe I need to try to work out what is going on at the deep inside the GCC compiler which seems to have the same ugly hack I used in Catalina where you precompile pasm code then copy and paste it into C code as a completely unintelligible hex array. You can't use assembly because it isn't C, all the boffins correctly say.
More lateral thinking required!
All roads point to C++. Trouble is it's a huge and complex language in which you have to write verbose code that most of the world seems to be trying to get away from, hence Java, C# and so on. Having a language than runs on all the machines you want it to is only the begining of solving your problem, you still need all that GUI stuff working on all those machines and you'll probably want an IDE to do it in. I can't see any such system working on the Prop as well.
I wish we could stop calling refering to "Processing", "wiring" and so on as languages. They are in fact Java aand C++. Those other names more correctly refer to sets of libraries, run time support and IDE's.
Go has a lot in common with many other languages. I guess it has no features that have not existed in another language somewhere. However it does do a very good job of cleaning up that "Dogs breakfast", simplifying and slimming down the language with little in the way of redundant features.
Then you have a load of stuff that seems very "out there" I have to ponder on it....
As for the = vs == vs := thing. It's not because compiler writers are lazy it's because they are actually diffent things.
In C "= " is an assignment. In Pascal ":=" is an assignement. In C "==" is a comparison. Mathematically I think they are all wrong. In maths "=" is a statement of fact e.g. in "4 = 2 + 2" I am not assigning the result of "2 + 2" to "4" I am stating that it is so.
Anyway, In C I can write "A = B == C" and so on. I might want to actually write "if (a = b)" which is not a comparison but an assignment. Confusing and should not be done but there it is.
It get's even better. In Go we have:
"=" Is an assignment.
"==" Is a comparison
":=" will declare a new variable of the type of the thing on the right hand side and assin that value to it. So for example:
"a := 5 * 3" will create a new integer "a" and assign the value 15 to it. It's the same as "int a; a = 5 * 3"
Zog, or rather the ZPU is already a hybrid stack/register machine. Admittedly it only ever uses it's couple of registers ver rarely and they are actually defined in RAM space. But anyway pretty much any recent CPU architecture is a stack/register machine now a days.
Zog on the Z80. Easily done. Could be a tad slow as the ZPU is strictly 32 bit.
Finally, if you want to get really down and simple you only need a single instruction op code in a computer and hence only a single keyword in a high level language. Of course the keyword can be omitted because it's always the same:)
See this fascinating article on the "one instruction set instruction computer":
http://en.wikipedia.org/wiki/One_instruction_set_computer
Here is a paper on actually building a single instruction computer and writing a compiler for it for a C like language:
http://mazonka.com/st/lcss.pdf
Here is a slightly different single instruction computer approach:
http://www.chrisgreaves.com/SingleInstructionComputer/
I feel another emulator for the Prop comming on ...
Check it out!
Dog's breakfast incarnate.
Or there's always Factor
I know it is a bit outdated, but I have a Standard Version of Visual Studio C++ 6.0 just sitting on the shelf and collecting dust. It would be the perfect software to tiptoe into C++, before jumping all the way in. I know it will work on your XP machine, but I have serious doubts about 8. Whatever the case, you could do some very serious programming with this software and learn a large portion of the interface, the various classes, the syntax, etc... I would be happy to just give it to you free of charge, but you must pay for the shipping
Bruce
Thanks for the offer. I rummaged round on my computer and I have this too. But thanks for the offer. I need to fire it up and see how it compares to C#.
code:blocks and widgets is pure C++ and it will be interesting to see how much one can copy and paste back and forth to visual studio C++.
I love brainstorming this stuff, heater!
Zog on the Z80 easy? Hey that sounds cool. I've got some boards that add a Z80 to a prop as a co-processor so it would be cool to think about such a thing. In a general sense, I guess it is emulating a 32 bit processor on an 8 bit one. The Z80 has too many instructions IMHO. 8080 is better with 256 instructions. Zog is better again. 1 instruction is a nightmare and I may find myself waking up in a cold sweat at 3am dreaming about one instruction code. Yikes!
Ok - emulators for the prop. Back in the day when C first started, memory was expensive. So you declared variables at the beginning of a function and threw them away at the end. But it takes time to create them and throw them away. It also takes away some determinism when memory is constrained as the code space grows and the stack space grows too. Maybe that is why so many routers need rebooting every few weeks? Anyway, could it be more deterministic to create variables but never throw them away? Maybe they are global variables, but for code neatness only the function that created them can use them? I'll have to think about that. I have done something already with the touchscreen where all strings are declared in external memory and there are routines to access them that make them behave as if they are in hub. Throwing away is a pain as it involves garbage collection, and what I realised when coding the touchscreen is there is so much memory that it is ok to even do awful things like declare all strings as 80 bytes long and only use 5 or 10 of those bytes. It could result in a speed increase as well if variables never need to be cleaned up or ram 'defragged'. . So if you are thinking of another emulator, how about a hybrid stack and register system? Declare a fixed number of registers, maybe 16, and call them r0-r15. That fits nicely into pasm. In code, these are the ubiquitous i,j,k variables that are used in loops. And yes, you have to be more careful not to reuse them. But generally they appear in nested loops on a single page of code so you can see if there are problems. If a nested loop contains a call to another function, ok, then you have to push all the registers onto the stack. But there are some things that stack computers do well and some that register computers do well, and given the constraints of pasm, having a number of variables that sit in a cog and don't need wrlong and rdlong could make for efficient code in some circumstances.
Noooooooooo.
I'm going to have to paraphrase OBC..."Projects NOT Languages!!!"
"Computing" and I use that term loosely I fear is on it's last leg.
We have reached a level of complexity where the language itself isn't really all that important, it's all the libraries and tools that go with it.
And that is the problem, all the plethora of libaries, tools, GUI controls, etc. are usually very poorly documented, if at all, and that leads to so much frustration that people find it easier too just build their own.
It seems a lot of this started with "javadoc", I really think whoever came up with that should at a minimum be drawn and quartered. You can see it as the point when documentation became horrid. The last useful "help" for Visual Studio was VS6, why? Because MS ripped of Java when they made .Net even to the level of copying the horrid documentation. Now docs look like some bad spec document that just list names of members and a little bit about parameters. They usually end up doing what a tech writer that I work with calls a cardinal sin; they define a word using the same damn word...
Anyway, what I 'm saying is because of the level of complexity we have reached in computing coupled with horrid documentation, people find it easier to just build something new. And all that leads to more complex and poorly documented stuff that leads to more....
C.W.
I see the same thing with mBed C/C++ compiler. It allowed a non-professionals to access a micro controller that was notoriously hard for non pros to work with.