Fork me on GitHub
#hyperfiddle
<
2023-09-20
>
grounded_sage10:09:59

Does this work on generic mode with calva? I can't seem to make the switch to cljs.

Dustin Getz10:09:33

i believe that button is bugged, the command should work from the command bar

grounded_sage11:09:49

Also doesn't appear to work for me. I am on electric-starter-app. It's not a show stopper for me. Just looking at improving my dev experience where I can and noticed this in the docs.

Dustin Getz11:09:49

it is not an electric issue it is a recent calva issue iiuc

Dustin Getz11:09:02

the command should work

pez13:09:35

I should fix that button.

🙏 1
Vincent16:09:25

More good news about my workflow: When I have a working copy of my app locally, I can essentially copy/paste deploy to production. I bet that makes some of you have your hairs stand on end. Oh yeah, gunslinging cowboy coding :face_with_cowboy_hat:

nivekuil17:09:13

are all declarative interfaces just managed effects over imperative interfaces?

👀 1
Dustin Getz18:09:15

its an interesting question, perhaps it is true in practice, even {:a {:b 42}} has imperative construction on imperative hardware so i guess it depends how closely you are looking, how many layers deep you want to go and what assumptions we are making about the operational environment

Dustin Getz18:09:35

the real world i think is best modeled by differential equations, which is not an imperative model

Dustin Getz18:09:37

a more practical world-view would be that declarative means "data parallel" or simply "data"

Dustin Getz18:09:30

at this point it gets fuzzy for me, we can ask if data is primitive or if lambda is more primitive, you can implement data out of lambda but I don't think you can implement lambda out of data (if this is even the right framing)

Dustin Getz18:09:09

is lambda imperative? I propose it's orthogonal, per this image

nivekuil18:09:36

what does managed effects have to do with lambda?

nivekuil19:09:27

more practically, could we say every declarative interface has an ad-hoc etc. managed effects system at its core?

nivekuil19:09:33

by interface I mean something which facilitates action, not prediction as with equations

Dustin Getz19:09:01

the universe performs action and yet is modeled by equations. the challenge is knowing the initial conditions but if you can establish that, prediction == action

nivekuil19:09:35

digression, but actions are the objects of prediction, i don't see how those can be equivalent

Dustin Getz19:09:25

what even is action

Dustin Getz19:09:52

our subjective experience?

Dustin Getz19:09:52

do you have any sources from a physicist?

nivekuil19:09:36

I have a high-school level understanding of physics, you don't want to hear my opinions on physics.. but what does that have to do with anything

Dustin Getz19:09:18

because to answer your q, we have to know what "declarative" means, which is closely related to the concept of "data", so now we need to know what data is and in particular if it is separate from "computation" in this context

Dustin Getz19:09:13

and then separate "computation" abstractly from the machinery of the computation - e.g. digital computer vs pen and paper

Dustin Getz19:09:01

so is user=> 1 an imperative computation? What meaning is it meant to have?

Dustin Getz19:09:29

a java lang Long got boxed up and electric power was consumed

Dustin Getz19:09:09

we can give it other forms of meaning, abstracting ourselves from the platform

Dustin Getz19:09:17

so what is the math of 1

nivekuil19:09:57

well, in language in general a declarative statement doesn't imply any sort of action. I guess for a declarative interface the better mapping would be the subjunctive mood, "The button is blue" vs "Let the button be blue"

Dustin Getz19:09:16

i accept that

Dustin Getz19:09:04

"let c denote the speed of light"

Dustin Getz19:09:45

denote /dɪ'noʊt/ verb have as a meaning

Dustin Getz19:09:50

(my-dsl {:button :blue}) is my-dsl going to render this to dom? or is it going to capitalize all keywords?

nivekuil19:09:05

I think to answer this question you'd need to think about the theory of language in general, because declarative and imperative are properties of language, not physics or anything else.. interestingly the general attributes like idempotence exists in both natural language and programming ("Let the button be this shade of blue" vs "Paint the button with this shade of blue")

Dustin Getz19:09:04

I propose that declarative and imperative are properties of computation in the domain of your question?

Dustin Getz19:09:41

I think you're right that theory of language is relevant

nivekuil19:09:26

I think by interface I mean interfaces to computation (flipping transistors?), which are languages

Dustin Getz19:09:50

Ok, that means we are abstracted from the execution machinery, which is suitable

Dustin Getz19:09:50

lets further specify, for the sake of concreteness, that it's in the context of a language without side effects (you can have IO monad)

Dustin Getz19:09:16

here's a dsl to consider - (select-keys x [:a :b]) vs (hash-map :a (get x :a) :b (get x :b))

Dustin Getz19:09:06

dsl is [:a :b] and it can either be interpreted or compiled/macroexpanded

Dustin Getz19:09:43

either way it evaluates to some pure computation in our theoretical pure functional language

Dustin Getz19:09:37

i'd call it declarative and i wouldn't call that managed effects especially given that we are basically evaluating this on pen and paper not on a digital machine

Dustin Getz20:09:35

one might ask "what is hash-map? what is get?" as we haven't denoted it, and i guess we're in philosophy of language again

nivekuil20:09:25

isn't any language without side effects declarative by definition

Dustin Getz20:09:11

yea that article is trash

Dustin Getz20:09:40

at this point at least we need to say, "a computation is declarative with respect to X"

Dustin Getz20:09:52

electric is declarative with respect to client/server network sync

Dustin Getz20:09:40

is haskell declarative with respect to memory usage? Hardly

nivekuil20:09:13

maybe: in order to be useful, a program needs effects. if that program wants to stay declarative, it needs managed effects

Dustin Getz20:09:37

Lisp is declarative in that it is homoiconic which enables userland metaprogramming, but lisp programs also have mutable state

Dustin Getz20:09:35

imagine a SQL query planner, the input is the userland sql and the output is the plan, that is data -> data

Dustin Getz20:09:55

is "plan" a managed effect? Probably yes, now we ask what is a managed effect?

Dustin Getz20:09:59

Data describing an effect?

Dustin Getz20:09:12

back to philosophy

Dustin Getz20:09:09

what is data, what is an effect, i dont think one needs to actually answer that

Dustin Getz20:09:48

its models all the way down, subsitute a virtual cpu for the hardware cpu and now your programs are referentially transparent and you can serialize a VM state and move it over network

nivekuil20:09:24

you're saying "plan" is a managed effect because it describes some work to be done outside the program?

nivekuil20:09:22

I thought the idea of managed effects is that the entire lifecycle of that effect is managed within the program. so your sql query planner program couldn't care less if the plan execution threw an exception

nivekuil20:09:20

if you wouldn't use a monad there's no effects going on yet right

Dustin Getz20:09:47

Monad is an abstract structure

Dustin Getz20:09:01

you can represent effects in many ways

Dustin Getz20:09:19

#(println 1) for example is a value

Dustin Getz20:09:56

unsafePerformIO on this value would be invoke

Dustin Getz20:09:13

we could demonstrate that there is a Monad instance for this concrete type

Dustin Getz20:09:54

join :: Monad m => m (m x) -> m x

Dustin Getz20:09:20

(fn [] (fn [] (println 1)))

nivekuil20:09:19

I mean, you would never think about reaching for abstractions like monads for a referentially transparent program like your query planner

Dustin Getz20:09:36

'(println 1) is just as good, as is [:clojure.core/println 1]

nivekuil20:09:33

so I don't see how "plan" is any kind of effect, there's a point at which data becomes data describing an effect, and that point has nothing to do with the data itself

Dustin Getz20:09:00

well the plan needs to be evaluated

Dustin Getz20:09:17

and it has an operational SLA - time budget, disk IO budget

Dustin Getz20:09:41

the plan surely encodes concurrency, certain parts of the plan can execute in parallel

Dustin Getz20:09:07

the plan probably has control flow (if statements) – it will use heuristics to decide which algorithm to apply

nivekuil20:09:54

right, but the query planner doesn't care about that.. it doesn't know about network, disk, whatever, just take this string and turn it into that string, so at the point where the data comes out of the query planner, there's no concept of effects yet? it doesn't care about what the plan implies to whatever might interpret it

Dustin Getz20:09:01

i think it cares, the whole point of the plan is to be fast, which implies hardware

nivekuil20:09:36

the programmer cares, the program doesn't?

Dustin Getz10:09:43

i think we mapped the problem space well enough to answer the original q quite clearly

Dustin Getz10:09:22

in the domain of software engineering, declarative is a property of computation, and all of the computations we are interested in have a performance SLA on real hardware. From this perspective, all commercially useful programming languages are an abstraction over the imperative platform (which is the origin of "control flow" – instruction pointer, goto, jump-if-zero). Declarative languages are a subset of that, therefore all declarative languages in the domain of commercial software engineering (say application development) are ultimately orchestrating platform effects and the question is answered in the affirmitive.

Dustin Getz10:09:46

in the domain of mathematical language and denotative semantics (which is a superset of commercial programming languages) we now include computations that can evaluate on pen and paper (or in our minds), for which performance SLA and hardware is not considered, in this domain I can imagine declarative DSL as pure math / algebraic transformations / term rewriting. For example a DSL for symbolic differentiation i.e. Calculus. These declarative DSLs have not been tainted by the imperative platform and therefore the question is also answered with opposite result

Dustin Getz10:09:09

The dependence of the result on which domain the question is embedded in, is the link to meaning/denotation and the philosophy of language.

nivekuil22:09:25

I think we can generalize this further and resolve your bifurcation, unifying both under the concept of a formal system. Mathematics isn't unlimited in what in can model, everything must fit within its axioms. What if we want to talk about things informally? Do we call these informal constructs "effects"?

Dustin Getz22:09:48

i’m interested but don’t understand

Dustin Getz22:09:39

and even if math has limits, programming languages are within them

nivekuil23:09:13

no need to give two answers for "in the domain of..." just one answer for "in the domain of formal systems" should work

nivekuil23:09:54

a statement is declarative, an axiom is a statement taken to be true, a declarative programming language is an axiomatic system just like math

nivekuil23:09:08

i.e. all configurations of the system can be fully expressed through its own axioms

nivekuil23:09:29

this is NOT true when we have effects, managed effects are a way of bringing these back into the formalism

nivekuil23:09:46

i don't know what effects look like in math, but I think there must be the equivalent in that domain

nivekuil23:09:20

managed effects bridge this axiomatic, formalism gap

nivekuil23:09:03

I keep saying "effect" but that's because I don't know what the word is for "generalization of an effect"

Dustin Getz23:09:41

i think we need to define “effect” at this point

nivekuil00:09:11

I think effects are only of particular interest today because our programming languages are deficient, in that they can't formally model effects. So we get excited about managed effects systems like missionary because they extend the formal, axiomatic domain of programming to an extent that we're not used to and it lets us reason declaratively about things we weren't able to before

nivekuil00:09:37

declarative necessarily implies formal. effects contingently imply informal because our programming languages suck. imperative APIs suck because they are informal, we can't reason about them effectively. managed effects make effects formal, making our language capable of being declarative again

henrik05:09:26

I’m only half joking. Provided that Electric is trademarked, the overlap in name and description (if not functionality) is a tad close.

👍 2