Blade Programming Language
Blade is a simple, clean, and embeddable dynamic programming language created to be simple enough for beginners, yet powerful and expressive for professionals. It has a very small syntax set with a very low learning curve. Blade improves upon the best features of JavaScript, Python, and Ruby to give developers a familiar and powerful system that feels native for developers coming from any of these languages and an easy way to leverage the strength of any.
Blade also comes with Nyssa, the official package manager, which makes it easy to install and manage packages and modules.
Features
- First-class package management: Package management is built into the language module system.
- Iterable classes: Blade has built-in support for iterable classes, making it easy to work with collections of data.
- Backend development: Blade can be used for backend development without any external dependencies.
- Function promotion: Blade allows for function promotion, making it easy to reuse any piece of code from an imported module.
- Default exports and imports: Blade supports default exports and imports, making it easy to organize code.
- Anonymous functions: Blade supports anonymous functions, making it easy to write functional code.
- Access modifiers: Unlike any of JavaScript, Python and Ruby, Blade supports access modifiers for variables, properties, functions, classes, modules, etc.
- Decorator functions: Blade supports decorator functions, making it easy to add functionality to existing code.
- Function overrides: Blade supports function overrides in classes, allowing a class to choose the result to return for a function if the function allows it.
- Easy to extend with C modules: Blade supports external extensions built in C, making it easy to extend the language with C modules.
Use Cases
Blade can be used for a wide range of tasks, including:
- Web development: Blade can be used to create web applications and web services.
- Data science: Blade can be used to perform data analysis and machine learning tasks.
- Scripting: Blade can be used to write scripts to automate tasks.
- And more...
Showcase
- Nyssa: The Nyssa self-hostable repository server and package manager is written in Blade.
- jsonrpc: A JSON-RPC library for Blade programming language.
- wire: Dynamic HTML template engine.
- tar: Pure Blade library for creating and extracting TAR archives.
Example
The following code implements a simple backend API that runs on port 3000:
import http
import json
var server = http.server(3000)
server.on_receive(@(request, response) {
response.headers['Content-Type'] = 'application/json'
response.write(json.encode(request))
})
echo 'Listening on Port 3000...'
server.listen()
How does it differ from Python and Ruby?
- First-class package management (Package management is built into the language module system).
- Iterable classes.
- Backend development without any external dependencies.
- Function promotion.
- Default exports and imports.
- Anonymous functions.
- Access modifiers for variables, properties, function, class, modules, etc.
- Decorator functions.
- Function overrides in classes β A class can chose the result to return for a function if the function allows it.
- Easy to extend with C modules with a familiar API to Wren.
Installation
To install Blade, please follow the instructions in the Building guide.
Usage
To start using Blade, please refer to the Tutorial guide in the documentation.
API Documentaion
API documentation for Blade which is under active development can be found at bladelang.com.
Community
- Join the conversation on Gitter
- Submit a feature request or bug report.
Contributing
Blade desires to make the community around it as friendly and welcoming as possible. Therefore, all forms of contributions from pull requests, suggestions, typo fixes in documentation, feature request, bug reports and any contribution at all is highly appreciated. Please refer to the Contributing guide for more information.
License
Blade is licensed under the 2-clause BSDL License.