The Crystal programming language | http://crystal-lang.org | Fund Crystal's development: http://is.gd/X7PRtI | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/
platform: posix
. Create a windows anonymous memory shard (No mmap equivalent that handles all functions) with platform: windows
. Create a generic anon memory wrapper shard that includes both. Create a guard page key holding shard similar to sodium_malloc
using the anon memory shard.
mmap
like mapping a file, I can't do that on windows as it uses a completely different API
platform
as a restriction wouldn't be used with pure portable crystal shards, only platform specific shards. platform
as a dependency may be specified to override. See the inotify example. Generic file polling may work everywhere but on linux you may prefer inotify
. On BSD eventually kqueue
. Although technically those should have their own platform limitations so the dependency limit should only be placed on generic file polling.
alias PermissiveType = Array(String | Int32) | String
s : PermissiveType = "hello world" #works
ss : PermissiveType = ["hello", "world"] # must be (Array(Int32 | String) | String), not Array(String)
PermissiveType
is strictly more permissive than Array(String)
this cast should be possible - any possible value of that more restrictive type should satisfy the more permissive type.
@ryanprior:matrix.org What you are running into is that while one can logically look at an Array(String) and see that an Array(String | Int32) can store everything in it, type specifications are very specific, and your type specification is for two things, either an Array(String | Int32), or String, and what you are trying to assign is an Array(String), which is not either of those things.
ss : PermissiveType = Array(String | Int32).new + ["hello", "world"]
That will create an array with a type signature that matches what PermissiveType allows.
Array(String)
@didactic-drunk that complete functionality doesn't exist so far as I am aware, but all of the building blocks exist. Maybe it can be my macro-hacking project of the week to build it.
Right now I am picturing something such as simple as include CallTrace
, followed by an annotation on top of any method that one want's to build a call tracing stack for.
The actual call trace would be accessible at any time.
A
as one of the branches of the case since it cannot have an instantiation at runtime
when
value is a type as the compiler expands it to is_a?