Fork me on GitHub
#clojurescript
<
2020-07-21
>
anish09:07:20

Any suggestions on boilerplate for Reframe with html and css i.e website header, footer with good styles ? I want to prototype quickly ?

p-himik10:07:54

It would just be a Reagent boilerplate since what you describe doesn't have any behavior in it.

anish10:07:38

thanks but I may need some state in it

anish10:07:20

And I don’t want to invest too much time in Html and CSS

p-himik10:07:54

What I meant is that you can find any Reagent boilerplate/template and just plug re-frame in there without any hassle. Just add a dependency, that's it, you've got state now.

Wesley Matson15:07:47

As far as quick/low-friction styling, I’ve had lots of good luck with https://bulma.io/ which can be used pretty much regardless of the templating/state-management frameworks at hand. (Bulma is css only and using it on any individual element is opt-in)

dnolen11:07:56

@lilactown IMO there isn't a need for a doc - all core fns that mirror Clojure's are intended to be used in the same way

dnolen12:07:54

If you can think of other cases where you feel inclined to do this, I would be surprised. Using aget / aset in this semantically poor way is a JavaScript-ism, not a Clojure-ism

pmooser13:07:07

I have a custom deftype -- if I eval a form that contains a value of that deftype (not via a def), though, the compiler doesn't like it. Is that something that just isn't supported, or am I likely to be doing something wrong?

pmooser13:07:41

I'm trying to write a custom graphical repl that lets me paste an image, and this is effectively me doing something like (def x image-value) (where image-value is an instance of my deftype)

pmooser13:07:13

To be clear, this eval is in an embedded cljs repl ...

pmooser13:07:17

In case that makes a difference.

pmooser13:07:36

If I just def it, before passing it to eval, it works, so the data is valid, and the concept is fine within normal cljs.

pmooser13:07:57

It's just a little difficult in this circumstance to figure out what the difference is with the self-hosted version ...

pmooser13:07:44

failed compiling constant: [object Object]; foo.image/Image is not a valid ClojureScript constant.

dnolen14:07:52

you need to make sure the reader is aware of that - it's a bit too involved to explain and I would say advanced topic

dnolen14:07:10

because in regular ClojureScript reading has to be fixed in two places more or less for real consistency

dnolen14:07:30

and I don't think we did anything different for bootstrapped - it could probably be made a little simpler there

dnolen14:07:52

but zero priority - if you want to look into that and fix it up (if something is missing or could be improved) - go for it.

pmooser14:07:06

Sure, I understand that none of this is likely to get changed without my effort - I'm just trying to understand it better and not resort to hacks like creating temporary defs to solve the problem. As far as making the reader aware, I'm just surprised that it can't deal with instances of a deftype it should know about. I'm not 100% where to begin looking - as far as making the reader aware, do you think this is something that I can likely fix by introducing a custom reader tag ? I don't really want any kind of data transformation to occur - the data is correct.

dnolen14:07:01

oh actually it maybe that the reader is actually already working ...

dnolen14:07:24

almost I mean - the error is saying that compiler doesn't know about that constant type - we have cases for one

dnolen14:07:45

I think we don't automatically embed these values - this would be an enhancement to the compiler for bootstrapped

dnolen14:07:01

look at the constant cases in compiler.cljc

pmooser14:07:03

Yeah, I was reading compiler.cljc to take a look to see if anything jumped out at me.

dnolen14:07:34

you need a case for each kind of constant - in generally we don't allow embeddings because it doesn't make sense in normal ClojureScript

dnolen14:07:43

but in bootstrapped this is not a problem

dnolen14:07:56

anyways - this is advanced territory and I can't walk you through it

dnolen14:07:09

you could also examine Clojure to see how it's done there

pmooser14:07:05

@dnolen Hopefully having been a clojure programmer since 2008 I will eventually be able to tackle advanced topics. 🙂 Anyway, thanks for the help and insight. I will see what I can do.

dnolen14:07:22

@pmooser great! then dig in 🙂

pmooser14:07:58

I am optimistic! This doesn't seem insurmountable.

dnolen14:07:03

sorry a lot of times we get questions about bootstrapped and people want to do things without realizing there's still work to be done

dnolen14:07:15

and it's just not a priority because boostrapped isn't a primary use case and never will be

pmooser14:07:53

I understand completely, David. I'm grateful that you guys do all the hard work on this stuff so I can write absolutely crazy stuff and it usually works! I know I'm way off in the weeds, so to speak.

dnolen14:07:26

I think you need some kind of default case when you know you have an embeddable value

dnolen14:07:37

normally we just throw an exception in ClojureScript because it's game over

dnolen14:07:24

but in bootstrapped you could say - this is a runtime type we already know about we can embed it

dnolen14:07:57

the embedding bit is kind of a head twister - but probably a fun one to sort out

pmooser14:07:32

Yes, I will read a bit more of the compiler and see if I can glean some insight about how that might work - but it's interesting and digging into this kind of code will surely help me down the line, sine it's not like the software I write is going to get any less crazy over time ... 🙂

pmooser14:07:37

Thanks again!

dnolen14:07:35

I will say it might be slightly trickier than it seems but pretty cool

dnolen14:07:54

I think the compiler and analyzer will both need to be changed, we don't normally put runtime values into the AST

dnolen14:07:24

so I think that's what would need to be done, storying runtime objects as values directly

dnolen14:07:59

again I think seeing how this is already done in Clojure would be better starting point

pmooser14:07:15

I'll take a step back and take a gander at how it's done in clojure then!

dnolen14:07:20

if you feel like you've made some progress feel free to open an minor enhancement ticket for self-hosted in JIRA

👍 3
Brian Amadio14:07:55

What’s the recommended library for data visualization?

Brian Amadio14:07:39

I looked at metasoarous/oz but could not get it working with shadow-cljs

thheller14:07:42

whats the problem?

Brian Amadio14:07:00

Build failure: The required namespace “oz.core” is not available, it was required by “power_calc/views.cljs”. “oz/core.clj” was found on the classpath. Maybe this library only supports CLJ?

Brian Amadio14:07:25

Reverting the version to 1.5.6 in my project.clj makes this error go away but causes other issues

Brian Amadio14:07:38

The above error occurs with 1.6.0-alpha11

Brian Amadio14:07:55

I’ve checked that the version is available in my ~/.m2/repository

Brian Amadio14:07:56

With 1.5.6 it builds successfully but I get a bunch of warnings about deprecated reagent functions, and my cider REPL is not responsive

thheller15:07:45

from the looks of it the 1.6.0-alpha11 is bundled badly and does not contain oz/core.cljs

thheller15:07:36

don't know how far you have to go back to fix it alpha8 also seems bad

Brian Amadio15:07:01

ok guess I’ll add to the pile on

Brian Amadio15:07:15

thanks for the help!

pmooser18:07:04

@dnolen So ... the most straightforward route I managed to find is to mimick what is done for emitting fn references (`emit-fn`) - and it works. I'll have to think a little bit about what a general mechanism like this would be - for my test, it relies upon a defmethod for my custom deftype. But I thought you might find it interesting!

Aron19:07:49

just a sanity check... I can use spec to test frontend, right? works in the browser and there is tooling to run it? Because I am unsure how much of the clojure guides and tutorials actually translate to cljs.

Alex Miller (Clojure team)19:07:28

the spec guide should work as is in either clj or cljs

thanks2 6
dnolen19:07:13

@pmooser ah interesting was needed for testing specs in self-host, @mfikes worked on that bit I think

mfikes19:07:09

@pmooser @dnolen The origin of emit-fn is described a bit here https://blog.fikesfarm.com/posts/2016-01-22-clojurescript-eval.html (it is indeed related to self-hosted)

dnolen19:07:36

like I said above, I think if we could embed arbitrary values in the AST we could handle this in a more general way and avoid the case by case stuff

dnolen19:07:57

but emit-fn is a good jumping off point for thinking about the more general problem

pmooser19:07:31

Yup ... thanks for the additional info, I will reflect on it a bit more!