Skip to content

v0.5.0

Compare
Choose a tag to compare
@vain0x vain0x released this 21 Jul 14:24
· 344 commits to main since this release

This release is made because of its size:

  • 9 months have passed since the previous release
  • many changes have happened.

The milone-lang isn't still practical nor production-quality. Even language design is incomplete, especially expressiveness of side-effect. Build system, C-interop, LSP server need more works. I'm exploring the way for the language to grow.


From CHANGELOG:

Documentation

  • Rewrite README
  • Update ARCHITECTURE
  • Add Glossary
  • Add documentation for:
    • Syntax
    • Name resolution (incomplete)
    • Arity check
    • AST bundle
  • Add design policy
  • Add developer notes

Language Features

  • Improve syntax:
    • Support hex escape in quotes
    • Support integer suffix
    • Parse fun expressions in arguments better
    • More strict syntax for < token (space-sensitive)
    • Fix precedence of binary operators for compatibility with F#
    • Unreserve some of keywords as unreserved in F# 4.1
  • Improve type checks:
    • Fix lots of incorrect type checks
    • No longer nested functions are generic
    • No longer type variables are unified with particular types (unlike _ types are)
    • Resolve trait bounds before generalization as possible
    • Support equality for built-in types: list, option, tuple and discriminated union
      • (Note open Std.Equal is required to enable this feature.)
    • unit is comparable now
    • char is now convertible only from/to 8-bit integers to avoid incompatibility with F#
    • option is defined as a discriminated union now (which is still built-in type, almost non-functional change)
    • Result is a new built-in type (which is also defined as a discriminated union)
  • Improve transformation:
    • Small generic unions can now be unboxed
  • Improve code generation:
    • Use int32_t type from C for int type
      • Same for uint
    • Top-level expressions are generated in C file of that module (rather than collected into single module)
    • Fix an issue of __nativeType containing spaces
    • Emit a directive to include <milone.h> (rather than "milone.h") to search system directories
    • Emit __nativeDecl in more suitable order
    • Emit verbose, context-preserving symbol names for more stable compilation outputs
    • Inline if statement in use-site of assert
    • Change name of Cons struct to FooCons (rather than FooList)
    • Change style of pointer-type to T * (rather than T*)
    • Generate typedef for function pointer types to fix invalid code generation issues
  • Support ownership for better expressiveness
    • Add Own module
      • Own<'T> type
      • acquire, release primitives
    • Support ownership check
    • Add several standard libraries built on top of it
  • Support more pointer types and primitives
    • Add OutPtr<'T> and VoidInPtr<'T> types
    • Change __constptr<'T> to InPtr<'T>
    • Add ptr-of (&&) operator
    • Add Ptr module
      • select, read, write
      • nullPtr, invalid
      • cast, asIn, asNative
      • distance
  • Improve primitives:
    • Fix an issue that string : bool -> string didn't work at all
    • Add __discriminant
    • Add sizeof<'T>, remove __sizeOfVal primitive in favor of this
    • Rename inRegion to Region.run
    • __nativeExpr etc. can now embed some expressions and types
  • Support provisional manifest files (milone_manifest)

Runtime Library

  • Reduce headers included in milone.h
  • Heaps are now stored in thread-local variables (rather than static)
  • Rename most of functions
  • Prefer uint32_t for size/length/capacity (over int)

Standard Libraries

  • Rename to Std (from MiloneStd)
  • Add modules:
    • StdAssoc
    • StdError
    • StdIter
    • StdJson
    • StdList
    • StdLoop
    • StdMultimap
    • StdNativeInterop
    • StdOption
    • StdPair
    • StdResult
    • StdTesting
    • Own
    • Ptr
    • Region
    • IO, File, Path, OsString
    • Vector, ByteVector, Block, Box, HashMap
    • StringBuffer
  • Add functions:
    • Option.fold
    • List.takeWhile
    • StdChar
      • evalDigit, evalHex
    • StdString
      • cut, cutLast
      • format
      • toLower, toUpper
      • lowerFirst, upperFirst
      • split, splitAt
      • stripStart, stripEnd
      • parseHexAsUInt64, uint64ToHex
      • StringExt
        • asPtr, etc.
  • Change StdMap.TreeMap to a generic union (from a synonym)
  • Fix an issue that StdString.cutLine and toLines aren't binary-safe

CLI Tool

  • Add milone eval subcommand
  • milone now defines NDEBUG macro on release build as convention of C compilation
  • Outputs of runtime library are now written in the target directory (rather than source directory of runtime library)

LSP Server

  • Support find references for more kinds of symbols: variants, fields, types and modules
  • Support textDocument/documentSymbol
  • Support textDocument/completion
    • module names in open/module declarations
    • local values
  • Support textDocument/codeAction
    • "Generate module head"
    • "Generate module synonym"
    • "Generate open"
  • Support textDocument/formatting (by spawning fantomas, an F# formatter)
  • Improve ranges of diagnostics
  • Improve error handling, report failed requests
  • Detect projects created after starting a server
  • Fix an issue that sever doesn't work on Windows due to Windows-style pathnames

VSCode Extension

  • Rewrite syntax definition for better highlights
  • Run LSP server with limited heap size to workaround out-of-memory issue

Build Chain

  • Migrate to .NET 6 (from .NET 5)
  • No longer require busybox
  • Installation script for Linux now requires curl and automatically downloads ninja binary

Internal Changes

Compiler:

  • Change directory structure
    • Source files are in src directory, including scripts and runtime library
    • Projects for types and functions are separated for less dependencies
  • No longer support MiloneOnly modules
  • DocIds are interned as Symbol
  • Passes run per module as possible
  • Move works about type check from name resolution to the Typing module
  • Redesign name resolution, introduce IR for name resolution (NIR)
  • Map of non-static variables are split into modules
  • HIR no longer has visibility of symbols and rec modifiers
  • Rewrite monomorphization algorithm for more efficiency
  • Change parameter order
    • S -> T -> S for fold
    • S -> T -> T * S for map-fold
  • Remove intermediate type information from MIR expressions

LSP server:

  • Use fixed-sized intermediate buffer for simplicity
  • Rewrite concurrent part for better cancellation supports
  • Decouple from .NET and side-effect functions for tests and porting to milone-lang
  • Add tests a bit

Nursery:

  • nursery/CmdLspServer project has started (not working though)
  • nursery/ExDyLib as experiment of interop with Rust

Suspended works:

  • Fixing type check of recursive functions (difficult)
  • Compiling pattern matching in better way (difficult)
  • Designing SSA-style IR (difficult)
  • Serializing (caching) compilation results (Writing in JSON makes too large outputs. It needs to switch to an appropriate binary format.)
  • Adding clone primitive for lower memory usage peak (less priority)
  • Improving test scripts (less priority)