Archive for June, 2010

Syntax

I’m pretty flexible when it comes to syntax, something I don’t like though is python’s. Specifically how their proponents say that you just use whitespace,which is totally wrong. Is the proper python if statement this?

if whatever

restofthestuff

or

if whatever:

restofthestuff

see what I did there? One has a colon, one doesn’t. Python has fewer things, but it certainly isn’t whitespace only. I have to admit that I like C-like syntax a lot, but it comes second to Ruby’s. It has a really simple syntax that’s a lot more readable AND as unambiguous as C. The lack of semicolons is also nice, since I *always* for get them…..well not always but you know what I mean. Either way I’m done for now.

Sorry

I haven’t been around and the freenet blog is nonexistant…The reason is that I lost the url for it since I switched back to my laptop. The blog is switching from every day to whenever I have something to write about

Java

So today I’m doing Java. I meant to do this yesterday but a lot was happening(blogs on mon/tues/wed will be slow/nonexistant too because I do school on those days.

So basically, like I was saying C# is pretty much Java with a patent trap attatched, both can run multiple languages(Java has more creativity though, you have Scala, Groovy….to the CLR’s Java clone, C++ clone, BASIC clone……)Both of them can be run from a browser(through Java(no idea right?) for languages using the JVM and Silver/Moonlight for CLR languages.) As much as GeekHeroComic has taught me, as a normally C/C++ programmer I’m ashamed that I don’t mind Java, I even like it. The verbosity can get on your nerves, and the forced OO even when you don’t need it feels a bit too….well forced, coming from the C philosophy of “Do whatever you want, you’re on your own when you mess up” But basically it’s a pretty nice language, I’m sure that Netbeans is great when it works too 😛 That’s pretty much it for today.

C#/Monodevelop

So today I figured I’d try Mono and C#. I know it’s currently a patent trap but I’m sure we all have *that* friend, the one who constantly babbles about how great both of them are and how C# totally isn’t Java. So now I’m reviewing both C#, and the IDE made specifically for Mono, monodevelop. So I did a quick apt-get for everything and popped over to msdn(MicroSoft Developer Network, if I remember correctly.) and I have to admit, C# is totally and completely different from Java, I mean look at how completely opposite these hello world lines are:

C#:
System.Console.WriteLine(“Hello, World!”);

Java:
System.out.println(“Hello, World!”);

See? Nothing in common at all. but I’m going to stop with the sarcasm for a moment and actually get into monodevelop and actually using C#.
Monodevelop is kind of confusing at first, it really is overwhelming. You open up, nice pretty splash screen, then a good intro page…..then you click new and then you freak out. First you must choose what *kind* of new, file or solution. Since I have no idea what a solution IS I chose file. After that you have a dialog with more choices, you get to choose between:
C
C#
CPP
Deployment
Misc
VBNet(WHY VB WHEN YOU HAVE NO VISUAL PART, WHY NOT SAY MONOBASIC?!)
Web
XML

I have an idea of what each of these things are but then it gets better, let’s assume you click on C#. Then you have THESE choices:
ASP.NET
General
Gtk
Misc

Again, I know what these are, but still…..now it gets even more fun, let’s click Misc and guess what? More choices. Now I have to choose between:
Empty Class
Empty Enumeration
Empty Interface
Empty Struct
Empty File

Following Java conventions I would have wanted empty class, but remember our little friend up there? Mr “C# it totally not Java”? Well thanks to him I’m now totally clueless and have to pick empty file….all that to open an EMPTY FILE. Then I go and want to run my program after writing it. Okay, compile test…available, compile all…not available, debug…available, stop..not available, but where’s Run? Well it’s not in the compile options silly, you have to do Run/Run. Just what I’ve always wanted, to go through another menu. That’s pretty much my experience for Monodevelop.

Back to C#, I like that they have namespaces, if you put using System; at the beginning of the C# program you can get away with just Console.WriteLine(“foo”); There are other things but it seems to me that everything in C# you could do in Java. Even that Common Language Runtime/Common Language Interface they talk about? You know, multiple languages in one runtime? Yeah…you can do that in java too, without the patent mess.

Gedit 😉

EDIT: It’s System.out.println not system.out.println

Scheme

tekkenfreak3@tekkenfreak3-wordpress$: cat blog.scm
(define editor “vim”)
(define first_language “scheme”)
(define interpreter “guile”)
(display “My language today is “)
first_language
(display “.My interpreter is “)
interpreter
(display “.And my editor, as promised, is “)
editor
(display “.In other news, the cable for my laptop came \\o/”)
(newline)
tekkenfreak3@tekkenfreak3-wordpress$:guile blog.scm
My language today is scheme. My interpreter is guile. And my editor, as promised, is vim. In other news, the cable for my laptop came \o/

Compiled Languages

Today, since yesteday was interpred languages I think I’m going to do compiled ones. A compiledlanguage, is by definition compiled to assembly code, and eventually to machine code.This is compared to an interpeted langauge, which is either interpreted directly by an interpreter, or more commonly today compiled to bytecode and then run.Bytecode is significantly faster than pure interpretation, which is why they do it. The most popular compiled language at the moment is C, or assembly technically(all compiled languages I’m aware of compile to assembly and then assemble into machine code.) C++ is a newer cousin to C, most C89(the previous C standard) is valid C++, it also adds namespaces and object oriented programming to the mix. Slightly older than C++ is Objective-C. Obj-C(often used because of the length of Objective-C) Is really as it’s name says, C with object orientation, I’ve never used it but I know that it’s the standard language for anything on an Apple platform and the GNUSTEP environment. Most recently is D, my favorite compiled language. D somehow manages to have a full garbage collector(we talked about them in the last blog) into a compiled language. Aside from that in my tests it’s actually FASTER than C++, of course you can still manage everything manually if you wish. The main barrier to D currently is libraries, though a few essentials(GTK+, OpenGL,Qt, others.) are available in some form of stability. The best examples I can give of D at the moment are the games by Kenta Cho. Go check them out now…seriously, especially Tumiki Fighters(No link because I refuse to make my blog preferable to my one on freenet, if I added a link it would cause them to cease to be anonymous, which is bad.) That’s pretty much all I have for today though.

-This post made in EMACS 23 for no reason in particular, next one will be VIM 😛

Edit: Fixed Qt, I had thought that it was officially without capitalization, my friend freemind corrected me on this

Interpreted Languages

Strangely enough, I LOVE programming. I also happen to do a lot of that programming in interpreted languages. Some say that they’re slow but I definitely like them because they’re so easy to write in and protoype with. Aside from that most of my stuff doesn’t really *need* all that speed. I’ve got to say that my favorite interpreted language is Ruby. I don’t know what I like about it so much but it’s as easy for me as python is for most people, maybe easier. Of all the interpreted languages I’d love to know more of, it’d have to be (lisp), specifically Scheme(There’s also common lisp but I don’t like it nearly as much, (format t “Print”) to put ‘print’ on the screen? come on.) I mainly want to learn about it because it was basically the first real interpreted language(lisp that is.) It’s been around since the 50’s and garbage collectors(The part of the interpreter that manages the memory so that you don’t have to like in C) were INVENTED for this language. It’s also a functional language that has a lot of chances for metaprogramming, two ways of programming that interest me a lot.

Note: This is taken from my freesite….