Genie (programming language)

Genie is a modern, general-purpose high-level programming language in development since 2008.[1] It was designed as an alternative, simpler and cleaner dialect for the Vala compiler, while preserving the same functionality of the Vala language. Genie uses the same compiler and libraries as Vala; the two can indeed be used alongside each other.[2] The differences are only syntactic.

Genie
Paradigmmulti-paradigm: imperative, structured, object-oriented
Designed byJamie McCracken
First appeared2008 (2008)
Stable release
0.38.8 / February 15, 2018 (2018-02-15)
Typing disciplinestatic, strong
OSCross-platform (every platform supported by GLib)
LicenseLGPLv2.1+
Filename extensions.gs
Websitewiki.gnome.org/Projects/Genie
Influenced by
Python, Boo, D, Object Pascal

Genie's syntax is derived from numerous modern languages like Python, Boo, D and Delphi. In the vein of Pascal and Python, Genie uses indentation rather than curly brackets to delimit blocks.

Like Vala, Genie uses the GObject type system to create classes and interfaces declared in Genie source code, without imposing additional runtime requirements (i.e., unlike Python, Java or C#, it does not require a virtual machine).

Genie allows access to C libraries, especially those based in GObject (like GTK), without using a different application binary interface (ABI). During compilation, the code is first translated to C source and header files, which are then compiled to platform-specific machine code using any available C compiler like GCC, thus allowing cross-platform software development.

Programs developed in Vala and Genie don't depend on the GNOME Desktop Environment, usually requiring only GLib.

Code samples

"Hello World"

This sample explicitly uses four spaces for indentation.

[indent=4]

init
    print "Hello, world!"

Objects

With no explicit indentation declaration, the default is tabs.

class Sample

	def run()
		stdout.printf("Hello, world! \n ")

init
	var sample = new Sample()
	sample.run() 

Critique

As of 2013, Genie for loops are inclusive, which makes handling of empty lists cumbersome[3]:

var l = new list of string
if l.size > 0
    for var i = 0 to (l.size - 1)
        print l.@get(i)

However, the lists can be iterated using for-in construct easily and straightforward[4]:

var l = new list of string
for s in l:
   print s
gollark: I have 34Mbps up, 8Mbps down, which is not ideal but usable.
gollark: Some people don't even have a publicly routable IP.
gollark: Also CGNAT now.
gollark: Like I said, it's not really very hard to do that (at least at a small scale, making stuff run with the volume of data Facebook deals with is a different issue), the hurdles are more, er, social and possibly legal.
gollark: The average person really does not want to do anything remotely complicated with a computer, which is problematic, and it doesn't really *help* that a bunch of stuff (down to the balance of upload/download speeds available on home network connections) on the internet is set up now to encourage using big walled gardens and discourage running your own stuff.

References

  1. Jamie McCracken (2008). "Introducing Genie - the smart programming language". Archived from the original on 2011-08-18.
  2. Using Genie and Vala together
  3. Tal Liron (11 January 2013). Genie. Event occurs at 32:29.
  4. https://wiki.gnome.org/Projects/Genie#Lists_.28Gee.27s_ArrayList.29
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.