Boo Have you seen?
Many will know that I am not a big fan of Python. Among the things I dislike are the slow implementation and lack of verification calls to static methods.
Well, I learned that I am not alone - that was evident in reality :-), and there is a community of developers who have created a new language based on Python but linked to. NET (or Mono, as desired say.) This is
Boo, and you can use it to develop programs seriously, for example using Mono on Linux.
An example:
import Gtk from 'gtk-sharp "
def
pres ():
print" Hello "def
exit (): print
" Chao! "
Application.Quit ()
Gtk.Application.Init () w = gtk.Window
("Example")
b = gtk.Button ("Presioname)
w.Add (b)
w.BorderWidth = 10
b.Clicked + = + = pres
w.DeleteEvent
out w.ShowAll ()
Gtk.Application.Run ()
To run the example, can use the shell directly Boo: 'Booi ejemplo.boo' , or can not be compiled: 'BOOC ejemplo.boo' , which generates an executable. NET 'ejemplo.exe'
An example session is:
As you see, is similar to Python using pygtk, but I think a lot simpler.
~ / devel / dotnet / boo / examples $ BOOC example.boo
~ / devel / dotnet / boo / examples $. / example.exe
Chao Hello!
~ / devel / dotnet / boo / examples $
The same code in Python would be:
import gtk from gtk import * def
pres (o):
print "Hello"
def output (a, b):
print "Chao!"
gtk.main_quit ()
w = Window ()
w.set_title ("Example")
b = Button ("Presioname)
w.add (b)
w.set_border_width (10)
b.connect ('clicked', pres)
w.connect ('delete_event', out)
w.show_all ()
gtk.main ()
Besides the fact that I prefer BorderWidth = 10 to set_border_width (10) , Boo has many other things I like:
- have verification of types, type inference to avoid unnecessary declarations. However, if you like, you can use untyped variables for specific things.
- uses "early binding", this means calls to methods are sought in compile time (and then during the JIT), not during execution. This is only possible thanks to the former.
- When compiled CIL code uses the same technology that implementing JIT. NET to run, making it a language quickly.
Finally, there is already a plugin for using MonoDevelop Boo develop, which means that the integrated debugger, the suggestion of code and template generation works. And more over, the generated code is cross-platform (if using gtk #, obviously).
If someone wants help to install on Linux using Mono ask.
0 comments:
Post a Comment