About | Current Release |
---|---|
Version | v1.3.0 |
Date | February 17, 2018 |
Platforms | macOS, Linux (Ubuntu+), Cygwin |
git clone https://github.com/AbePralle/Rogue.git
cd Rogue
make
NOTES
-
Running make will compile the
roguec
compiler from C++ source and create the executable script/usr/local/bin/roguec
-
Run
roguec
by itself for options. -
Execute these shell commands for a simple test:
echo println '"Hello World!"' > Hello.rogue roguec Hello.rogue --execute
Rogue is released under the terms of the MIT License.
-
Many changes were not logged here. See commit history for more details.
-
[Makefile] Removed
Source/RogueC/Build
from repo and addedSource/RogueC/Bootstrap
containing aC++
version of RogueC sufficient to compile the currentRogueC
source. NormallyBootstrap/
is only used for the first compile androguec
thereafter reflects the version inBuild/
. You canmake bootstrap
to recompileroguec
from the bootstrap andmake update_bootstrap
to copy over the latestBuild/
version to be the newBootstrap
version. -
[Math] Added
Degrees.clamped(min:Degrees,max:Degrees)->Degrees
that constrains an angle to the given arc, operating correctly regardless of positive/negative multiples of 360, etc. AddedRadians.clamped(...)
as well. -
[RogueC] Removed special handling of array
count
; now using a standard native macro instead. -
[Rogue] Added
[mutating]
method attribute which, when used a a compound or primtive method, passes the context by reference so that changes to compound properties or primitivethis
made within the method will be reflected in the original compound or primitive. -
[RogueC] Methods no longer maintain a
locals:Local[]
list, making it much easier to dynamically add and remove locals viaCmdLocalDeclaration
command nodes.Method.locals()->Local[]
can be used to fetch a list of all locals (including parameters) but it is dynamically generated on-demand using a Visitor. -
[RogueC] 'print' and 'println' are more robust when it comes to parenthesized expressions.
-
[RogueC] Consolidated all extended visitors in
Visitors.rogue
. -
[RogueC] Removed stray instance of a compound argument being unnecessarily wrapped in a
ROGUE_ARG()
. -
[RogueC]
enum
types are now properly namespaced within their module. -
[RogueC] Fixed error messages to include method candidates once more.
-
Merged pull requests #16-20 from MurphyM.
-
Tuples, New template method specializer inference, rewritten routines, multithreading, alias parameters, Cython fixes
-
Tuples: Two or more comma-separated, parenthesized types are convenience syntax for a tuple type.
(Int32,String)
is shorthand forTuple<<Int32,String>>
. -
Tuples: Destructure tuples with
local (a,b) = tuple
or use existing variables(a,b) = tuple
. -
Tuples: Tuple elements can be accessed individually with
tuple._1,
,tuple._2
, etc. -
Destructuring in forEach; tuple-like protocol; tuple-list/optional expressions
-
stdlib: TableEntry supports tuple-like protocol. This lets you do forEach((key,value) in table.reader).
-
Add destructuring of tuple-like protocol. Things that have tuple-like properties or getters can now be used with destructuring assignment.
-
Allow tuple lists/optional in expressions. This allows things like "local v = (Int32,Int32)[]" to work.
-
Allow destructuring forEach control variables. This doesn't handle all variations of forEach, but we can add additional types later following this same approach.
-
Cython: Expose methods on Global globally
Previously, to access members of the Rogue Global object from Python, you had to do so explicitly (mod.Global.foo()). But now that routines are methods on Global, this meant that you had to do so for routines, which seemed unfortunate. This commit exposes methods on Global as the module level in Python. In particular, this means routines act like they used to (mod.foo() works again for a routine named foo).
-
Cython: Fix wrapping of template methods
-
Remove remants of old routine implementation
-
Make routines global methods of Global
This significantly simplifies routines by just turning them into global methods of Global. The normal Global access mechanism means you don't need to qualify their names, and since they're now just methods, the normal method template stuff just works. A subsequent commit will remove some of the special cases previously required for routines.
-
stdlib: Add Atomics
-
stdlib: Add Thread
This is the first version of the Thread class and various utility classes for multithreading.
-
New method template specifier inference
Previously, method template type specifiers could be inferred from method arguments in very limited cases (method templates with only a single type specifier when all method arguments had a common type). This commit makes template inference far more flexible and (hopefully) lays groundwork to make it even more flexible.
This currently only works for method templates -- routine templates have the same constraints as before (though this should probably be addressed).
-
First step towards Tuple implementation (see RAP1)
-
Add alias parameters
Adding a "@" to the end of a type in a parameter list now makes it an alias parameter, which is akin to a C++ reference. This means that whatever you pass in for the parameter must be something like a variable.
A limitation of the current implementation is that references and array elements cannot be aliased in the "auto" GC mode.
This commit also ends support for changing GC modes by editing the output C++; you now need to recompile the Rogue.
-
Add GC roots for thread local storage
Apparently the BDW garbage collector doesn't look at thread local storage for roots automatically. So now we tell it where to look. This involves a few things:
- Write all the thread local variables which might be GC roots out next to each other, with the assumption that the C++ compiler will actually put them in memory contiguously. These are the variables which are either references or are compounds which contain references (or contain compounds which contain references..).
- On thread init, tell the GC to add the range as roots.
- On thread de-init, tell the GC to remove the roots -- this required adding thread de-init, which we didn't have before.
-
Type: Add .contains_reference()
This helper returns true if the given type has properties which are references or which contain references.
-
StringBuilder: Make work buffer threadLocal
This commit uses conditional compilation to make the work buffer threadLocal when compiling with multithreading or not threadLocal otherwise. This shouldn't really be necessary -- if not compiling for threading, [threadLocal] should have no real effect. The reason it's done here is for the sake of bootstrapping, since old versions of roguec would choke on the property attribute. Someday we can get rid of the conditional compilation.
-
Add [synchronized] methods
These are like Java synchronized methods.
Unlike Java, where all objects always come with a lock, we add a lock to a class hierarchy wherever the first synchronized method is. Also unlike Java, we currently only support these for instance methods (though we could add them for global methods too...).
-
Add [threadLocal] global properties
This works by collecting global properties with a new [threadLocal] attribute and putting them into an init_class_thread_local() method instead of init_class(). Then it generates a Rogue_init_thread() which calls all of these and should be called by every new thread (it's automatically called by Rogue_launch()).
This commit also prevents the generation of empty init_class methods, which could happen previously if there were global properties but none had initial values.
-
Add per-property attributes
Individual properties can now have attributes. The attributes list should follow the property name immediately (before any initial value or type.
-
Add "section level" attributes to METHODS and PROPERTIES
A previous commit added the ability to put attributes on the GLOBAL PROPERTIES section itself. We now can put them on both global and non-global properties and methods sections. This allows, for example, having a section for synchronized methods.
-
Add "section level" attributes to GLOBAL PROPERTIES
Global properties can now have attributes applied to them, e.g. "GLOBAL PROPERTIES [someAttribute]"; the properties apply to all the properties in the section. This same methodology can be applied to other sections (e.g., METHODS).
-
native: Make call stack tracing thread-local
The call stack tracing definitely needs to be thread-local! It'd be nice if we had a way to look at the traces from other threads, but we can leave that for the future.
-
Add Preprocessor symbol THREAD_MODE
The previous commit added the preprocessor definition DEBUG, which is true when compiled with --debug. This is similar, but it reflects the thread mode. It's 0 when compiled without threading, or some number otherwise (e.g., 1 = pthreads).
-
Add Preprocessor symbol DEBUG
You can now do conditional compilation in Rogue that depends on the value of debug_mode (e.g., set by the --debug argument).
-
CPPWriter: Remove an extra space (cosmetic)
-
native: Add marker at end of NativeCPP.cpp
When looking at the output of the Rogue compiler, this makes it easier to tell where NativeCPP.cpp stops and the generated code begins. This mirrors NativeCPP.h.
-
native: Adjust indenting of segfault handler
This was inconsistent with the rest of the file
-
Add --help
-
Add --threads argument
This doesn't actually do much yet, but there's now a way to specify what multithreading features you want, the mode is written into the output header file, and if we're compiling the output C++, we tack on necessary commandline arguments.
- [String]
String.capitalized()->String
now capitalizes the first letter no matter how far it is into the string - useful when capitalizing strings starting with quotes or other punctuation. - [RogueC] Compiler now properly supports inherited native properties with meta markers that refer to base class template type parameters.
- [RogueC] Fixed command tree resolve bug exposed by compiling with
--essential
.
- [enum] Added operator support for modulo (
%
). - [List] Added utility method
List.expand(additional_count:Int32)->this
which adds additional null/0/false elements. - [RogueC] Preprocessor now allows and logicalizes integer values for conditional compilation directives; e.g.
$if (N)
for any non-zero value ofN
is equivalent to$if (true)
.
- [enum] Comma-separated enum categories are now supported.
- [enum] Implicit typing now works with enumeration categories in more places - for example, a propery can be declared as
state = State.START
rather than requiringstate = State.START : State
.
- [enum] All enums now have a
to->Logical
method that returnstrue
whenvalue != 0
. - [RogueC] An attempt to logicalize a compound, either explicitly with the
?
operator or implicitly by using it as anif
condition etc., now requires that either methodType.to->Logical
or global methodType.operator?(Type)->Logical
be defined.
- [Rogue] Added new
enum
types, described further here: https://github.com/AbePralle/Rogue/wiki/enum
- [Rogue] Access commands now attempt to resolve to locals, properties, and then global properties, in that order. This allows properties to shadow global properties and locals to shadow either.
- [forEach] Changed the behavior of
forEach (... in/of <collection>)
. When used with a collection that implements thecount
/get
interface, Rogue now caches the collection count before the loop starts rather than polling the count every iteration, improving loop execution speed. - [forEach]
forEach
now accepts afrom
clause after a random access collection. For example,forEach (n in list from 1)
andforEach (n in list from 0..list.count-2)
. - [GLOBAL PROPERTIES] Global properties are now visible to extended classes as one would expect.
- [Dim] Added
Dim
utility class for creating fixed-size multidimensional lists. E.g.Dim<<Int32>>(3,4)
creates anInt32[][]
of 3 by 4 dimensions, all initialized to the defaultInt32
value of 0. Specify 1 to 3 dimensions with 1 to 3 integer parameters. An additional function parameter may be sent which accepts either zero argumemts or one integer index for each dimension and returns the element that should be place at the corresponding spot. For exampleDim<<Int32>>(3,4,()=>-1)
returns a 3x4 2D list initialized with-1
in all elements.Dim<<Int32>>(3,4,(i,j)=>i*10+j
returns a list initialized with element[0]
containing[0,1,2,3]
and element[1]
containing[10,11,12,13]
.
- [RogueC] Fixed
global
vars to work correctly when declared without an initial value. - [RogueC] Fixed
global
var assignment resolution bug. - [RogueC]
global
vars can now only be declared in global scope outside of class definitions.
- [Method Templates] Revamped method templates system. Templates can now be overloaded and single type parameters can be inferred. Fixed errors calling global method templates. As before, method templates can be overridden by methods with generic and/or specialized type parameters - for instance,
method m<<$DataType>>
can be overridden withmethod m<<$DataType>>
and bymethod m<<Int32>>
. - [Rogue] Changed augment section label syntax from
<<label_name>>
to<label_name>
. - [Rogue] Changed syntax for obtaining runtime type info by name from
@TypeName
to<<TypeName>>
. - [RogueC] Fixed bugs in global vs. object access checking.
- [Random] Added
Random.int64()
methods and aRandom.byte()
method. - [Random] Replaced vestigial inline C with pure Rogue code.
- [List] Added two additional constructors
init(capacity,fn)
wherefn
is eitherFunction()->($Type)
orFunction(index:Int32)->($Type)
. Example:Byte[]( 16, ()=>Random.byte )
. - [List] Made
List.init(capacity,initial_value)
[preferred]
so that callingList(n,null)
would not be ambiguous withList(n,Function)
. - [TypeInfo] Added
TypeInfo.instance_of(other:TypeInfo)->Logical
. E.g.obj.type_info.instance_of(@SomeClass)
.
- [RogueC] Fixed a compiler crash that could happen with a certain combination of an array access in an internally cloned method.
- [CompoundIntrospection] Added
.set_property(String,Value)
and.get_property(String)
to make compound introspection symmetrical with Object introspection. Compound introspection methods are injected into compounds automatically. - [Object] Removed introspection method
Object.set_properties(Value)
(which works with aValueTable
) because when a developer-specific property namedproperties
is declared the method inadvertently acts as a setter.Object.introspector.set(Value)
can be called instead to accomplish the same thing.
- [RogueC] Improved handling of inline
native()
blocks in[macro]
methods. - [RogueC] Better error message when a class attempts to extend itself.
- [Rogue] Changed syntax for implicit query functions. Now, using
$
in an expression will cause the expression to be wrapped in a generic function(value) => ...
and$
changed tovalue
(the generic function parameter). For example,list.discard($ is null)
is equivalent to writinglist.discard( (value)=>value is null )
.
- [Implicit Queries] Fixed crash bug when
.this
is used in implicit query functions, e.g.local nums = [3,4,5]; nums.discard(.this%2==1)
.
- [Scanner/ParseReader] Renamed standard library class
ParseReader
toScanner
.
- [RogueC] Added
use/escapeUse/endUse
control structure. - [RogueC] Aspects
Reader
,Writer
, andPrintWriter
now implement theuse
API. - [RogueC] Fixed call resolution issue when an aspect defines a method with the exact same signature as one of the methods in class
Object
. - [RogueC] When an abstract method is called but no extended classes implement the method, a dummy method is generated to prevent a C++ compile error. Previously the call to the method would be generated but the method itself would not be.
- [Rogue] Changed root function types from aspects to classes and Task from a class to an aspect.
- [Rogue] Added inline native command
$(obj.type_name)
which prints out the C++ type name used for the given object. - [Rogue]
global
variables now evaluate their initial expressions in the calling context instead of theGlobal
class context. For example,local a = 3; global b = a
now works correctly. - [Rogue] Added built-in define to map
IntPtr
toInt64
orInt32
as appropriate. - [Rogue] Literal integers in bases 2, 8, and 16 (beginning with 0b, 0c, 0x) can now have underscores (
_
) immediately after0x
etc. as well as later. Underscores are visual separators only and do not change the value of the number. - [Console] Revamped class
Console
. Now writeConsole.immediate_mode = true/false
to enter or leave immediate mode.Console.read()
now returns a Character instead of a Byte. UTF-8 is automatically translated unlessConsole.decode_bytes = false
. Likewise arrow keys are automatically translated into Unicode 17-20,Console.UP_ARROW
etc.
- [Cython] Fixed Functions in Cython.
c42d4d0
changed Functions from classes to aspects, which required changes to the Function thunking for Python bindings.
- [RogueC]
--essential
flag no longer causes errors in types that extend aFunction
type that specifies a$PlaceholderType
return type. - [Random] Removed deprecated methods.
- [RogueC] Compiler now reports error messages with better line locations for
DEFINITIONS
and[macro]
methods. - [C++ Runtime] Expanded debug stack trace print buffer from 120 to 512 characters and now using snprintf() instead of sprintf().
- [Int32] Added
to->Int64(&unsigned)
. - [DataReader] Fixed sign extention error in
DataReader.read_Int64()
andread_Int64X()
. - [Character] Added
to_uppercase->Character
andto_lowercase->Character
. - [FileWriter]
close()
callsSystem.sync_storage()
, which is anoAction
in Rogue but can be augmented as needed in Plasmacore etc.
- [Random] Deprecated
next_int32
and renamed toint32
etc. - [Rogue] Added
[deprecated]
attribute anddeprected ["Message"]
statement (the latter implying the former) that causes Rogue to generate compile warnings if a deprecated type or method is used.
- [RogueC] A generic function with no parameters and a
with
clause is now parsed correctly (() with(x) => ...
).
- [Rogue]
ensure <var>
can now be used as an expression. Example:if (not list) list = Int32[](5); list.add( n )
becomes(ensure list(5)).add( n )
. - [Rogue] Renamed
[nonessential]
to[nonAPI]
. - [Rogue] Operand parens are now optional on
swapValues a,b
- [RogueC] Fixed
[api]
attribute to work on classes that are totally unreferenced by the rest of the program, making it and all of its[nonAPI]
methods [essential]`.
- [RogueC] Fixed compiled switch-case fall-through error when calling aspect methods that don't return values.
- [RogueC] Decoupled the introspection framework from the core CPP code, allowing it to be fully culled out when unused.
- [Rogue] Added
[nonessential]
method attribute that prevents a method from being automatically considered[essential]
when the context type has the[api]
attribute. - [Cython] Compiling
SomeFile.rogue
using--target=Cython
now generates the following files:somefile.pyx
,somefile_module.h
,somefile_module.cpp
. The.pyx
file should by Cython-compiled tosomefile.cpp
and then all .cpp files should be compiled and bundled assomefile.so
. In Python the module can then be imported withimport somefile
. - [Cython] Tweaks - added a placeholder 'pass', removed call to type Exception
make_api()
. - [Character] Added
Character.is_uppercase()->Logical
andCharacter.is_lowercase()->Logical
. Only works for ASCII.
- [Rogue] Function types are now aspects rather than class types, meaning any class with an appropriate call() method can also incorporate the appropriate Function type. For example, class X with a method
call(Int32)->Logical
can now be declared asclass X : Base, Function(Int32)->(Logical)
and objects of type X can be passed usingFunction(Int32)->(Logical)
parameters. - [Rogue] Instantiated tasks can now be called like methods. Nil-return tasks will continue to the next
yield
and value-return tasks will continue to the nextyield <value>
orreturn <value>
. Ideal for generators. IfFibonacci()
is a[task]
routine, then calllocal fib = Fibonacci()
to instantiate the task and thenfib()
to obtain the first number in the sequence. - [RogueC] The operator overloading mechanism now searches type Object if an original operand type is an aspect. For example, "aspect1 == aspect2" no longer fails to compile because because it finds
Object.operator==(other:Object)->Logical
as a suitable method. - [RogueC] Better error message when a function return type is missing its (parens).
- [RogueC] Reworked CmdStatementList evaluation mechanism to fix literal lists and other commands which add new nodes to the scope's statement list during their resolve phase.
- [Rogue] Added new macro statement
swapValues(a,b)
which expands to:local <temp> = a; a = b; b = <temp>
. - [Timer] Fixed bug in
Timer(duration,&expired)
when&expired
flag is true. Timer was starting out in a stopped state and also reading as non-expired due to roundoff error. Now timer does not begin in a stopped state AND the start time is adjusted as necessary to ensure thatis_expired()
returns true.
- [Rogue] Rogue now supports the
yield <value>
command in tasks.yield
surrenders execution without returning a value.yield <value>
surrenders execution and returns a value. The commandawait <task_name>
waits for ayield <value>
and is not satisfied by a simpleyield
. - [task] Routines and global methods can now be made into tasks with the
[task]
attribute. - [Wiki] Added Task system documentation to Wiki: https://github.com/AbePralle/Rogue/wiki/Tasks
- [ParseReader] Constructors now accept optional flag
&preserve_crlf
. Unless the flag is set to true then CR characters (Unicode 13) will be stripped. - [RogueC] Fixed to work with files containing CRLF (CR characters are stripped).
- [RogueC] Fixed compiler error caused by a pending syntax error when '--' is misused inside functions and possibly other places - CmdAdjust.cloned() was not implemented and the base Visitor class did not accept a generic CmdAdjust.
- [RogueC] Compiler no longer crashes on property declarations initialized to list values, including implicitly and explicitly typed lists as well as ValueList types.
- [RogueC] Reworked literal ValueTable construction mechanism to be more robust - previously a large number of definitions would exceed the C++ call nesting limit.
- [Rogue] Added meta-variable
$methodSignature
. - [UnsupportedOperationError] Constructing an
UnsupportedOperationError()
now prints an error message identifying the caller's class context and method signature. - [JSONParser] Turned global property
JSONParser.buffer
into singletonJSONParserBuffer
to avoid order of class initialization issues. - [Stopwatch] Added constructor
Stopwatch(&stopped)
. The Stopwatch will automatically start counting (as before) unless thestopped
flag is sent. - [Timer] Added constructor
Timer(duration,&expired)
. If theexpired
flag is set then the timer starts out stopped andis_expired
. Callingrestart
on it will use the duration paramater.
- [RogueC] If
C++
andObjC
are both listed as compile targets then the output files are.h
and.mm
instead of.h
and.cpp
. - [RogueC] Added compile flag
--ide[=<IDE Name>
that prints errors in classic C style for IDE's to pick up. Realized previous approach of using a--define
wasn't conceptually sound because the define targets the program being compiled rather than the compiler itself. - [System]
System.os()
now returns"emscripten"
if appropriate.
- [Rogue] Moved location of compiled
roguec
executable fromPrograms/RogueC/roguec
toPrograms/RogueC/<Platform>/roguec
. The Makefile will automatically delete the old program andbin/
link. - [Rogue] Added
$defined(<identifier>)
directive that returns true if a compiler option--define=<identifier>[:<value>]
was given or if a prior$define <identifier> <tokens>
directive was issued. - [Rogue] Added metavariables
$sourceFilepath
and$sourceLine
that can be used in expressions. - [Rogue] Now prints out "classic" style error messages if
$defined(IDE)
or Rogue-style error messages if not. Classic error messages automatically show up in XCode and possibly other IDEs. - [System] Added
System.os()->String
that returns the one of:macOS
,iOS
,Linux
,Windows
,Android
. - [File] Added
File.is_newer_than(other_filepath:String)->Logical
that returns true if the other file does not exist or if this file is newer. As usual withFile
methods the global methodFile.is_newer_than(this_filepath,other_filepath)
may also be called. - [File] Added
File.line_reader()->LineReader
. - [Reader] Added
close()->this
toReader<<$DataType>>
and appropriate forwarding calls inLineReader
andUTF8Reader
. - [String] Added
String
methodsis_number()->Logical
,is_integer()->Logical
, andis_real()->Logical
. - [RogueC] RogueC now detects recursive macro definitions and throws an error instead of crashing.
- [Makefile] Fixed initial roguec build to print out instructions for creating
Hello.rogue
instead of actually creating that file. - [Syntax] Updated Vim Syntax file to include all directives and metavariables. Did not add to Sublime; not sure on the syntax to include a leading
$
. - [C++] The generated .h file now identifies
ROGUE_PLATFORM_IOS
orROGUE_PLATFORM_MACOS
if appropriate.
- [Rogue] Literal numbers can now contain underscores as visual markers so long as the number does not start with an underscore. They do not change the value of the number and are intended to be analogous to commas - for example, one million can be written as
1_000_000
. - [Rogue] Added new statement
compileError ["optional message"]
that generates a compile error if and when it is parsed. Useful for informing the developer that a certain API is not implemented for their chosen target. - [System] Added
System.sleep(Real64)
that usesnanosleep()
with nanosecond (1/1,000,000,000 second) precision. - [Sockets] Tweaked Socket and ServerSocket class hierarchy in preparation for SecureSocket and SecureServerSocket.
- [RogueC] Fixed order-of-class-declaration bug where an overridden method's covariant return type would not always be accepted.
- [RogueC] An unused singleton access (useful to initialze a non-
[essential]
singleton without accessing a specific property or method) now omits the typecast on the result in C++ to avoid an "unused value" error. - [Vim] Updated Vim and Sublime syntax files to support numbers with underscores and the new
compileError
statement.
- [RogueC] Detailed Rogue error messages now show up in Xcode and can be jumped to by clicking on the error.
- [RogueC] Any error now prints out in two forms: first the "classic" compiler error format of
filepath:<line>: error <message>
tostderr
followed by the Rogue standard error format that is more easily readable printed tostdout
. Xcode (and perhaps other IDE's) automatically parse and display errors printed in that classic format. - [RogueC] Added
Console.error:PrintWriter
; printing to it prints tostderr
instead ofstdout
.
- [RogueC] Fixed up compiler warnings that appear on Cygwin and Linux but not Mac.
- [RogueC]
roguec
--execute
and--compile
options now use the Rogue Makefile default $(CXX) compiler with certain other flags - seeDEFAULT_CXX
in Makefile. - [RogueC]
roguec
--compile=<compiler invocation>
can be used to override the default.
- [RogueC]
roguec
now compiles, installs, and works correctly on Mac, Ubuntu, and Cygwin. - [RogueC] Fixed
roguec
compile on Ubuntu by specifying-std=gnu++11
, which works on Mac, Ubuntu, and Cygwin. - [RogueC] Now suppressing "offsetof macro used incorrectly" message which shows up in Ubuntu.
- [Sockets] Added
Socket(address:String,port:Int32)
andServerSocket(port:Int32)
inLibraries/Standard/Sockets.rogue
. Sockets are non-blocking and poll-driven. Once aSocket.is_connected()
or a non-null Socket is obtained fromServerSocket.accept_connection()->Socket
, use the Socketreader()->Reader<<Byte>>
,character_reader()->Reader<<Character>>
,writer()->Writer<<Byte>>
, andprinter()->PrintWriter
I/O objects to communicate via the socket. - [String] Added
String.to->Int64
. - [Runtime] Fixed small object allocations to be probably 16 byte-aligned - data array now starts from offset 0 of new allocation rather than offset 20 as before.
- [RogueC] Changed Makefile to use
-std=gnu++14
instead of-std=c++11
to fix a Cygwin issue with sigemptyset. - [RogueC] Changed
roguec
--execute
option to useg++
instead ofclang++
and changed-std
to usegnu++14
. - [RogueC] Removed reference to UNLICENSE in embedded Rogue runtime (
NativeCPP.cpp
).
- [RogueC] Restored
-include Local.mk
.
- [String] Added explicit
Int32
cast to native implementation ofString.to->Int32
. - [RogueC] Reworked implicitly and explicitly typed list construction to avoid exceeding max nesting level in C++.
- [Stopwatch] Added
Stopwatch.stop()->this
andStopwatch.start()->this
. - [Timer] Added
Timer.stop()->this
andTimer.start()->this
. - [Console] Added
Console.read_line(prompt:String)->String
andConsole.read_line(prompt:StringBuilder)->String
in addition to existingConsole.read_line()->String
.
- [String] Added optional
max_count
argument toString.leftmost_common_substring_count(other,[max_count=null:Int32?])->Int32
. - [Value] Added
Value.compressed()->Value
. Returns a clone of the value where all identifiers have been replaced by indices into an ID table. - [Value] Added
Value.decompressed()->Value
as a corollary tocompressed()
.decompressed()
may be safely called on an uncompressed value as long as it is not a table that contains elements@id_list
and@indexed_data
. - [Value] Changed behavior of
Value.locate(query:Function(Value)->(Logical))->Value
to return the index or key of the first matching item rather than the indices of all matching items. - [Value] Added
Value.locate_last(Value)->Value
andValue.locate_last(query)->Value
. - [Value] Fixed bugs in
ValueList.to_json()
andValueTable.to_json()
that were convertingfalse
values tonull
. - [List] Changed
List.to->Value
to convert non-null elements to values withelement->Value
rather thanValue(element)
- the latter results in values wrapping regular objects while the former converts the objects themselves to values. - [Table] Changed
Table.to->Value
to convert non-null elements to values withelement->Value
rather thanValue(element)
. - [RogueC] Literal value lists (
@[ ... ]
) now use a different construction mechanism to prevent a "too many nested elements" error in C++ when dealing with large lists.
- [RogueC] Changed default gc mode to
auto
. Pass--gc=manual
toroguec
to specify the previous default. - [Rogue] Renamed
clean_up()
toon_cleanup()
. This method can be present in any object and, if it is, will automatically be called when the object goes out of scope. - [Task]
Task.stop()
can now be called to stop any task and remove it from theTaskManager
. - [List] List methods
random()
,shuffle()
, andshuffled()
now all accept an optionalRandom
generator argument. If no generator is passed then theRandom
singleton is used as before.
- [File] Improved wildcard behavior, e.g.
File.listing("A/*/*.txt")
will list out files ending with.txt
in foldersA/B
,A/C
, etc. - [File]
File.listing(folder,...)
can now specify a specific non-folder file as its "folder" argument and that filepath will be returned in the results list. For example,File.listing("text.txt")
now returns theString[]
list["test.txt"]
if the file exists. - [File] Renamed
FileOptions.omitting_paths()
to.omitting_path()
to match singular name of related methods and variables.
- [Rogue] When
$include
ing a file, RogueC now first tries to find the file in the same folder as the including file, making filename collisions across separate libraries much less likely. Previously RogueC would just iterate through a list of all folders that had been seen so far, trying each one with no regard to the folder of the including file. - [String[]] Renamed
String[].joined(separator:String)->String
toString[].join(...)
. While the-ed
adjective style indicates a non-mutating call, is is also generally reserved for methods that return the same data type as the context. Becausejoin()
does not returnString[]
it is better left as a verb. - [String] Renamed
String.word_wrapped()->String[]
toString.word_wrap()->String[]
for the same reasons given in the previous bullet point. - [String] Added new
String.word_wrapped(...)->String
that returns a string with embedded\n
characters rather than returning a list of strings. - [String] All word-wrapping methods now preserve any initial indentation on successive lines.
- [String] Fixed bug in
String[].joined()
: if the first list item was an empty string then the separator wasn't being added after it. This was due to faulty logic that used a non-empty result string as an indicator that the loop was past its first iteration. - [String] Added
after_prefix(Character/String)->String
andbefore_suffix(Character/String)->String
. - [String/File] Moved
String.matches_wildcard_pattern()
to classFile
and altered wildcard behavior:**
matches any sequence of characters,*
matches any characters except/
or\
, and?
matches any single character except '/' or ''. - [File] Added
File.folder(...)
that is equivalent toFile.path(...)
; the older method still exists (continuing terminology shift of "path"/"directory" to "folder"). - [File] Added
File.before_wildcard_pattern()->String
. - [File] Added
File.copy(to_filepath:String)
andFile.copy(from_filepath:String,to_filepath:String)
. - [File]
File.listing(...)
can now handle wildcard patterns -**
implies recursive,*
matches any character except slash, and?
matches any single character. - [JSON/Value] Added
&omit_commas
flag parameter tosave()
andto_json()
. Passing it automatically sets the&formatted
flag as well. Rogue is capable of reading the non-standard JSON that is produced with&omit_commas
; the format is useful for allowing concurrent changes to the same JSON data file to be merged with less chance of a conflict. - [Value] Added
Value.set(Value,Value)
which forwards toValue.set(String,Value)
. - [Value] Fixed
Value.to_json()
call to work with no arguments - problem was that two overloads would both accept zero arguments. - [Console] Added
Console.width()->Int32
andConsole.height()->Int32
that return the size of the console in characters. - [PrintWriter<<...>>>] Calling
flush()
on a PrintWriter aspect template now invokes the PrintWriter'swrite()
method even if the StringBuilder buffer is empty. - [Set] Added
get(Int32)->$T
so that array-style access works. - [Set]
discard(value:$T)
andremove(value:$Type)
now return the value being removed whether or not it exists in the set (previously no value was returned). This allows the value to be removed to be computed from an expression, removed, and stored in a local all in one step. - [Primitives] Added
sqrt()
to all numerical primitives. - [ParseReader] All init() methods now reset 'position' to 0, allowing a
ParseReader
object to be reinitialized multiple times. - [RogueC] Top and bottom bars around error messages (
======
) now scale with the width of the console up to 79 characters max. - [Syntax] Added keyword
downTo
to syntax highlighting files.
- [Rogue] Removed ability to write
method set-x
as a shorthand formethod set_x
- was just not feeling natural enough. - [RogueC] Fixed some new Xcode weirdness around
std::set_terminate()
by removingstd::
and addingnamespace std{} / using namespace std;
kludge in the generated code... more conventional approaches were failing either on the command line or in Xcode (take outstd::
, addusing namespace std;
, include<cstdio>
).
- [API] Changed
File.listing(path:String,[flags])
behavior:- As before, sending the
&absolute
flag returns results that include the absolute path. - Sending the
&omit_path
flag returns results that omit the original path sent tolisting()
. Previously this was the default behavior. - When neither of the above flags is specified,
listing()
uses "relative" behavior where the results include the original path as well as any folders encountered during&recursive
descent.
- As before, sending the
- [API] Added
Runtime.gc_logging:Logical
pseudoproperty. Defaults tofalse
, enable to see used object and byte count after a GC. - [API] Added
Runtime.memory_used()->Int32
that returns the number of bytes currently used by Rogue objects. - [API] Added
Runtime.object_count()->Int32
that returns the Rogue objects that currently exist. - [API] Fixed two List method attributes from the out-of-date
[nullArgDefault]
to the current[preferred]
. - [API] Fixed error in
TimeInterval
(Date.rogue
)[macro]
methods - the termtotal_seconds
should have beenthis.total_seconds
in all cases.
- [API] Added
.is_power_of_two()->Logical
to all numerical primitives. - [API] Added
.to_power_of_two()
toCharacter
andByte
types (already exists in all other numerical primitives).
- [Rogue] Renamed
[nullArgDefault]
method attribute to[preferred]
and broadened its effect. Now, instead of pertaining only tonull
arguments, a[preferred]
method is chosen over other candidates any time that an ambiguous call is about to generate a compile error. If an ambiguous call has multiple preferred methods, none of them are chosen and an ambiguous call error is generated. - [API] Added
Value.insert(value:Value,before_index=0:Int32)
andValue.insert_all(value:Value,before_index=0:Int32)
for inserting additional values into lists. - [API] Added
JSON.load_list(File)->Value
andJSON.load_table(File)->Value
that return empty list or empty table if there are any problems loading or parsing the file.
- [API] Fixed issue with
List.get(Int32)
. It had been changed from a macro method to a regular method while debugging during the development of v1.0.91 and was inadvertently not changed back into a macro method. This prevented compound properties from being set directly on a list element since without the macro in place they were being set on a returned compound value rather than on a derferenced compound pointer value.
- [Rogue]
Function()
Type declarations andfunction()
object declarations now require parens around the return type to solve ambiguity issues. For instance, existing code containingFunction()->Logical
must now be writtenFunction()->(Logical)
. - [Rogue] Added method attribute
[nullArgDefault]
. When specified, an ambiguous call with anull
parameter with multiple candidate methods will now select the method that specifies[nullArgDefault]
. For instance,List.add($DataType)
is now the[nullArgDefault]
vs.List.add($DataType[])
and so callinglist.add(null)
will call the first overload. - [API] Added
[nullArgDefault]
toList.add($DataType)
andList.locate($DataType)
. - [API] Added
PrintWriter.close()
that forwards the call to the an writer if it exists.
- [API] Added
Byte[](hex:String)
andByte[].add(hex:String)->this
that accept strings of hexadecimal pairs and convert them into bytes. For example,Byte[]("007fa0FF")
produces a Byte list equivalent toByte[][0,127,160,255]
. - [API] Added
Byte[].to_hex_string()->String
that returns a string of hexadecimal digit pairs encoding each byte. For example,Byte[][0,127,160,255].to_hex_string
returns"007FA0FF"
. - [API] Added
Int64/Int32/Byte.to_hex_character()->Character
that returns characters0..9
orA..Z
for values0..9
or10..35
("hex" isn't entirely accurate as this method naturally supports bases 2..36, but hexadecimal is the most likely use case). - [RogueC] Literal
Byte[]
lists containing only literal byte values are converted internally to use an efficientByte[](hex:String)
constructor rather than generating anadd()
statement for each byte value. - [RogueC] Extended types can now be implicitly cast to optional base types. For example, you can return a
Cat
from a method that returns->Pet?
. - [RogueC] Fixed ambiguity issue when a Function Type is used as a template type parameter as an optional or list value. In other words, if
$DataType
isFunction()->Int32
in a methodmethod m->$DataType?
, the return type is now correctly interpreted as->(Function()->Int32)?
rather than->(Function()->Int32?)
. - [RogueC] Renamed various
Cmd.cloned(Cmd)
methods toCmd.clone(Cmd)
, leavingCmd.cloned()
as-is, to have the semantics reflect the behavior of possibly cloning a possibly null reference (clone()
) versus having an existing object clone itself (cloned()
). - [RogueC] Fixed bug where
CmdCallPrior
nodes were assuming that arguments always existed during cloning. Changedargs.cloned()
toclone(args)
.
- [RogueC] Changed comma from a standard expression token to a "structural" token. This allows generic functions to be parsed as a middle argument (followed by a comma) rather than inadvertently restricting them to be the final argument as was previously the case (close paren is also a structural token, which stops the parsing in that scenario). There are no known negative side effects of this change.
- [Rogue] All occurrences of the pattern
set-<x>
are now replaced withset_<x>
. For instance,set-value
is shorthand for writingset_value
. This is a more complete implementation of an existing mechanism; the purpose is to easily allow pattern searching to find properties, getters, and setters all using the same name (e.g. searching for\<value\>
in Vim finds propertyvalue
, gettervalue()
, and setterset-value()
).
- [RogueC] Parsing of implicit
forEach
loops is now more robust. - [JSON API] JSON parser now returns
UndefinedValue
rather thanNullValue
in syntax error situations.NullValue
is only returned when the literal keywordnull
appears in the JSON. - [Value API] Added
Value.is_undefined()->Logical
that returnstrue
when a value is anUndefinedValue
. Note thatUndefinedValue
also returns true for.is_null()
; anUndefinedValue
is aNullValue
but the reverse is not true.
- [Rogue] Generic functions can now omit the keyword 'function' for brevity and begin with
(args)=>
,()=>
, or even just=>
. For example:trace [3,1,5,4,2].sort( (a,b)=>(a<b) )
. - [Rogue] Added an implicit function convenience syntax that automatically converts expressions into generic single-parameter functions with automatic variable capture when the expression contains terms that begin with
.
or//
. For example,table[//name==player_name]
is equivalent to writingtable[function(value) with(player_name)=>value//name==player_name]
andlist.first(.is_string and .count>3)
is equivalent to writinglist.first(function(value)=>value.is_string and value.count>3)
. The special keyword.this
may be used in implicit functions to indicate the value under consideration. For example, to pull out all the odd numbers in an Int32 list:list[ .this & 1 ]
. Methods accepting functions of this form can be called function methods. - [Rogue] Added implicit loops. Any expression
(forEach in/of collection)
is replaced by a variable and the statement that contains the expression is wrapped in aforEach (<variable> in/of collection)
control structure. For example, writing(forEach in sprites).update
is equivalent to writingforEach (sprite in sprites) sprite.update
andprintln (forEach in nums)
is equivalent toforEach (num in nums) println num
. - [Rogue] Added an additional refinement to call resolution: if a call would be otherwise ambiguous and any
Value
arguments or parameters exist, keep only candidate methods where there is at least oneValue
type in each argument/parameter pairing. In other words, a callm(5)
would matchm(Value)
and notm(OtherType)
. - [Rogue] Explicit calls to operator methods (
a.operator==(b)
etc.) can now be made. - [Rogue] Implemented compare operator
<>
. An expressiona <> b
resolves to-1
ifa < b
,0
ifa == b
, and1
ifa > b
. Classes may implement the compare operator by defining global methodsmethod operator<>(TypeA,TypeB)->Int32
and/or instance methodsmethod operator<>(OtherType)->Int32
. - [Rogue] Reworked the operator methods mechanism. For any general binary operator such as
+
where at least one operand is not a primitive, the expressiona + b
(of typesTypeA
andTypeB
) is converted to the first of the following expressions that are implemented:- Global method
TypeA.operator+( a:TypeA, b:TypeB )
. - Global method
TypeB.operator+( a:TypeA, b:TypeB )
. - Instance method
TypeA.operator+( b:TypeB )
.
- Global method
- [Rogue] 'local' variable declarations are no longer allowed in single-line statement blocks (part of the fix for local variables in multi-line 'function' definitions described below).
- [Rogue] Added parse support for the escape sequence
\e
(ASCII 27 / Escape). - [API]
Table
has been completely revamped to track the order of its values by implementing a doubly-linked ordering list as part of theTableEntry
class, making removals O(1) instead of O(n) as before. - [API] Renamed
Table._remove(TableEntry)
toTable.remove(TableEntry)
. - [API]
Table
now uses an array of bins instead of a list of bins. - [API]
Table
automatically doubles in size every time its item count matches its bin count. - [API] Added
Table.entries(list=null:TableEntry[])->TableEntry[]
that returns a list of table entries. - [API] Added optional list parameter to
Table.keys()
andTable.values()
which, if it exists, is used instead of dynamically allocating a list of keys or values. - [API] Added
Table.sort(Function(TableEntry,TableEntry)->Logical)->this
andTable.sorted(Fn...)->Table
. The former sorts the curent table in place and the latter returns a sorted clone. Example:people.sort( (a,b)=>(a.value.age < b.value.age) )
. - [API] Added optional
Table.sort_function : Function(TableEntry,TableEntry)->Logical
that, if defined, is used to sort table entries as they're defined or redefined. Setting the sort function will automatically sort() any existing table entries using that function. - [API] Fixed error in
Table.remove(key)
- correct entry was being removed but incorrect value was being returned. - [API] Renamed the function method
Table.keys(Function(...))
toTable.locate(Function(...))
. - [API] Added several function methods to
List
andTable
:.get(query)->$DataType[]
,.first(query)->$DataType?
,.locate(query)->$DataType[]/Int32[]
,.remove(query)->$DataType[]
, and.count(query)->Int32
(the latter has been added toValue
as well).` - [API] Added
.contains(query)
toList
,Table
, andValue
. - [API] Added
List.rest(result_list=null:List)->List
that returns all elements after the first. - [API] Added
Array<<DataType>>.cloned()->Array<<DataType>>
. - [API]
Value.cloned()->Value
now performs a deep clone forValueList
andValueTable
. - [API] Fixed several
Value
operator methods to perform the correct operation instead of addition (copy/paste error). - [API] Changed
Value.operator?(Value)
to report true for any non-null, non-LogicalValue, or true LogicalValue (and false for any null or Logical false). Similarly changed ValueList and ValueTableto->Logical
to always return true. - [API] Fixed
Value.remove(String)
forValueList
(the nominal purpose of remove(String) is to remove table values by key but of course it needs to work on lists of strings as well) and added some better default implementations forValue
methods.first()
,.last()
,.remove_first()
, and.remove_last()
. - [API]
Value.sort(compare_fn)->Value
now works on ValueTable as well as ValueList (compare_fn
receives table values only, not entries or keys). - [API] Renamed
values
property ofValueList
andValueTable
todata
. - [API] Added
Value.values(list=null:Value)->Value
. For tables, returns a ValueList of the table data. For anything else (including ValueList) returns the value itself. If a ValueList parameter is provided, values will be added to the list and it will be returned instead of creating and returning a new list. - [API] Added
Value.add_all(Value)->this
which adds each item in the parameter to this list if the parameter is a collection or adds just the parameter itself if the parameter is not a collection. - [API] Added
Value.rest(result_list=null:Value)->Value
that returns all the elements in aValue
collection after the first. - [API] Added
Value.reserve(additional_elements:Int32)->this
. If theValue
is aValueList
the call is forwarded to the backing list; otherwise there is no effect. - [API] Added global methods
Value.load(File)->Value
andValue.parse(json:String)->Value
. - [API] Added method
Value.save(File,&formatted)->Logical
. - [API] Reworked
String
operator methods to prevent null pointer errors. - [API] Added
String.leftmost_common_substring_count(other:String)->Int32
andString.rightmost_common_substring_count(other:String)->Int32
- [API] Added convenience method
Console.clear
. - [API] Added convenience method
Console.clear_to_eol
. - [API] Added convenience method
Console.move_cursor(dx:Int32,dy:Int32)
. - [API] Added convenience method
Console.restore_cursor_position
. - [API] Added convenience method
Console.save_cursor_position
. - [API] Added convenience method
Console.set_cursor(x:Int32,y:Int32)
. - [API] Added global method
File.delete(filepath:String)->Logical
and methodFile.delete()->Logical
. - [RogueC] Reworked and simplified code handling resolution of
prior.init
calls to fix a new--exhaustive
compile error that chose now to crop up. - [RogueC] Fixed local variables to work correctly in function definitions. Multi-line function bodies were being parsed at the same time as function declarations, meaning that the
Parser.this_method
reference while parsing a local was either null or incorrect. Multiline function definitions now simply collect tokens and wait for the resolve() phase to parse the function bodies.
- [Rogue] Renamed
[requisite]
to[essential]
. - [RogueC] Added Python plug-in functionality from Murphy McCauley with
Cython
compile target. - [RogueC] Added
--exhaustive
option which makes all classes and methodsrequisite
. - [RogueC] Added
--api
option which adds the[api]
attribute to every class - if the class is used then all methods are resolved generated even if unused. - [RogueC] Fixed logicalize (
?
) to search for a global method rather than object methodoperator?(operand)->Logical
.Type.has_method_named(String)
used to check both object and global methods but for some time now it only checks the former andType.has_global_method_named(String)
must be used to check the latter. - [API] Added
Value.get(Function(Value)->Logical)->Value
. Example:local teens = people[function(p)=>(p//age>=13 and p//age<=19)]
. - [API] Added
Value.remove(Function(Value)->Logical)->Value
. Example:local teens = people.remove( function(p)=>(p//age>=13 and p//age<=19) )
. - [API] Added
Value.keys(Function(Value)->Logical)->String[]
. Example:local teen_ids = people.keys( function(p)=>(p//age>=13 and p//age<=19) )
. - [API] Added
Value.first(Function(Value)->Logical)->Value
. Example:local first_teen = people.first( function(p)=>(p//age>=13 and p//age<=19) )
. - [API] Added
Value.last(Function(Value)->Logical)->Value
. Example:local last_teen = people.last( function(p)=>(p//age>=13 and p//age<=19) )
. - [API] Console I/O now goes through
Console.io_handler
. In addition to the defaultBlockingConsoleIOHandler
there is also anImmediateConsoleIOHandler
you can instantiate and install - or you can extend your ownConsoleIOHandler
. - [API] Renamed the Value system's
NullResult
toUndefinedValue
. - [API] Added
Math.min/max(Int64)
. - [API] Added
File.append_writer()
. - [API]
ConsoleIO.write(String)
bugfix. - [API]
List.locate(null)
is now handled properly - [API]
Error.format()->String
is now more cautious. - [Syntax] Fixed
skipIteration
(a briefly considered alternative) to benextIteration
in the Vim and Sublime syntax files. - [Syntax] Renamed
requisite
toessential
.
- [API] For GC safety, introspectors now retain references to objects they were created from (instead of only having the raw memory address).
- [API] Value types now have two kinds of null Value.
NullValue
is what is stored when anull
is stored, retrieved, or parsed and itsto->String
is"null"
.NullResult
extendsNullValue
, is what is returned when an element cannot be found, and itsto->String
is""
.
- [API] A new class "Introspector" provides the ability to get and set object value using introspection and JSON-style
Value
types.- Obtain an introspector from any by-reference or by-value type by accessing
.introspector
on the value. Introspector.get(name:String)->Value
returns theValue
representation of the specified property.Introspector.set(name:String,new_value:Value)->this
sets the specified property, if found, to be the new value.Introspector.set(new_value:Value)->this
can be used to set any or all properties of an object ifnew_value
is aValueTable
specification of new values.Introspector.to->Value
returns aValueTable
containing all properties.
- Obtain an introspector from any by-reference or by-value type by accessing
- [API] Added
Object.get_property(name:String)->Value
. - [API] Added
Object.set_property(name:String,new_value:Value)->this
. - [API] Added
Object.set_properties(new_values:Value)->this
(new_values
should be a ValueTable). - [API] Added
.to->Value
conversion toObject
,String
,List
, andTable
as well as all primitives and compounds. Lists convert intoValueList
objects while objects and tables convert intoValueTable
objects. - [Rogue] Any
Object
method such asobject_id()->Int64
can now be called on any aspect reference. - [Rogue] Any
Object
conversions such as->String
can now be performed on any aspect reference. - [RogueC] Fixed bug calling methods on aspect references when the methods are declared
[abstract]
in the aspect. - [RogueC] Fixed bug resolving escaped local variable names in inline native code when there are multiple locals with the same name.
- [Rogue] Added alternate syntax for defining setter methods:
method set-x(...)
is an alternate form ofmethod set_x(...)
. In both cases the true name of the method isset_x
. The purpose of the hyphenated syntax is to keepx
visible to search-and-replace. For example, if you renamed a property fromalpha
toopacity
, it's easy to missset_alpha
. - [API] Fixed logical error in
Character.to_number(base=10:Int32)->Int32
. - [API] JSON-style Value types can now be compared with String types and all primitive types.
- [Rogue] Added
--define="name:value"
compiler directive. Example:--define="PI:Math.acos(-1)"
- [Rogue] An undefined identifier in a conditional compilation
$if
now counts as false. - [RogueC] Fixed compiler crash when a generic function specifies the wrong number of parameters compared to the specific function it's matched to.
- [API] Added
Timer.restart(new_duration:Real64)
in addition to existingTimer.restart()
.
- [RogueC] Improved call resolution with named arguments. If there are still multiple candidates after the previously existing method selection logic, the candidate list is refined by keeping only methods that have enough non-default parameters without counting named arguments. For instance, a call "fn(true,&flag)" would previously have matched both
fn(Logical,&flag)
andfn(Logical,Logical,&flag)
since both methods accept two arguments, but when&flag
is removed from consideration there is only one method that accepts a single argument. - [RogueC] Significant change to the ordering of type evaluation after discovering that base classes containing extended class properties (e.g.
Class Pet / PROPERTIES / cat : Cat
) could easily cause compiler crashes (ifPet
happened to be processed beforeCat
in the code). Now all types are recursivelyconfigure()
d as a first step, which instantiates templates and creates type hierarchies for all properties and methods. Then all terminal (unextended) classes areorganize()
d, which recursively organizes base types and builds method tables. Finally all classes areresolve()
d, which evaluates method body statements. The whole process is repeated if new classes are introduced along the way.
- [Rogue] Global aspect methods now work again.
- [Rogue] When a class and an aspect the class incorporates both define the same method and the aspect method's return type is
this
, the class method trumps the aspect method (as before) but now the aspect method return type can be more general than the class method return type (as you would expect). - [API] Added efficient implementations of
FileWriter.write(String)
,FileWriter.write(StringBuilder)
, andFile.save(StringBuilder)
. - [API] Made implementations of
File.save(String)
andFile.save(Byte[])
more efficient. - [API]
PrintWriter(Writer<<Byte>>)->PrintWriter
can be used to create an object that wraps the given writer in a PrintWriter object. - [API] Tweaked PrintWriter implementation.
- [Rogue] Generic functions definitions must now use
=>
rather than=
, e.g.list.sort( function(a,b)=>(a<b) )
.=>
has been the official symbol for some time now;=
was unintentially left in. - [API] Added
List.count(Function($DataType)->Logical)->Int32
that counts the number of items that pass the test function.
- [RogueC] Fixed try/catch scoping error in generated C++ code when it makes use of tasks (broken in v1.0.80).
- [C++] Replaced RogueCPPException with
ROGUE_RETAIN_CATCH_VAR()
macro.
- [RogueC] Fixed order-of-evaluation bug where type
Global
was not necessarilyorganize
d before resolving code that implicitly uses theGlobal
context. Example: a call toprintln
in classException
or one of the primitives would not resolve and only an explicitGlobal.println
would work. - [RogueC] Generated C++ code now wraps
Rogue_launch()
andRogue_update_tasks()
intry/catch(RogueException)/RogueException__display()
handlers. - [C++] Added
RogueException__display(RogueException*)
(requisite Rogue method) as a simple way of displaying a caught error and the accompanying stack trace if present. - [C++] Removed vestigial
Rogue_error_object
from runtime framework. - [C++] In C++, base class
Exception
is nowRogueException
rather thanRogueClassException
. - [API] Added
sign()
toReal
andInt
types that returns-1
,0
, or1
of the appropriate type. - [API]
InsertionSort
no longer creates a new reader object every time it is called. - [API] Added
BubbleSort
(BubbleSort<<T>>.sort(list:T[], compare_fn:Function(T,T)->Logical)->T[]
).
- [API]
Real64Value
objects now omit ".0" when printing their value or converting it to a string. - [API] Added
Real64
/Real32
methodswhole_part()->RealX
andfractional_part()->RealX
. - [API] Added
Real64
/Real32
methodceiling()->RealX
. - [API]
Real64
/Real32
methodformat([decimal_digits])->String
now allows an unlimited number of decimal digits (0+) when no argument is passed instead of the previous cap of 4 digits. - [API] In the JSON-style Value system, removed class
Int32Value
so that all numbers are stored asReal64Value
objects. - [RogueC] Improved method call resolution.
- [RogueC] Renamed
Program.is_type_defined()
check toProgram.is_type_used()
(when deciding whether or not to inject code referencing classTaskManager
) to work correctly if the type has been defined and then culled. - [RogueC] Fixed check for attempting to compare two compounds (with
==
,<
, etc.) to require anoperator<(CompoundType)
method if the operator is not==
or!=
(anoperator==()
comparison is built-in to compounds). - [API] Added
Console.peek()->Byte
to implement missing abstract method incorporated fromReader<<Byte>>
.
- [RogueC] C++ definition of base
struct RogueObject
now injects preprocessor valueROGUE_CUSTOM_OBJECT_PROPERTY
if it's defined, allowing for one or more custom properties per object. - [RogueC] Fixed object conversions between related classes to look for
CurType.to->NewType
and thenNewType.init(CurType)
methods before defaulting to typecasts. The bug was introduced when the code for handling conversions was merged with the code for handling typecasts some time ago.
- Integrated changes from MurphyMC
- Standard.Set: Add
is_empty()
- CPPWriter: normalize select expressions
- Makefile: Changes (mostly for installation)
- NativeCPP: Set platform macro on Linux
- RogueC: More
--requisite*
help text - Exception: Make base methods requisite
- NativeCPP: Fix exceptions with
--gc=auto
- Standard.Set: Add
- [Rogue] Removed
isNot
operator in favor of two-word operatoris not
. - [Rogue] Removed
notInstanceOf
operator in favor of two-word operatornot instanceOf
. - [API] Renamed
trimmed(left=0:Int32,right=0:Int32)->String
toclipped(left=0:Int32,right=0:Int32)->String
.trimmed()->String
still exists and behaves similarly to Java'strim()
.
- [RogueC] Changed initial, automatic include of the Standard Library to only include the single new file "NativeCode.rogue", which in turn decides which native files to include. The full standard library include then happens at the end, as in pre-v1.0.72. This prevents "Standard/" from being added to the default filename search path so that a project attempting to include its own source file won't accidentally get the Standard Library version of the file if they happen to have the same name.
- [Standard] Removed vestigial "Event.rogue" which exposed the "same filename, wrong library" bug mentioned above.
- [Standard] Made the Standard Library includes more explicit: "Standard/List.rogue" instead of just "List.rogue", etc.
- [RogueC] Improved
prior.init
call resolution. - [RogueC] The compiler now performs an internal
$include "Standard"
first rather than last, ensuring that the code inNativeCPP.h
always comes first in the output C++.
-
[Rogue] A
loop
with a specific number of iterations now has a single-line variant:loop (2) println "pizza" endLoop
loop (2) println "good"
- [RogueC] Fixed bug in overloaded routine mechanism.
- [RogueC] CmdContingent now omits unused escape label to fix unused label warning.
- Merge pull request #7 from
MurphyMc/misc_work_march2016
- Misc work March 2016 by MurphyMc
- Add additional plugin hooks 42813c4
- Type: Add
is_function
tag 4493e0e - stdlib: Remove unused RogueException fe76c01
- stdlib.Exception: Add .format() 6bdf367
- CPPWriter: Generate debug trace info more robustly 41633e5
- primitives: Add .minimum and .maximum for Int32 / Suggest this is done for all primitive numeric types. 839bde3
- Add/improve a couple useful
to->Strings
0a3ea9d - CPPWriter: Don't
assign_cpp_name
more than once 3d9bfd1 - CPPWriter: Include original type name as a comment aa6ccc7
- Exception: Set Exception message by default 0aa84a3
- Parser: Add templates to Program earlier 4a9db80
- Ability to generate virtual/dynamic calls for all methods de94726
- Requisite rework and api attribute
- Removed odd (accidental?)
->String
return type onRogueC.include_source()
- [RogueC] Added some kludgy code to get rid of C++ "unreachable code" warnings when all control paths in a
contingent
return a value.
-
[Rogue] Added ability to define anonymous inline classes:
local obj = SomeClass() instance # PROPERTIES, METHODS, ... endInstance
local obj = SomeClass(initializer-args) instance(initializer-parameters) # PROPERTIES, METHODS, ... endInstance
-
[Rogue] Added new
forEach
option that allows a local variable name to be specified for the collection being iterated over.local rewriter = list.rewriter forEach (value in rewriter) if (passes_test(value)) rewriter.write( value ) endForEach
forEach (value in rewriter=list.rewriter) if (passes_test(value)) rewriter.write( value ) endForEach
-
[Rogue] Aspects can now specify a base class. When a class incorporates an aspect with a base class it is as if the class directly extends the base class.
-
[Rogue] Optional primitive types are now compatible with other optional primitive types. In other words an
Int32?
can be passed in for aReal64?
parameter. -
[API] Renamed
List.rebuilder()->ListRebuilder<<$DataType>>
toList.rewriter()->ListRewriter<<$DataType>>
. -
[API]
Degrees
andRadians
compounds now implement relational operators (==
,<
, etc.). -
[RogueC] Fixed issue causing error message " does not overload method visit(CmdModifyAndAssign)."
-
[RogueC] Modify-and-assign operations now correctly map to global operator methods for locals and globals.
- [Rogue] Changed generic function result definition symbol from
=
to=>
. Example:list.sort( function(a,b) => a < b )
. - [Rogue] Changed directives
$includeNativeHeader
and$includeNativeCode
into dependency statementsincludeNativeHeader
andincludeNativeCode
. Consequently native includes happen during analysis rather than parsing. - [Rogue] Changed
Character
to be a signed instead of unsigned 32-bit signed integer to simplify mixed Int32/Character operations and make Rogue code more portable (e.g. to Java/JavaScript someday). The supported range of characters remains 0..0x10FFFF (21 bits). - [RogueC] Compiler now correctly finds global method
operator+(Type,Type)
as well as regular methodoperator+(Type)
. - [API]
Console
now incorporates theReader<<Byte>>
aspect for reading from standard in (has_another->Logical
,read->Byte
). Also addedConsole.read_line->String
that returns the next line after stripping the newline character. All calls are blocking.
- [Rogue] Added
//
convenience operator that convertsobj//key
into an element accessobj["key"]
. - [Rogue] Added two shorthand versions of
try
: the statementtry single; line; commands
runs the given commands while silently catching and ignoring any thrown exception. The expressiontry <try-expression> else <else-expression>
evaluates to the result of<try-expression>
unless that expression throws an error, in which case the result of evaluation is<else-expression>
. - [API] Simplified type conversion in Value classes -
table.string["key"]
is nowtable["key"]->String
etc. - [RogueC] Fixed a crash bug when parsing
return
outside of a method definition. - [RogueC] Non-generic function definitions now have an implicit type for type inferencing.
- [Rogue] A
select
value that is both condition and result is now only evaluated once. For example, if some sequence counter will give a next value of1
, thenselect{counter.next:counter.next || -1}
will result in2
butselect{counter.next || -1}
will result in 1. - [Rogue] Reversed the meaning of
trace
and@trace
.trace
now includes the method signature, filename, and line number while@trace
omits them. Think Makefiles with@
omitting output. A trace without any arguments still prints out the location whether or not it has an@
, just as before. - [Rogue] Classes can now have a global method
operator?( obj:<ObjectType> )->Logical
. The default behavior when an object is logicalized is to convertif (obj)
to beif (obj isNot null)
. If you provide that method, however, it will convert toif (<ObjectType>.operator?(obj))
. - [RogueC] Fixed extended classes to call
prior.init_object()
before instead of after assigning their own initial property values. This allows initial property values to be overridden in extended classes. - [API] Fixed bug
List.insert(other:List,before_index=0:Int32)->this
. The entire contents of theother
list's backing array were being addd to the current list. - [API] The Value system now uses a NullValue singleton instead of actual null values. All Value types returned collection accesses will be non-null (but may be NullValue instead).
value.is_null
andvalue.is_not_null
can be used to check value's nullness. - [API] Added comparison operators for
Value
types and implementedValueList.contains(String|Value)
. - [API]
ValueList/ValueTable.load(File)
now accepts a null file. - [API] JSON loading now consolidates strings and identifiers.
- [API] Renamed introspection methods
PropertyInfo.property_name()
andPropertyInfo.property_type_info()
to bename()
andtype()
instead.
- [Rogue] Renamed
CLASS
section toDEPENDENCIES
. Use to inject native code and mark classes and methods as requisite IF the currrent class is used in the program. - [Rogue] Modify and assign operator (example:
+=
) now work on list and array element accesses. Note that the element access is cloned, solist[i] += x
becomeslist[i] = list[i] + x
and ultimatelylist.set( i, list.get(i) + x )
. - [API] Reworked
List(initial_capacity:Int32,initial_value:$DataType)
to be much faster by copying the initial value directly into the backing array instead of repeatedly adding it. - [API] All List
discard
methods now returnthis
list. - [API] Improved
create()
andto->String()
methods ofTimeInterval
class. - [API] Added an optional global interface to Stopwatch.
Stopwatch.start(key:String)
creates and starts a global stopwatch,Stopwatch.finish(key:String)
prints the key and the elapsed time, removing the stopwatch, andStopwatch.remove(key:String)->Stopwatch
removes and returns the stopwatch without printing the elapsed time (you can print the elapsed time yourself if desired). - [API] Simplified
PrintWriterAspect
now that aspect method return types ofthis
are converted into the type of the incorporating class. - [API] Added
clamped(Int32?,Int32?)
toReal64
andReal32
sinceInt32
parameters cannot be automatically cast toReal64?
. - [API] Added
Real32.to->String
. - [API]
File
tweaks - primarily renamedabsolute_filepaths
forlisting()
to beabsolute
instead etc. - [RogueC] Fixed method template bug - methods added to already resolved classes are now resolved as well.
- [RogueC] An unresolved method call involving named args now prints out the candidate method parameter names.
- [RogueC] Compounds with native properties now produce properly compileable C++ code.
- [C++] Further modified C++ try/catch macros to allow polymorphically compatible catches.
- [C++] Renamed native array data pointers from
reals/floats/longs/integers/characters/bytes/logicals/objects
toas_real64s/as_real32s/as_int64s/as_int32s/as_characters/as_bytes/as_logicals/as_objects
. - [C++] Added typedef for
RogueWord
as a 16-bit unsigned integer.
- [Rogue] Conversion methods (
method to->String
) can now accept parameters on definition (method to->String(arg:Int32)
) and on call (st = obj->String(x)
). - [API] Renamed
clone()
methods to be calledcloned()
instead to fit with the general Rogue convention of verbs mutating and returningthis
object and adjectives returning a mutated copy. - [API] Added integer primitive
to->String(&digits:Int32,&hex,&octal,&binary)
conversion methods. - [API] Added
Date.to->String(&ymd,&hms,&s,&ms,&format=24)
conversion method. Specifying&format=12
or&format=24
automatically sets the&hms
flag to include Hours, Minutes, and Seconds in the output. - [API] Added
Value.sort(compare_fn:Function(a:Value,b:Value))
that sorts ValueList types into order based on an arbitrary comparison function. - [API] Added
Value.remove(key:String)->Value
to base classValue
. This method is overridden byValueTable
. - [API] Added
List.discard(Function(value:$DataType))->this
that discards items identified by the supplied function. - [API] Added
List.subset(i1:Int32,[n:Int32])->List
. - [API] Added optional parameters to
String.trimmed([left:Int32],[right:Int32])->String
. If eitherleft
orright
is specified then the corresponding number of characters are trimmed off the left or right sides of the returned string. If neither are specified then whitespace is trimmed off of both ends. - [API] Renamed integer primitive method
to_power_of_2()
toto_power_of_two()
. - [RogueC] Improved no-parens args parsing.
- [API] Renamed
get_int32()
etc. to beint32()
for Value types (Value, ValueList, ValueTable). - [API] Fixed
File.timestamp()
- was returning value in milliseconds instead of real seconds. - [API] Added class
TimeInterval
that can be added to a Date value or obtained by subtracting two Date values. - [API] Adjusted numerical primitive method
clamped(low,high)
to have use optional named parameters:clamped(&low=null,&high=null)
. - [API] Added
or_larger(other)
andor_smaller(other)
to numerical primitives.a = a.or_larger(b)
is equivalent toa = Math.max(a,b)
, likewise foror_smaller
andMath.min
. - [API] Added
.floor()
to primitivesReal64
andReal32
. - [API] Added
.format([decimal_digit_count])->String
to Real64 and Real32 that returns a string representation with no more than 4 decimal digits ifdecimal_digit_count
is omitted or else the exact number of decimal digits specified. - [API] Renamed
List.filter()
andList.filtered()
toList.keep()
andList.keeping()
. The original names are still available as macros for developer convenience. - [API] Fixed an off-by-one error in
List.from(i1,i2)
wherei2
was not being included. This also fixes InsertionSort, which was leaving out the last element every time a sort was performed. - [RogueC] Fixed step size to have an effect again in two forEach loop variants... had been broken since 'step' started being parsed as part of a range.
- [RogueC] Now supporting operator methods for binary operators (
&
,|
,~
,:<<:
,:>>:
,:>>>:
).
- [API] Renamed JSON-style data
PropertyValue
,PropertyList
, andPropertyTable
to beValue
,ValueList
, andValueTable
instead. - [Rogue] The symbols
@[]
(ValueList) and@{}
(ValueTable) can now be used as types. For example, declaring a propertytable : @{}
is equivalent totable : ValueTable
, whiletable = @{}
is equivalent totable = ValueTable()
. - [Rogue] Macro methods are now
[propagated]
automatically so that they resolve in the most specific object context before being substituted in place of the call. - [Rogue]
catch
can now omit the variable name if the variable isn't used and just specify an exception type. For example,catch (err:Error)
can be writtencatch(Error)
. - [Rogue] Improved generated code of try/catch system to handle multiple 'catch' levels.
- [API] Fixed Value add() macro methods to return 'this' instead of Value so that they have the correct return type when called on ValueList.
- [RogueC] Exception types specified in
catch
are now marked as 'used' types in the event that those types aren't referenced anywhere else. - [RogueC] Added
-Wall
(enable all warnings) option to clang when roguec is run with--compile
.
- [Rogue] Added weak references (note: only tested in manual GC mode). Create a
WeakReference<<$DataType>>(obj)
and then access itsvalue
as desired. The weak reference does not prevent the contained object from being collected and, if it is, the weak reference'svalue
will be set tonull
. - [API] Added
Date
class. Example:println "$ until Christmas" (Date.ymd(Date.now.year,12,25) - Date.now)
. - [Rogue] Improved module namespacing. When you write
module A::B
, all identifiers from modulesA
andA::B
become visible (previously only identifiers fromA::B
become visible). If you are working inmodule A
that includes files frommodule A::B
, you can now write relative scope qualifiers such asB::xyz
instead of having to write the fullA::B::xyz
. - [Rogue] Bug fix: only requisite singletons are instantiated on program launch. Other singletons are instantiated on first access.
- [Time] Added
add(delta_time:Real64)
andsubtract(delta_time:Real64)
methods to classesStopwatch
andTimer
. Adding a positive value to a Stopwatch increases theelapsed
time while adding a positive value to a Timer increases theremaining
time. - [Introspection] Added method template
TypeInfo.create_object<<X>>()->X
which is equivalent to callingsome_type.create_object as X
. - [API]
Runtime.collect_garbage()
now sets a flag in manual GC mode to force a GC after the current update (theforce
flag is ignored in manual GC mode). - [API]
List.remove(value:$DataType)->$DataType
now returnsvalue
instead ofnull
if the value is not found in the list. - [API] PropertyValue types now implement clone() and various operator methods.
- [API] PropertyValue types now have methods
ensure_list(key:String)->PropertyList
andensure_table(key:String)->PropertyTable
. When called on a PropertyTable they find or create the required collection and return it. When called on any other PropertyValue type they return an empty collection of the appropriate type but do not (and cannot) store it. - [API] Fixed JSON loading and parsing to treat EOLs as whitespace.
- [API] Improved JSON parsing so that a nested syntax error returns
null
at the top level instead of at the nested level. - [API] Improved JSON parsing to not require commas after table mappings or list items. Extra commas are ignored in tables and at the end of lists. Extra commas within lists imply null elements - so
[1,,3]
parses as[1,null,3]
. - [API]
File.listing()
is now overloaded with a flag arguments variant that accepts(&ignore_hidden,&recursive,&absolute_filepaths)
. - [API] Added
File.ends_with_separator()->Logical
that returnstrue
if a/
or `' is at the end of the filepath. - [API] Added
File.ensure_ends_with_separator()
. - [RogueC] Fixed
++
and--
to work on objects that are accessed through a get/set interface -++list[i]
becomeslist.set( i, list.get(i) + 1 )
. - [RogueC] Fixed typed literal lists to work again (the newish visitor system did not yet support them).
- [RogueC] Improved logic that guards against recursive getters to prevent false positives - previously only the calling argument count was checked, now the callee parameter count is checked as well.
- [RogueC] If the directive
--output=folder/filename
is given,folder
will automatically be created if it does not exist. - [RogueC] Added
--compile
directive that compiles the RogueC output but does not execute it. Automatically enables the--main
option. - [RogueC] Implicit narrowing reference casts are now illegal - the 'as' command must be used instead.
- [RogueC] Code generated for contingents now includes additional braces to scope local variables and prevent C++ warnings regarding jumping over local variable initializations.
- [RogueC] Dynamic method tables (vtables) are now generated for native classes (classes predefined in the Rogue runtime framework).
- [RogueC]
++
and--
now call getters and setters if necessary for property adjustments. - [Vim Syntax] Improved auto-indenting for verbatim strings (
@|Line 1\n |Line 2\n ...
) as well as routines.
- [Rogue] Reworked introspection so that lists of properties and global properties are stored in TypeInfo objects instead of being obtained from instanced objects. For example,
@Alpha.properties
and@Alpha.global_properties
access correspondingPropertyInfo[]
lists. - [Rogue] Reworked introspection setters and getters to use runtime data rather than generating new methods Rogue-side.
- [Rogue] Global properties now have getters and setters via
TypeInfo
objects that behave like object introspection methods. For instance,@SomeClass.set_global_property<<Int32>>("x",3)
. - [API] Shifted
collect_garbage()
and all introspection-related methods out of System class and into the Runtime class. - [Rogue] Added new postfix unary operator
isReference
that returns true if its operand type is a class or aspect reference type and false if it is a compound or primitive value type. Useful in type and method template definitions. Example:logical result = $DataType isReference
- [Rogue] 'if' statement conditions that resolve to a literal
true
orfalse
now clear the statement list of the opposing section, both as an optimization and as a way to write template code whereC++
would be unable to compile both sections of an type-basedif
statement. Note that elseIfs are automatically converted to nested if/else blocks. Also note thatif
statements in tasks may not receive this optimization. - [Rogue]
PropertyInfo
objects now containproperty_name_index:Int32
andproperty_type_index:Int32
as their core data and callRuntime.literal_string(index:Int32)
andRuntime.type_info(index:Int32)
to obtain property name strings and type info objects.
- [RogueC] Fixed order-of-compilation bug relating to property types not being
organize()d
before property introspection methods were generated. - [RogueC] Property introspection access methods now only handle properties defined in the current class and call the prior base class method to access any inherited properties.
- [Rogue] Each class's implicit
init_object()
method now callsprior.init_object()
as its first step. Inherited properties are now initialized by the prior method call and are not initialized in the extended class'sinit_object()
method.
- [Rogue] Changed property introspection setters to return
this
instead of nil. - [Rogue] Compound property introspection setters now have the same signature as regular class setters. However, the result must be reassigned to permanently change the compound. For example,
local xy = XY(3,4); xy = xy.set_property<<Real64>>("y",6); println xy # prints (3,6)
- [RogueC] Compounds may incorporate aspects (as before) but now the compiler does not consider them polymorphically compatible with those aspect types.
- [RogueC] When a method specifies
this
as its return type, the method gainsAttribute.returns_this
. References tothis
in aspects, including return values, are now converted into the incorporating type instead of remaining as the aspect type.
- [Rogue] Added property introspection.
obj.type_properties()->PropertyInfo[]
returns a list of property info objects. For any given property info object one can accessinfo.property_name->String
,info.property_type_name->String
, andinfo.property_type_info->TypeInfo
. To get and set class object properties through introspection, useobj.get_property<<DataType>>(name:String)->DataType
andobj.set_property<<DataType>>(name:String,new_value:DataType)
. Due to the nature of compounds they use a different setter mechanism: writecompound_value = CompoundType.set_property<<PropertyType>>( compound_value, "property_name", new_property_value )
. - [RogueC] Revamped method template system to be more robust and flexible, including: classes can now override specific versions of method templates as well as using specialized template syntax in method names even when no such template exists. For instance,
method frobozz<<Int32>>(...)
overrides any inherited definition of templatemethod frobozz<<$DataType>>
. - [API] Added an optional
allow_break_after:String
parameter toString.word_wrapped()
. If a line can't be broken on a newline or space it will be broken after any one of the supplied characters - the Rogue compiler specifies "," to break up long signature names. - [RogueC] Improved formatting of error messages in several ways, including that "method not found" errors now strip package names from signature to avoid bloat.
- [Rogue]
trace
can now be used with formatted strings, e.g.@trace "sum=$" (x+y)
. - [Rogue] Any methods overriding
requisite
methods now inherit therequisite
attribute.
- [Rogue] Added method templates. These operate as you might expect: method templates are defined with
method name<<$Type1,...>>(...)
and called with e.g.obj.name<<Int32>>(...)
. - [Rogue] Added
ensure
statement.ensure x
is convenience syntax forif (not x) x = TypeOfX()
,ensure y(a,b)
is equivalent toif (not y) y = TypeOfY(a,b)
, andensure x && y(a,b)
performs both checks in consecutive order. - [RogueC] Made named args more robust. While the compiler used to wait until a method was selected before adding the named args back in, it now inserts them at the beginning of call resolution if it can infer their location (i.e. two overloads don't contain the same parameter name at different positions).
- [API] Made functional programming more flexible. In addition to the in-place list modification methods
apply()
,filter()
,modify()
, andsort()
, there are now versions of those methods that return a modified list instead:applying()
,filtered()
,modified()
, andsorted()
. Note:filtered()
is functionally equivalent tochoose()
and so the latter method has been removed. - [API] Map/reduce functionality has been shifted from "helper classes" into List proper, made possible by method templates. Their names are
mapped
andreduced
, which is consistent with other functional programming methods in Rogue. - [API] Added
List.remove(Function(T)->Logical)->List
that removes and returns the list of values passing the test function. - [RogueC] Added method
Type.inject_method(Method)
that can be used to add a new method after the type has already been organized, correctly adjusting inherited method tables in extended classes. - [RogueC] Creating an object as a standalone statement now omits the post-
init_object()
typecast which prevents a C++ warning. - [RogueC] Renamed "flag args" to "named args" internally.
- [RogueC] Reworked native properties to be stored with regular properties instead separately. Fixes severe bug where classes with native properties were not polymorphically compatible with base classes or extended classes due to the order in which native properties were written out.
- [Rogue] A value being explicitly or implicitly converted (cast) now checks for to-type constructor methods as well as from-type conversion methods. So for
x:FromType -> ToType", the compiler first checks for a method
x->ToTypeand then checks for
ToType.init(FromType)or
ToType.create(FromType), resulting in a conversion to
ToType(x)` if that method is found. - [RogueC] Fixed some lingering references where global methods were called "routines" (their old name).
- [API] Added
Global.on_exit(Function())
that stores the given function object and calls it when a program ends normally or ends due to aSystem.exit(Int32)
call. - [Rogue] Added JSON-style literal syntax to create PropertyList and PropertyTable values as follows:
@{ key1:value1, key2:value2, ... }
creates a PropertyTable object. The keys do not require quotes.@[ value1, value2, ... ]
creates a PropertyList object.- Lists and tables may be nested; omit the leading
@
on nested structures.
- [API] Changed PropertyValue etc.
get_integer()
andget_real()
toget_int32()
andget_real64()
. - [API] Changed PropertyValue etc.
get_integer()
andget_real()
toget_int32()
andget_real64()
. - [API] Reworked printing infrastructure of PrintWriter, Global, and Console.
Global
andConsole
are both printwriters now, withConsole
being set as the defaultGlobal.standard_output
. In addition toprintln(value)
you can now print to the console directly withConsole.println(value)
. - [API] The Global singleton now flushes the console output buffer on exit.
- [API] Modified LineReader to not return an extra blank line if the very last character was '\n'. That logic was a side effect of a verbatim string printing issue that has since been separately addressed.
- [Rogue] Added preliminary introspection support.
@TypeName
is a convenience method for callingSystem.type_info("TypeName")
that returns aTypeInfo
object with aname
property. You can call.create_object()->Object
on a TypeInfo object, cast the Object to a specific type, and manually call one of the specific type'sinit()
methods. - [Rogue] Added
Object.type_info()->TypeInfo
that returns the runtime type (AKA "Class") of an object. - [Rogue] C++ now has a function
RogueType_type_info(RogueType*)->RogueTypeInfo*
that returns the runtime type info of an object. - [RogueC] CmdBinary and CmdUnary now call organize() on the operand types before proceeding to ensure that operator methods can be found if they exist.
- [Rogue]
assert
now accepts an optional custom message:assert(condition||message)
. - [Rogue]
assert(condition[||message])
may now be used as part of expression - for example,q = a / assert(b)
.b
is returned if it is "truthy" or if--debug
is not enabled. - [Rogue] Added
require(condition[||message])
that works just likeassert
except that it is always compiled in and does not depend on--debug
mode. A failed requirement will throw aRequirementError
. - [Rogue] Added class and method level
unitTest...endUnitTest
support (also single-lineunitTest ...
). Tests are compiled and run at launch if--test
is passed toroguec
and if the containing class is used in the program. - [Rogue] Added
[propagated]
method qualifier. Propagated methods are cloned each time they are inherited so that theirthis
reference has the correct type. This is primarily useful when implementing the Visitor pattern. - [RogueC] Implemented the Visitor pattern for misc. tasks. Removed
CmdAugment*.rogue
in favor ofTraceUsedCodeVisitor.rogue
andUpdateThisTypeVisitor.rogue
- much, much, simpler. - [RogueC] Tweaked CPPWriter's
print_arg()
to automatically cast the arg type to the param type if they differ. - [Standard Library] Used
--requisite
to find and fix some errors that had crept in due to other revamps.
- [Rogue] Added
assert(condition)
statement. When--debug
is enabled an AssertionError will be thrown if the condition is false. When--debug
is not enabled the assert is stripped during compilation. - [C++]
RogueObject_to_string(obj)
can now be called to invoke any object'sto->String()
method. Ifto->String()
was culled during compilation then the object's class name will be returned. Exceptionto->String()
methods are automatically marked[requisite]
. - [C++] The
to->String()
of any uncaught exceptions is now displayed at runtime. - [RogueC] Nil returns in
init()
methods are now automatically converted toreturn this
. - [RogueC] In mixed Int32-Character operations, Int32 is now promoted to Character rather than vice versa. Before,
Character(-1) > 0)
returnedfalse
even though Character is unsigned because it was being converted back to Int32 during the comparison. - [Syntax] Updated Vim and Sublime Text 3 syntax files.
- [Standard Library] Fixed bugs in
real_bits()
andinteger_bits()
.
- [Standard Library] - Moved core functionality for primitive
real_bits()
andinteger_bits()
out of global create methods and into those methods themselves. - [Standard Library] - Primitives can now be created and cast with constructor-style syntax, e.g.
n = Int32(3.4)
. - [Standard Library] - Printing an out-of-range Character code now prints a question mark (?).
- [RogueC] - Stand-alone ranges (outside of forEach loops) now accept a
step
size. - [RogueC] - If a range has no explicit step size then its default step type now matches the range type.
- [Standard Library] - Added
String.up_to_first()
and.up_to_last()
methods that are inclusive versions of.before_first/last()
. - [C++] - Fixed literal string generation to prevent ambiguous hex escapes, e.g. "\x9CCool" is now "\x9C" "Cool"
- [C++] - Renamed RogueString's
previous_byte_offset
andprevious_character_index
to becursor_offset
andcursor_index
. - [C++] - Added new method
RogueString_set_cursor(THIS,index)->RogueInt32
that takes a character index, sets the cachedcursor_offset
andcursor_index
in the string, and returnscursor_offset
.
- Converted String and StringBuilder to use utf8 bytes instead of a Character[] array internally while using character indices externally.
- Changed Character to be an unsigned 32-bit value.
- All string indexing and substring operations operate on whole characters (code points 0 through 10FFFF); characters never span multiple indices though the internal UTF8 representation has a variable size.
- Added classes
UTF8Reader:Reader<<Character>>
andUTF8Writer:Writer<<Character>>
that wrapByte
readers and writers to provide UTF-8 decoding and encoding. File.reader()
andFile.writer()
now return raw byte readers and writers whileFile.character_reader()
andFile.character_writer()
return UTF-8 readers and writers.- Fixed named parameters to work with routines.
- Removed [foreign] qualifier on String.
- Renamed C++ method
RogueString_create_from_c_string()
toRogueString_create_from_utf8()
. - Removed C++ method
RogueString_to_c_string()
; a RogueString'sutf8
property is a null-terminated UTF-8 string that can be cast directly toconst char*
.
- Fixed
Table
crash whenremove()
is called with a key that hashes to an unused bin.
- Restored default
==
and!=
functionality to compounds. No operator methods are required for equivalence comparisons.
- During call resolution, candidate methods not containing any given named args as parameters are discarded early.
- Fixed additional PROPERTIES in compounds to be initialized correctly.
- Compounds now generate an appropriate error message when operator methods are required but undefined (such as
operator==
).
- Fixed runtime instanceOf to return
false
instead oftrue
for null references. - Compounds can now be declared without properties.
- Routines can now be overloaded.
- Augments now work correctly again - augments to all specialized types (
Table
) and to specific specialized types (Table<<String,Int32>>
) are now applied correctly. - Fixed mysterious "unexpected end of line" error relating to augments - augments use special tokens indicating the beginning of augment code. Those tokens were labeled "end of line" (for some reason) and their application was slightly messed up.
- Changed C++ name adaptation syntax:
TemplateName<<Alpha,Beta>>
now becomesTemplateName_Alpha_Beta_
andTypeName[]
becomesTypeName_List
.
- Added default
init()
to base class Object. - Classes can no longer be instantiated with a default initializer if they have other initializers all with one or more args.
- Added
requisite
target toMakefile
that recompiles with the--requisite
flag. - Fixed bug where create() method candidates could be prematurely discarded from consideration in favor of
init()
methods with the same signature. - Tweaked the C++ name adaptation and validation to make it more robust and reduce the chances of conflict.
TemplateName<<Alpha,Beta>>
now becomesTemplate$Alpha_Beta$
andTypeName[]
becomesTypeName$List
.
- Added
block
/endBlock
control structure that scopes local variables and supportsescapeBlock
.
- Improved call resolution.
- For a call to
NewType(x)
, methods namedinit()
and global methods named create() are all considered simultaneously instead of in two separate steps as before. - If all else fails during call resolution the compiler will try and convert the arg of a 1-arg call
to->Object
,to->String
, orto->ParameterType
in that order (missing from previous release but present before that).
- Fixed overly liberal method selection so that for e.g. constructor
NewType(String)
,create(String)
will be matched beforeinit(Int32)
(this latter wasn't throwing an error due to String having ato->Int32
method). - Fixed runtime
as
andinstanceOf
to work with more than direct parent class checks. - Moved creation of compiler's
flat_base_types
to be on-demand when generating code.
- Reworked debug trace infrastructure; now substantially faster and more flexible - 1.3s vs 1.7s roguec recompile in debug mode.
- Debug Stack Trace now shows accurate line numbers.
- Fixed access resolution error where class
Global
could be checked before the current class context. - Fixed several errors resulting from compiling with
--requisite
.
- C++ exceptions and stdlib improvements.
- Fixed access resolution error where class
Global
could be checked before the current class context. - Fixed several errors resulting from compiling with
--requisite
.
- Aspects are now compatible with Object, instanceOf Object, and can be be cast to Object in more places.
- Added fallback property getters and setters to aspects.
- Added
consolidated()->String
method to String and StringBuilder. Operates similarly to Java's intern() and maps equivalent strings to a single string object instance. - Compiler now generates global properties for native classes and initializes them with the class's
init_class()
call. - Class File now includes native header
<cstdio>
when referenced.
- Renamed the methods of the plug-in architecture.
- Added beginnings of compiler plug-in infrastructure.
- Added
--version
directive. - Added explicit
[native]
attribute to type Object - the compiler was already doing so internally. - Removed unused, vestigial copy of global properties generated as static variables in class definitions.
- Improved
select{}
syntax -||
is used to separate all parts (select{ a:x || b:y || c:z || d }
) andx
may be used instead of bothx:x
andx.exists:x:value
(ifx
is an optional type). - Added up to less than range operator
..<
. For instance,forEach (i in 0..<count)
loops from0
tocount-1
.
- When used in implicit typing, routine calls now correctly report the return type instead of the type of the routine wrapper class.
- Added
String.contains(Character)->Logical
. - Renamed
String.pluralize()
toString.pluralized()
for consistency. - Moved
Boss.rogue
to its own library to avoid cluttering up the Standard library API. - Overridden methods are now culled when they're unused.
- Fixed
[requisite]
routines to work correctly when the routine has a return type. - Renamed
[functional]
to[foreign]
. A[foreign]
class is one that supplements a native non-Rogue reference type with methods callable from Rogue. This feature is still somewhat hard-coded for the C++ implementation of RogueString
. - Fixed method overriding to make sure the overriding method's return type is instanceOf the overridden method's return type instead of short-circuiting when the overridden method is abstract.
- Tightened up
reset()
andseek()
in various readers and writers, fixing a few potential bugs in the process.
- All compound/primitive/functional types now have default
to->Object
returning Boxed<<$DataType>>. - Routine [attributes] now apply to the routine as well as the method.
- stdlib.System: Expose GC threshold; make overridable
- stdlib.System: Improve
run()
method to throw error on failure and return exit code. - stdlib.File: Fixes and improvements
- stdlib.Object: Include address in default
to->String
- stdlib.PrintWriter: Flush more often
- Added .abs() to Real and Int primitives.
- Renamed Math.ceil() to ceiling().
$requisite ...
can now be specified inside a class or method to only take effect if the class or method is used.- Removed conversion of optional reference types to plain references to allow dependable functionality (e.g. boxing) to be present in class Optional<<$DataType>>.
- Improved error message when illegally naming a global method
init()
. - Changed some vestigial references of "routines" to be "global methods" instead in error messages.
- Fixed new side effect bug resolving statement list of
Global.on_launch()
. Was not expecting list to be modified while looping but the type-level "inner requisite" directive causes new CmdMakeRequisite nodes to be added toon_launch
. Resolving list would create new types which would add additional commands to list.
- Added '--gc=boehm' support for Boehm's garbage collector, courtesy Murphy McCauley.
- Added '--gc-threshold={number}[MB|K]' and increased default to 1MB.
- Changed the allocation tracker to count down from the threshold to 0 instead of counting up from 0 to the threshold.
- Fixed bug mapping variable writes to
set_
methods.
- Integrated MurphyMc's gc option which allows GC to happen during execution rather than only between calls into the Rogue system.
- Fixed a reference holding error in List.
++
and--
now work on compounds by transforming++compound
intocompound = compound.operator+(1)
and--compound
intocompound.operator+(-1)
.- Added full set of
operator
methods toDegrees
andRadians
compounds. Also addedDegrees.delta_to(other:Degrees)
which returns the smallest angle (which may be positive or negative) required to to from this angle to the specified other angle. For instance,Degrees(270).delta_to(Degrees(0))
returnsDegrees(90)
. - Added an elapsed time output when a compile is successful.
- Lists now have a default capacity of zero to begin with and do not allocate a backing array. When the first item is added an initial capacity of at last 10 is reserved.
- Changed syntax of
select{ condition:value, default_value }
toselect{ condition:value || default_value }
. - Removed support for compound modify-and-assign operators since they're only changing a stack copy of the compound. Rogue now automatically converts "compound += value" to "compound = compound + value".
-
operator+=
and other modify-and-assign operator methods now work with compounds as well as regular class types. -
System.environment
provides several ways to operate environment variables:.listing()->String[]
,get(name:String)->String
, andset(name:String,value:String)
. A small example:System.environment[ "STUFF" ] = "Whatever"
forEach (var_name in System.environment.listing) println "$ = $" (var_name,System.environment[var_name]) endForEach
System.environment[ "STUFF" ] = null
- Aspect types now correctly extend RogueObject in C++ code.
RogueObject_retain()
andRogueObject_release()
now guard againstNULL
.- Renamed
STL
library toCPP
.
- Objects requiring clean-up are no longer freed if they have non-zero reference counts.
- Removed trailing whitespace in all source files.
- Task system now works again. Any custom main loop should call
Rogue_update_tasks()
which returnstrue
if tasks are still active forfalse
if they've all finished.Rogue_update_tasks()
automatically runs the garbage collector if required. - Fixed a bug in
await
implementation by adding an internalyield
that was missing. - Added RogueCallback infrastructure for taking native actions before or after runtime events. The first two supported callbacks are
Rogue_on_begin_gc
andRogue_on_end_gc
. - Added Math.abs().
Task system example:
Tests()
println "Tests started!"
class Tests
METHODS
method init
run.start
method run [task]
print_numbers( 1, 10 ).start
await print_numbers( 10, 13 )
await print_numbers( 100, 103 )
print_numbers( 1000, 1003 ).start
method print_numbers( low:Int32, high:Int32 ) [task]
forEach (n in low..high)
println n
yield
endForEach
endClass
- Renamed
IntX.as_realx()
andRealX.as_intx()
to beIntX.real_bits()
andRealX.integer_bits()
. - Fixed GC code generation for compound properties.
- Fixed
local x = x
to throw a syntax error instead of crashing the compiler. - Fixed compiler crash when parsing a super-minimal class definition such as "class Name;".
- Compiler now ensures that 'as' is only used with references.
- Fixed bug where listing a base class after an aspect would corrupt the dynamic dispatch (vtable) ordering.
- Made several empty
Reader<<$DataType>>
methods abstract so they don't overwrite existing methods when incorporated in an extended class.
-
Fixed bug in aspect call mechanism.
-
Added
List.choose(Function($DataType)->Logical)->$DataType[]
that returns a list subset. Example:println Int32[][3,4,5,6].choose( function(n)=(n%2==0) )
-
Added
StackTrace.to->String
in addition to the existingStackTrace.print()
.
- Added call tracing when the
--debug
option is given. - Created StackTrace() class and added it to base Exception class. If
--debug
is enabled then you canex.stack_trace.print
when catching an exception. Seg faults (from referencing null) do not throw exceptions but the stack trace will still print out if--debug
is enabled. - Fixed bug when DEFINITIONS have more than one token.
- Tweaked default Reader
seek()
andskip()
methods.
- Fixed up inline native definitions and methods to work with op-assign and increment/decrement.
- Added convenience class
ListLookupTable<<$KeyType,$ValueType>>
where assigning a value to a key adds the value to a list of values instead of replacing a single value. - Reworked template overloading system.
- Added Real64/32
is_infinite()
,is_finite
,is_number()
, andis_not_a_number()/is_NaN()
as well as literal valuesinfinity
andNaN
. StringBuilder now prints those values correctly. - Can now write
@routine_name
to obtain a Function object that calls the routine. - Added STL library containing
STLPriorityQueue
. - Added
Set<<$DataType>>
to standard library.
- 'select' now uses curly braces instead of square brackets.
- The final case in a
select
can be optionally prefixed withothers:
. Example: https://gist.github.com/AbePralle/de8e46e025cffd47eea0 - Added support for template overloads (same name, different numbers of specializers).
- Bug fix in template backslash parsing.
- Added the
select
operator, Rogue's alternative to the ternary "decision operator". Example: https://gist.github.com/AbePralle/de8e46e025cffd47eea0 - Added
digit_count()->Int32
to all primitives that returns the number of characters that are required to represent the primitive in text form. - Added
whole_digit_count()
anddecimal_digit_count()->Int32
toReal64
andReal32
primitives. - Parser bug fix: class auto-initializer properties can contain EOLs.
- Improved macro method error messages.
- Fixed several File macro methods that were incorrectly defined with a
return
keyword. - Conditional compilation now respects nativeHeader and nativeCode blocks.
- nativeHeader and nativeCode blocks can appear at the global level, the class section level, or the statement level. In the latter two cases they are only applied if the class or method is referenced, respectively.
- Fixed generated trace() code to work for arrays of compounds that don't contain references.
- Added native code marker support for
$(var.retain) and $ (var.release) that yield the value of the given variable while increasing or decreasing the reference count of regular objects, preventing them from being GC'd while they're stored in a native collection. The markers yield the variable value with no reference count modifications for primitives and compounds.
-
Added additional native code insertion marker operations for native properties and inline native code.
-
$this
,$local_var_name
, and$property_name
are supported as before. - Parens may be added for clarity:
$(this)
etc. -
$(this.type)
,$(local_var_name.type)
, and$(property_name.type)
all print out the C++ type name of the given variable. Parens are required in this case. -
$($SpecializerName)
prints out the C++ type name of a template type specializer. For instance, inclass Table<<$KeyType,$ValueType>>
, referring to$($KeyType)
in your inlined native code would writeRogueInt32
for aTable<<Int32,String>>
, etc.
-
- Fixed off-by-one error in List.remove_at() that was causing seg faults on Linux.
- Updated Makefile.
- Renamed
Time.current()
toSystem.time()
and removed theTime
class. - Default main() now GC's 3 times at the end to allow objects requiring clean-up a chance to do so.
- Adjacent string literal concatenation now works for strings that were template specializers.
- Default main() now GC's 3 times at the end to allow objects requiring clean-up a chance to do so.
- Adjacent string literals are now concatenated into a single string literal.
- First full release.
- Initial beta release.