Simpler. E.g. there's only one way to declare functions, no need for declarations, only a single type of equality operators and no need for terminating statements with semicolons.
Less boiler-plate code needed. Move introduces a few carefully selected features like the "import" and "export" keywords, and @-shorthand for access.
A simple Move program which prints "Hello John" three times:
Same program as above, but using shorthand call-style:
Installing and using Move
For now, it's easiest to install Move using the Node Package Manager:
Then require the "move" module before requiring any move code. In this we load "foo.mv" which is a module written in Move:
There's also a simple API which can be accessed from the move module:
If you want to use move in a web browser, simply use and include the move.js file (no dependencies). Including this file will export a single global symbol called "move" () which contains the Move library (see ) including functionality for compiling and executing Move code as well as providing the ES5 normalizing but small runtime library. Have a look at for inspiration.
Functions are declared using one single expression: and can be called using either keyword arguments or positional arguments. Functions without arguments can be written as or (parenthesis are optional).
The last statement in a function is automatically returned.
Functions can be called using the syntax, passing arguments by name. This greatly increases code readability.
Functions can be called using the syntax, passing arguments in a simple succession. This feature allows Move to have a very limited set of language keywords and instead implement things like print, repeat, create, etc as regular functions. For instance, this allows for creating DSL-like extensions to the language.
When defining functions, any argument can be given a default value using either or . E.g. .
Variables are implicitly declared -- Move will automatically declare (i.e. "create and attach") a newfound variable in the scope which it first was used. The use of "var" produces a syntax error. A variable will only be declared if there's no variable with the same name which is reachable from the current scope (this is possible since the Move compiler is AST-aware).
No commas required to terminate expressions. Move will determine when a comma is needed so you don't have to (and the code gets more readable).
@-shorthand for accessing properties of the object. E.g. can be written as .
Importing CommonJS modules can be done using the statement. E.g. rather than the tedious boilerplate, you can write
Exporting CommonJS modules is aided by the statement. E.g. instead of writing you can write (or even if is defined elsewhere).
A small runtime library makes Move ES5 normalized even in non-ES5 environments. This means less feature probing and less boiler-plate code. Things like , and are all guaranteed to be available and function according to the ES5 standard.
Move is designed for humans which is the reason for why things like variable declarations and statement terminators has been removed -- they are simply not part of the essentials or essence of what a programmer should be thinking about. The computer is, or at least should be, better at deciding those things.
Move incorporates some third-party source, namely a derivation of UglifyJS. These sources have a separate license embedded into their heads.
The rest of Move is licensed as follows:
Copyright (c) 2011 Rasmus Andersson http://rsms.me/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Whats the difference between fabrication and falsification
- When will the elections take place
- Is ignorance a necessary evil
- What is 50 bucks in India
- What was your favorite class in college
- What are some good African American books
- Is SRM Chennai better than HBTI Kanpur
- Do all doctors get paid well
- Why are all Mustangs rear wheel drive
- Who provides good shifting services
- Which tyres are better MRF or Ceat
- Are ideas getting harder to find
- How difficult are class 3 trails
- How did Zen discover you
- How do I improve my FX trading
- How does Sungevity make money