Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Move Over Python: Entering a New Lever Age

DZone's Guide to

Move Over Python: Entering a New Lever Age

Sure, Python is kind of fun and kind of easy. And who wants to compile anyway. But some of us don't feel at home with the interpretive dance we must do with Python. As a C++ programmer I would like the simplicity of Python but with more leverage. Introducing: Lever.

· Web Dev Zone
Free Resource

Should you build your own web experimentation solution? Download this whitepaper by Optimizely to find out.

Lever is a new open-source language. And, by new I mean version 0.8.0, which I translate as "will have some odd features/bugs but may run for hours at a time without crashing". It promises all the flexibility that we've come to enjoy with Python yet it teases us with the power of raw native code and the promise of stand-alone executables.

I can't claim to have used Lever for any projects and I'm not at this point endorsing it, but the idea seems quite intriguing. First of all, Lever promises the simplicity and naturalness of Python as well as execution speed improvements similar to the just-in-time compiling provided by PyPy. But adds some tricks of its own, and these are the ones that caught my attention.

Because it compiles into an executable it lends itself to using other compiled libraries. This early version of Lever supports the easy inclusion of existing C libraries:

sdl = api.library("libSDL2")
sdl.Init(sdl.INIT_EVERYTHING)
sdl.Quit()

Dare we say that we can Lever-age the power of our existing C code? (Sorry)

Lever supports the scoping of modules. All of the loaded modules are not required to go into a single global object.

There is also a built-in event loop syntax that makes your asynchronous code smaller, cleaner and much more readable. And my guess is that this new asynchronous syntax will help with the development of concurrency because the code looks nearly the same whether it "waits and continues" or whether it "triggers a call back". All you need to do to add the call back support is to add the callback function name to the event call. And of course you must still write the callback function, but the point is that this can be more easily deferred in your development process.

There is an active Lever development community and you can get more details here. Lever has its home on GitHub. And they've done a nice job of pairing the new language with the relatively new cross-platform editor environment from Microsoft called Visual Studio Code.

I usually resist the introduction of yet another programming language, and I don't know if Lever will succeed, but if it does I think it will offer a useful bridge between academic research based on Python and production code based on C/C++. Here's hoping.

Implementing an Experimentation Solution: Choosing whether to build or buy?

Topics:
python ,lever ,programming languages

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}