Skip to content

Instantly share code, notes, and snippets.

View PhilipWitte's full-sized avatar

𝔉𝔦𝔩𝔴𝔦𝔱 PhilipWitte

View GitHub Profile
# syntax:
# [key] <name> [attributes] [types]
type Sprite
{
var pos Vector
var rot Rotation
}
type Ship Sprite
@PhilipWitte
PhilipWitte / gist:5017538
Last active December 14, 2015 02:59
Reign Language Goals
type Person
{
var name : text
var age : uint
init new(.name, .age=)
init load(path) { # load from path # }
func greet()
{
@PhilipWitte
PhilipWitte / gist:4974439
Last active December 13, 2015 20:59
The "Perfect" Programming Language

The "Perfect" Programming Language

Assertions

  1. The easier to learn, the better.
  2. Best if easy to mentally parse "at a glance".
  3. Easy to understand structure "at a glance".
  4. Easy to type.
@PhilipWitte
PhilipWitte / gist:4969024
Last active December 13, 2015 20:18
Factory syntax
type Foo =
value : int
init Foo.new(v) =
value = v
proc Foo.bar =
echo(value)
proc main =
@PhilipWitte
PhilipWitte / gist:4962255
Last active December 13, 2015 19:19
dynamic array problem
func main()
{
var nums = text[] # a dynamic array
ref n : text # a 'int' reference
nums += "foo" # add "foo"
nums += "bar" # add "bar"
nums += "baz" # add "baz"
n => nums[1] # 'n' refers to 'num[1]'
@PhilipWitte
PhilipWitte / gist:4962210
Last active December 13, 2015 19:19
Memory Safety
type Foo
{
var bar = 0
}
func main()
{
ref f : Foo
ref b : int