3 ms·
The DSL is compiled to Julia, and may contain arbitrary Julia expressions which are spliced into the result. Relations may also contain arbitrary Julia datatype
by jamii 10y ago
The DSL is compiled to Julia, and may contain arbitrary Julia expressions which are spliced into the result. Relations may also contain arbitrary Julia datatypes. Eg in:
@query begin
state() => current_state
x in 1:num_x
y in 1:num_y
is_cleared = @exists cleared($x,$y)
is_mine = @exists mine($x,$y)
mine_count(x, y) => count
cell_node = @match (current_state, is_mine, is_cleared, count) begin
(:game_in_progress, _, true, 0) => button("_")
(:game_in_progress, _, true, _) => button(string(count))
(:game_in_progress, _, false, _) => button(Dict(:onclick => @event clicked(x,y)), "X")
(:game_won, true, _, _) => button("")
(:game_lost, true, _, _) => button("")
(_, false, _, _) => button(string(count))
other => error("The hell is this: $other")
end
return cell(x,y) => cell_node
end
@match is a Julia macro, button, string, Dict etc are Julia functions and cell_node is a DOM node.
The point of Imp is to be able to write entire apps without having to context switch between multiple languages and systems. It needs to have a full-blown language in the database because there isn't going to be an application or frontend tier.
- gravypod 10y agoThat sounds like playing with a metal forgery and the only protection you have on is oven mitts.