Skip to content

Instantly share code, notes, and snippets.

@TrainerGuy22
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save TrainerGuy22/2edee8402b17f00c5f48 to your computer and use it in GitHub Desktop.

Select an option

Save TrainerGuy22/2edee8402b17f00c5f48 to your computer and use it in GitHub Desktop.
#!/usr/bin/al
# This works for comments, so shebangs and stuff work.
# Dynamic if run via executable, but static if compiled to bytecode?
# Namespaces don't enforce package structure. If no namespace is specified, one will be created by package structure.
namespace test;
// This works for comments too.
// Anyway, semicolons are optional.
// Inside a namespace, you can divulge into the classes rather than adopt the entire namespace.
// String is a class in the namespace Std.Datatypes.
import std.datatypes.String
/*
Third way of making comments.
You can use {} on imports to select more than one in a single line.
Bash style.
*/
/*
Sidenote on the standard library. It should provide some access to most C functions,
most shell commands, and various other things.
For I/O, I really like node.js's I/O libraries. Maybe we can model our I/O module off
of them.
Also, should provide ways to create Al objects from JSON5 (would support normal JSON too),
XML (and it's HTML counterpart), CSS (yes, you read that right), and TOML. Should also be able
to make files in those formats from Al objects.
*/
import std.{Process,Stream};
/*
Al allows for functions outside of classes. They share many attributes.
If nothing is specified for return type, it defaults to void.
Method/Function Scope:
Default = See Public.
Public = Visible to file, namespace, and access from other namespaces.
Protected = Visible to file and namespace.
Private = Visible to file only.
Method/Function Parameters:
Const is kind of like final. It acts the same way as it's C counterpart.
Basically makes the parameter immutable within the scope, but dosen't
require the object being passed in to be constant. Can also be used like
final when assigning variables.
/*
private function saySomething(const String something) {
Process.stdout.printLine("I'm saying " + something "!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment