v0.5.0
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.)
- (Note
unit
is comparable nowchar
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 forint
type- Same for
uint
- Same for
- 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 ofassert
- Change name of Cons struct to
FooCons
(rather thanFooList
) - Change style of pointer-type to
T *
(rather thanT*
) - Generate
typedef
for function pointer types to fix invalid code generation issues
- Use
- Support ownership for better expressiveness
- Add
Own
moduleOwn<'T>
typeacquire
,release
primitives
- Support ownership check
- Add several standard libraries built on top of it
- Add
- Support more pointer types and primitives
- Add
OutPtr<'T>
andVoidInPtr<'T>
types - Change
__constptr<'T>
toInPtr<'T>
- Add ptr-of (
&&
) operator - Add
Ptr
moduleselect
,read
,write
nullPtr
,invalid
cast
,asIn
,asNative
distance
- Add
- 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
toRegion.run
__nativeExpr
etc. can now embed some expressions and types
- Fix an issue that
- 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 (overint
)
Standard Libraries
- Rename to
Std
(fromMiloneStd
) - 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
andtoLines
aren't binary-safe
CLI Tool
- Add
milone eval
subcommand milone
now definesNDEBUG
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 spawningfantomas
, 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 downloadsninja
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
- Source files are in
- No longer support
MiloneOnly
modules DocId
s 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 foldS -> 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)