Skip to main content

Sasa v0.9.4-RC1

Over two years in coming, I've just uploaded the first release candidate for Sasa v0.9.4.

Quite a few changes in this release which I'll detail more fully once I'm closer to the final release. Suffice it to say that this release contains many small bug fixes, specifically to the MIME multipart parsing, more tests with a switch to xUnit unit-testing framework, and numerous enhancements and more powerful abstractions across the board. Some of these abstractions have appeared in blog posts here over the past two years, like the extensible Pratt parser, the purely functional hash-array mapped trie, and a simple software transactional memory in pure C#, to name but a few.

The libraries are now also better organized into logical units. You can peruse the documentation online.

Here is a mostly complete change log for the curious:

  • added a function to convert integers into an English sentence representation.
  • added custom equality and comparisons extensions for strings.
  • added Sasa.Values which provides various extensions on general values.
  • PrattParser was not counting lines for skipped symbols.
  • PrattParser was not initializing LeftBindingPower in Match declaration.
  • added an error condition signalling an invalid parse if the input is not  fully consumed.
  • added line and column information to tokens and parse errors.
  • added a regex scanner to PrattGrammar.
  • added a declaration for parsing delimited values, and for parsing lists of values.
  • fixed quoted address MIME parsing test.
  • added preliminary capability-secure file system API.
  • MIME body encodings weren't being parsed or used when round-tripping.
  • fixed base64 encoding of simple e-mail body.
  • added a purely functional reference, aka a "lens".
  • added MIME encoded-word support to ParseMailMessage and ToRaw methods.
  • Base64 string encoding extensions now take an optional parameter specifying the string encoding to use.
  • quoted-printable decoding now properly returns a byte array.
  • MIME text encodings now properly respected.
  • added tests for generic value membership tests.
  • added Property<T>, an implementation of IObservable<T> and IObserver<T> which  aggregates distinct values and can be compacted to retain only the last  value.
  • added an IVersioned<T> interface which defines a protocol for values that  change over time and retain a history of their values.
  • ilrewrite now properly handles nested generic type arguments, and generic interfaces.
  • added Sasa.Linq.Expressions, a statically typed library for Linq expression trees.
  • MIME encoded word replaces _ with spaces.
  • ensure subject and body encodings are preserved in replies.
  • work around System.Net.Mail.MailMessage parsing bug for unicode addresses.
  • added a new TypeConstraint assertion to simplify working with constraints.
  • added array append overload for a single parameter.
  • separated the notions of TypeCase and reflection.
  • fixed generic type argument bug in method cache.
  • split IReflector into IBuilder and IReducer which more cleanly separates the  concerns involved in type case and reflection.
  • refactored Type<> into distinct typecase and reflection(Reflect<T>)  operations.
  • eliminated DynamicType and used a multicast delegate-based PIC.
  • added coalescing operators to Option<T>.
  • generalized IReflected to accommodate any build/reduce pattern, and not  just ones specific to typecase and reflection.
  • removed Sasa.String namespace.
  • deleted Sasa.Core.dll and some abstractions to Sasa.Concurrency.dll, and the rest back into Sasa.dll.
  • moved Endian and binary encoding abstractions into Sasa.Binary.
  • renamed Tuple._ to Tuple.Create.
  • added a typed enumerable interface that statically specifies the sequence  ordering and duplicate semantics.
  • added a Result<T> type that encapsulates the results of computations that  may produce errors, and the associated LINQ operations to permit the use of query syntax.
  • added implicit conversions to/from Option<T> and Result<T>.
  • added NamedProperty<T> that extends Property<T> to implement  INotifyPropertyChanged and INotifyPropertyChanging.
  • transform a lazy sequence of values that may throw an error, into a  sequence of Result<T>.
  • added a ThreadScoped<T> thread-local instance object.
  • added a simple software transactional memory under Sasa.TM.
  • added a simple blocking-pull WaitQueue.
  • added naive difference algorithm for IEnumerable<T>.
  • support public registration of media types and file extensions.
  • refactored rarely used function programming abstractions to Sasa.FP.
  • added typed delegate creation functions.
  • merged CodeGen.Function to Sasa.Func.Generate, and removed old code.
  • moved Sasa.Enum.Enums to top-level Sasa namespace.
  • Operators<T> moved to Sasa.dll and uses lightweight codegen with  cached delegates for operators.
  • eliminated special-purpose numeric code and provided generalized  numeric extensions using Operators<T> and IComparable<T>.
  • Tuple static class renamed to Tuples to avoid name collision with  .NET 4.
  • Added ad-hoc static and dynamic extensible visitor implementation.
  • Added some array parsing combinators.
  • Added a simple Binomial tree to Sasa.FP.
  • More rigourous Option<T> and Result<T> semantics, more closely following  .NET conventions.
  • added a simple IoC abstraction under Sasa.IoC.
  • added functions to convert closed to open delegates.
  • added functions to extract delegates for getters/setters.
  • eliminated useless FilePath.Root method.
  • added FilePath.Jail methods to ensure paths don't escape.
  • added an overloaded Stream.CopyTo method that accepts a number of  bytes to copy.
  • HardWrapAt had useless semantics by ignoring newlines, so process  wrapping one line at a time
  • added new overloads to Lines extension method to support an option  whether to return empty lines
  • RFC822 header code now explicitly specifies to skip empty entries
  • corrected and simplified MIME parsing code that was mixing up encodings
  • corrected quoted printable interface that accepted a string parameter,  when it should only accept byte arrays
  • corrected MIME parsing code which incorrectly flattened nested multipart messages (thanks for the bug report Evan Ezewski!)
  • corrected MIME parsing that was placing multipart/alternative into  attachments instead of AlternateView collection (thanks for the bug report Evan Ezewski!)
  • added support for MIME Content-ID header
  • switched all unit tests to xUnit.net
  • fixed Sasa.Contracts API to more closely conform to code contracts  released in .NET 4
  • enabled full static code analysis and made numerous identified fixes and naming convention changes to conform to CLR standards
  • added numerous typed reflection-like functions into Types
  • Events.Push now part of the standard thread-safe event API
  • overloaded Stream.CopyTo to accept an explicit number of bytes to copy
  • added Sasa.Security assembly and moved Sasa.IO.FileSystem there
  • rewrote FileSystem internals to use faster FilePath
  • changed FileSystem API to track parent permissions for move/copy ops
  • added delegate types and overloads for open instance methods to value types
  • rewrote compact binary serialization using Sasa.Dynamics
  • moved IAtomic to Sasa since it could be implemented by any sort of struct
  • added a DisposableFile abstraction to simplify file management
  • factored out lexing from PrattGrammar into an extensible lexing framework
  • Types.ShortName now properly handles arrays without using fully qualified   names.
  • ilrewrite now signs assemblies if the /key: parameter is provided.

Comments

Popular posts from this blog

async.h - asynchronous, stackless subroutines in C

The async/await idiom is becoming increasingly popular. The first widely used language to include it was C#, and it has now spread into JavaScript and Rust. Now C/C++ programmers don't have to feel left out, because async.h is a header-only library that brings async/await to C! Features: It's 100% portable C. It requires very little state (2 bytes). It's not dependent on an OS. It's a bit simpler to understand than protothreads because the async state is caller-saved rather than callee-saved. #include "async.h" struct async pt; struct timer timer; async example(struct async *pt) { async_begin(pt); while(1) { if(initiate_io()) { timer_start(&timer); await(io_completed() || timer_expired(&timer)); read_data(); } } async_end; } This library is basically a modified version of the idioms found in the Protothreads library by Adam Dunkels, so it's not truly ground bre

Building a Query DSL in C#

I recently built a REST API prototype where one of the endpoints accepted a string representing a filter to apply to a set of results. For instance, for entities with named properties "Foo" and "Bar", a string like "(Foo = 'some string') or (Bar > 99)" would filter out the results where either Bar is less than or equal to 99, or Foo is not "some string". This would translate pretty straightforwardly into a SQL query, but as a masochist I was set on using Google Datastore as the backend, which unfortunately has a limited filtering API : It does not support disjunctions, ie. "OR" clauses. It does not support filtering using inequalities on more than one property. It does not support a not-equal operation. So in this post, I will describe the design which achieves the following goals: A backend-agnostic querying API supporting arbitrary clauses, conjunctions ("AND"), and disjunctions ("OR"). Implemen

Easy Automatic Differentiation in C#

I've recently been researching optimization and automatic differentiation (AD) , and decided to take a crack at distilling its essence in C#. Note that automatic differentiation (AD) is different than numerical differentiation . Math.NET already provides excellent support for numerical differentiation . C# doesn't seem to have many options for automatic differentiation, consisting mainly of an F# library with an interop layer, or paid libraries . Neither of these are suitable for learning how AD works. So here's a simple C# implementation of AD that relies on only two things: C#'s operator overloading, and arrays to represent the derivatives, which I think makes it pretty easy to understand. It's not particularly efficient, but it's simple! See the "Optimizations" section at the end if you want a very efficient specialization of this technique. What is Automatic Differentiation? Simply put, automatic differentiation is a technique for calcu