5 Programming Languages You May Not Have Heard Of

By | January 10, 2019


Before the Web became ubiquitous, it was difficult to promote a new programming language. The most popular ones were either pushed by a manufacturer (such as Fortran, originally developed by IBM in the 1950s) or spread fortuitously through word-of-mouth (C, C++).

Still others, more notably BASIC and Ada, emerged from universities or government institutions, but their audiences often remained small and esoteric.

The internet changed all that. Now anyone can not only publish their own language (complete with compiler or interpreter); they can promote it through a variety of forums and code repositories. Ruby, Python, and PHP all spread thanks to the Web.

But even with the Web powering awareness, there are some languages that aren’t mainstream and you probably haven’t come across them. Nonetheless, they’re worth a quick look. Specifically, we’re referring to Gravity, Imba, Viper, Morfa and Objeck. Is there anything that might compel you to use them? Let’s examine them.

Gravity

Gravity is an MIT-licensed open-source programming language intended for iOS and Android development. It supports OOP, procedural and functional programming. It has a syntax a bit like Swift (as a “modern” language, it supports lists, maps, and functions as first-class objects and closures). Like Python, all variables are objects. Here’s an example of a class:

    class Italy {
        var population = 60656000;
        var area = 301340; // in km2

        func density() {
            return population/area;
        }
    }

    func main() {
        var it = Italy();
        return it.density();    // returns 201
    }

If Swift didn’t exist, then I think Gravity would have more momentum. Though open-source, it’s part of the Creo commercial project.

Imba

Another open-source project, Imba is used for creating web applications. It has adopted its own virtual DOM (just like React and some other libraries do), only it’s claimed to be up to twenty times faster.

Inspired by Ruby and Python, it compiles down to JavaScript and works with existing JavaScript libraries. Unlike, say, CoffeeScript, Imba is not just a different dialect of JavaScript. Here’s an example that accepts input and then adds the input to a list.

tag App
	prop items

	def addItem
		if @input.value
			items.push(title: @input.value)
			@input.value = ""

	def toggleItem item
		item:completed = !item:completed

Imba.mount

<input@input>

    for item in items

  • item:title

I was very impressed with the inline examples and the use of Scrimba for interactive tutorials. If you are into JavaScript, then this could be well worth a look. You can try out Imba in the Scrimba.com online interactive screencast learning platform.

Vyper

Vyper targets the EVM (Ethereum Virtual Machine). Ethereum is a cryptocurrency platform that lets you sell or buy Ether (the crypto-currency, not the chemical!). The main language used on Ethereum, Solidity, has proven useful for “smart contracts,” but some dissatisfaction and security concerns have led to the development of Vyper, which is based on Python (with stronger typing, including support for units of measurement). Here’s part of an example:

@public
def transferFrom(_from: address, _to: address, _value: int128(uint256)) -> bool:

    if _value <= self.allowed[_from][msg.sender] and 
       _value <= self.balances[_from]:

        self.balances[_from] -= _value  # decrease balance of from address.
        self.allowed[_from][msg.sender] -= _value  # decrease allowance.
        self.balances[_to] += _value  # incease balance of to address.
        log.Transfer(_from, _to, convert(_value, 'uint256'))  # log transfer event.

        return True
    else:
        return False

Morfa

Loosely based on the open-source language D, Morfa is a general-purpose language that can be used as a substitute for C++, Java or C#. It combines OOP and functional programming and generics. Quite surprisingly, it includes REPL (Read-Eval-Print loop), so you can try it out without needing a full edit-compile-run cycle.

Morfa includes language features that let you create Domain Specific Languages (DSL). These features include operator overloading and user-defined operators, quoting operators, higher-order functions, properties and constants and more. You can create code like this, in the example of creating matrices:

var A = m [1.0, 2.0];
var B = m [A     | 
          2 * A ];
var C = m [B,        eye(2) |
          zeros(2), B      ];

Morfa uses LLVM to generate fast code. The benchmarks suggest that, for most applications, it is comparable with C# on Mono and sometimes C/Java in terms of CPU performance. What is a little odd, however, is the licensing, which is GPL 3 for the Morfa compiler, interpreter, shell and C interface generator… but three-clause BSD for the standard library.

Objeck

Objeck has been around since 2008. It started as a test bed for Object Oriented Programming. The current version is 3.1, and includes libraries that provide support for JSON, RegEx, XML, CSV and database access, as well as HTTP and HTTPS web clients.

The RosettaCode website shows different language solutions to the same problem on each page. It currently has 265 pages containing an Objeck solution, and viewing it is probably the best way to get a feel for the language.

This example is on the “100 doors” page:

bundle Default {
  class Doors {
    function : Main(args : String[]) ~ Nil {
      doors := Bool->New[100];
 
      for(pass := 0; pass < 10; pass += 1;) {
        doors[(pass + 1) * (pass + 1) - 1] := true;
      };
 
      for(i := 0; i < 100; i += 1;) { IO.Console->GetInstance()->Print("Door #")->Print(i + 1)->Print(" is ");
        if(doors[i]) {
          "open."->PrintLine();
        }
        else {
          "closed."->PrintLine();
        };
      };
    }
  }
} 

Objeck is cross-platform, with 32/64 bit downloads. It’s open source and located on Github.

Conclusion

New hardware platforms such as smart speakers, wearable computing devices and the Internet of Things (IoT) all need to be programmed, and no existing programming language is perfectly suited. Add in cryptocurrencies, browser technologies, machine learning and there’s always going to be a need for new languages.

For example, twenty years ago, it was mainly Pascal that used the variable : type syntax (such as a : integer); C, C++, and Java all used type variable syntax (such as int a). But since then, Go, Rust, Kotlin, Swift, Scala, Gravity, Morfa and Nim have all emerged, and all use the same order as Pascal in declarations. Technology is contantly evolving, and today’s niche programming language could become tomorrow’s juggernaut. With that in mind, it’s worth paying attention to the small, interesting languages—they could someday become a very big deal.

The post 5 Programming Languages You May Not Have Heard Of appeared first on Dice Insights.



Source link