bitspark / slang Goto Github PK
View Code? Open in Web Editor NEWSLANG engine written in Go
Home Page: https://bitspark.de/slang/
License: Apache License 2.0
SLANG engine written in Go
Home Page: https://bitspark.de/slang/
License: Apache License 2.0
Background
Right now, we don't know which builtin operators are really necessary or how we should name them. Maybe we need to split them up in the future or give them a different behavior. However, until then these builtin operator will be baked into many many other operators so we cannot simply change their names or behavior.
Proposed solution
Register the builtin operators under a slib-like name such as slib.loop
instead of just loop
. This would allow us to implement the loop operator differently by simply removing the builtin operator entirely and write a slib operator with the same signature. No operator using slib.loop
would behave differently because it will simply use the slib operator instead.
It would seemlessly work with our current implementation because we always check if there exists a builtin operator with that name (regardless whether it contains a .
dot or not).
loop
-> slib.loop
merge
-> slib.merge
fork
-> slib.fork
agg
-> slib.agg
reduce
-> slib.reduce
const
-> slib.const
eval
-> slib.eval
After #4 we need a persistent storage of objects. This is the goal of this issue.
Connect the DB layer to a MongoDB server. Also provide the means to configure the connection in a separate JSON file (e.g. database.json
).
The reason why we want a different JSON file is that we need a separation of logic and system configuration. Everything contained in the program_xyz.json
file should be completely independent from the environment and potentially run everywhere. That is clearly not the case for database settings.
currently generics are just map of PortDef
s. This works for us but a specific typo Generics
would be fine
Don't just push infinitely many items to out, but rather think of implementing a pull-based approach. Only when an operator pulls the operator should serve an element.
Wait is just a passer which delays redirecting.
It has two inputs (time and item) and one output.
InstanceDef
per TestCaseInvestigate & fix
There might occur problems when a trigger is listening on a map or a stream if only sub
or subs
is connected. In this case the trigger will never fire.
Possible solution
Map
When connecting a map with a trigger you could either ask the user to connect with a map sub port instead or arbitrarily descend and do it automatically.
Stream
This one is more difficult. One solution would be to remember the source port and descend. When pulling from this port, it would suffice if an appropriate marker (ideally BOS
) appears.
#116 <--
Currently there is no way to specify another working directory in slang. That means, requesting or loading custom OperatorDef
s will only works from slang-deamons working directory.
We need the possibility for specifying different working directories within environments, from which operators can be loaded.
I might suggest following changes:
SlangEnv
, Env
, Environment
, ->Environ
<-) to package "api"package "api"
type Environ struct {
paths []string // paths[0] is always working dir
}
Environ
which need a correct working-dirUntil now, Slang applications are tiny and there is no need for heavy debugging or performance optimization tools.
However, in the future we might want to have
Extend the Port
structure with two methods for pushing and pulling complex objects.
builtin.MakeOperator
to builtin.NewOperator
builtin.MakeOperator
within builtin
operator testsMake...
into New...
...Def
structs in separate file slang/op/def.goAssertions.PortPushes
ParseConnection
into ParsePort
Parse...Def
from package slang/op
into slang
slang/op
into slang/core
Implement URL mapping of URLs to operators. This is needed to create an API server or a simple web server. Take the request method into consideration.
This issue includes configuration (ideally part of the program JSON configuration file) and implementation. Implementation includes starting an HTTP server and redirecting requests to the correct operators / returning response back to the client following the mapping configuration.
Mapping should allow for adding placeholders which produce values that are inserted into the according operators (e.g. /findPerson/:firstName/:lastName
will produce firstName
and lastName
as stream outputs that can be connected to operator input ports).
Important: Do not forget that we want to be able to use foreign operators inside other operators. HTTP mapping must be an addition, not a replacement for automatic API generation.
Also think about a similar mapping for WebSockets (implementation not part of this issue).
readLibPathsFromEnvironment adds slangd's workingdir. Since slangd will run as a server, that workingdir is not working for us anymore
... to allow for propagation of properties through operators.
It would also allow for specifying constant values by wrapping an oberator together with several const
operatorts which take their constant value from the properties map (currying).
Implement automatic generation of a Port
from a JSON schema.
Names in map ports cannot be changed easily one they are being used.
Therefore we should choose good names and put more thought into them.
Implement rudimentary database features and provide an API for them. The API shall be later used within object and class operators.
It should provide
After implementation one should be able to
Later, it should be connected to a MongoDB server. For now, a temporary RAM solution is enough to close this issue.
Trivial case:
{
"name": "test",
"in": {"type":"number"},
"out": {"type":"number"},
"operators": {},
"connections": {
"test.in": ["test.out"]
}
}
Invalid cases:
More complex example:
{
"name": "test2",
"in": {"type":"map", "map":{"a": {"type": "number"}, "b": {"type": "number"}}},
"out": {"type":"number"},
"operators": {
"add1": {
"type": "function",
"properties": {
"function": "x+y"
}
}
},
"connections": {
"test2.in[a]": ["add1.in[x]"],
"test2.in[b]": ["add1.in[y]"],
"add1.out": ["test2.out"]
}
}
tests
packagetests
package becomes a package for test utilities (old tests/assertions
package which can be removes)_
as separator?__
as separator?Think about a basic set of operators needed to construct arbitrary programs. Also think about operators which can push and pop streams from the stream stack (i.e. start new streams or "gulp" streams / generators and aggregators).
Implement these basic operators and test them thoroughly.
Proposal for new operator definitions
in:
type: number
out:
type: number
delegates:
delegate1:
in:
type: number
out:
type: number
properties:
- prop1
operators:
op1:
operator: opName1
op2:
operator: opName2
properties:
prop: $prop1
connections:
(:
- (op1
op1):
- (delegate1
delegate1):
- (op2
op2):
- )
Changes
delegates
for wiring out delegate portsproperties
for allowing to specify properties when instancing$
to indicate usage of property variables specified in properties
... such as
Some operators have to delegate data processing to another operator / series of operators (aka pipeline).
Examples include reduce
, loop
, agg
, take
, ...
Currently, in
and out
ports are used for that purpose. But conceptionally this doesn't seem right. in
ports should be regarded as ports which take one logical element and output another logical element emerging from it. This is currently not the case with loop
and others.
Instead, introduce delegate
s. Each delegate belongs to an operator and consists of an in
and an out
port.
loop
Think of a loop
instance looper
. In the following, there is a comparison between the ports (descended to the maximum) now and then.
init(looper
iteration.state(looper
iteration.continue(looper
looper)end
looper)state
(looper
state(looper.iterator
continue(looper.iterator
looper)
looper.iterator)
(looper
looper)
state(looper.iterator
continue(looper.iterator
looper.iterator)
Another big advantage would be that many pointless port names are rendered unnecessary this way (here: iteration
, init
, end
).
Also allow for testing of generic operators.
Name Delegate.op
same as Port.operator
Change in and out to generic types in sllib/
Think about a migration concept. Migrations could probably be implemented as "disposable operators" that are executed once in the migration train, just like ordinary migrations known from Rails, Django, ...
Make Port of type="Any" allow passing items of any streams, maps or primitives.
Currently type="Any" just means a primitive of any datatype
[ ] allow for arbitrary in ports
[ ] rename to eval
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.