I have moved
with-clr-type and friends to the
(ironscheme clr shorthand) library.
clr-field-set! have been modified to infer the type based on the instance argument. This is good news, as it allows me to apply
with-clr-type‘s shorthand syntax fluidly (or recursively).
To utilize this feature, you simply have to pass
#f as the type argument in the macros. Note: This only applies to instance members. For static members, you are still required to provide the type.
The method and indexer syntax has been slightly modified to accommodate this.
body syntax is as follows (
rest denotes continuable syntax):
(obj : id (arg ...) . rest) ; calls method 'id' with args (obj : (arg ...) = value) ; sets the indexer with args to a value (obj : (arg ...) . rest) ; gets the indexer with args (obj : id = value) ; sets a property 'id' to a value (obj : id . rest) ; gets a property 'id' (obj -> id = value) ; sets a field 'id' to a value (obj -> id . rest) ; gets a field 'id'
Example (given the class defined in the previous posting):
(let-clr-type ((obj (TestClass "foo"))) (obj : Message : (1))) ; C#: obj.Message => #\o
Also added to the
(ironscheme clr shorthand) library are
lambda-clr-type syntax, that binds and defines procedures with their arguments tagged as CLR types.
As you can see, now the ability to use .NET libraries should be a lot easier.