aboutsummaryrefslogtreecommitdiffstats
path: root/alv/base
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-05-09 14:49:08 +0000
committers-ol <s+removethis@s-ol.nu>2025-03-02 14:23:21 +0000
commit61eb86951287667ca0ee305baa5c3cd6ad29ba36 (patch)
tree7551d6b9c8af01c049adab0ee027dbad68f28808 /alv/base
parentmore internal doc fixes (diff)
downloadalive-61eb86951287667ca0ee305baa5c3cd6ad29ba36.tar.gz
alive-61eb86951287667ca0ee305baa5c3cd6ad29ba36.zip
add types.T, fix spec + docs
Diffstat (limited to 'alv/base')
-rw-r--r--alv/base/init.moon8
-rw-r--r--alv/base/input.moon30
2 files changed, 21 insertions, 17 deletions
diff --git a/alv/base/init.moon b/alv/base/init.moon
index 62de2ab..90f1dfc 100644
--- a/alv/base/init.moon
+++ b/alv/base/init.moon
@@ -15,6 +15,10 @@
-- @see SigStream
-- @see EvtStream
-- @see IOStream
+-- @see type.T
+-- @see type.Primitive
+-- @see type.Array
+-- @see type.Struct
-- @see RTNode
-- @see Error
@@ -24,7 +28,7 @@ import FnDef from require 'alv.base.fndef'
import Input from require 'alv.base.input'
import val, evt from require 'alv.base.match'
import Constant, SigStream, EvtStream, IOStream from require 'alv.result'
-import Primitive, Array, Struct from require 'alv.type'
+import T, Primitive, Array, Struct from require 'alv.type'
import RTNode from require 'alv.rtnode'
import Error from require 'alv.error'
@@ -41,7 +45,7 @@ import Error from require 'alv.error'
:Constant, :SigStream, :EvtStream, :IOStream
-- Types
- :Primitive, :Array, :Struct
+ :T, :Primitive, :Array, :Struct
:RTNode
:Error
diff --git a/alv/base/input.moon b/alv/base/input.moon
index a9f0e32..b73a476 100644
--- a/alv/base/input.moon
+++ b/alv/base/input.moon
@@ -35,9 +35,9 @@ class Input
--- create a new Input.
--
-- @classmethod
- -- @tparam Result stream
- new: (@stream) =>
- assert @stream, "nil passed to Input: #{value}"
+ -- @tparam Result result
+ new: (@result) =>
+ assert @result, "nil passed to Input: #{value}"
--- copy state from old instance (optional).
--
@@ -53,10 +53,10 @@ class Input
--
-- must return a boolean indicating whether `Op`s that refer to this instance
-- should be notified (via `Op:tick`). If not overwritten, delegates to
- -- `stream`:@{SigStream:dirty|dirty}.
+ -- `result`:@{SigStream:dirty|dirty}.
--
-- @treturn bool whether processing is necessary
- dirty: => @stream\dirty!
+ dirty: => @result\dirty!
--- leave setup state (optional).
--
@@ -67,25 +67,25 @@ class Input
--- unwrap to Lua value (optional).
--
-- @treturn any the raw Lua value
- unwrap: => @stream\unwrap!
+ unwrap: => @result\unwrap!
--- return the type name of this `Input` (optional).
- type: => @stream.type
+ type: => @result.type
--- return the metatype name of this `Input` (optional).
- metatype: => @stream.metatype
+ metatype: => @result.metatype
--- the current value
--
- -- @tfield SigStream stream
+ -- @tfield SigStream result
--- members
-- @section members
--- alias for `unwrap`.
- __call: => @stream\unwrap!
+ __call: => @result\unwrap!
- __tostring: => "#{@@__name}:#{@stream}"
+ __tostring: => "#{@@__name}:#{@result}"
__inherited: (cls) =>
cls.__base.__call = @__call
cls.__base.__tostring = @__tostring
@@ -95,7 +95,7 @@ class Input
--- Create a `cold` `Input`.
--
- -- Never marked dirty. Use this for input streams that are only read when
+ -- Never marked dirty. Use this for input results that are only read when
-- another `Input` is dirty.
--
-- @tparam Result|RTNode value
@@ -128,17 +128,17 @@ class ColdInput extends Input
dirty: => false
class ValueInput extends Input
- setup: (old) => @dirty_setup = not old or @stream != old.stream
+ setup: (old) => @dirty_setup = not old or @result != old.result
finish_setup: => @dirty_setup = nil
dirty: =>
return @dirty_setup if @dirty_setup != nil
- @stream\dirty!
+ @result\dirty!
class IOInput extends Input
io: true
mapping = {
- [Constant]: ColdInput
+ [Constant]: ValueInput
[SigStream]: ValueInput
[EvtStream]: Input
[IOStream]: IOInput