These are chat archives for japgolly/scalacss

30th
Apr 2015
Steven Scott
@codingismy11to7
Apr 30 2015 01:52
@japgolly I didn't realize this was separate from scalajs-react and can just output a css file, I thought it all had to be inline...awesome
David Barri
@japgolly
Apr 30 2015 03:23
Yeah man, you saw the Standalone section in the docs? It's like SCSS but in Scala
Chandra Sekhar Kode
@chandu0101
Apr 30 2015 08:59

@japgolly Sorry mate i'am not going to use scalacss for react-native ,

Reasons ..

I used your patch to define styles ,it generated lot of unnecessary prefixed attrs and all attr values as string .React-Native runtime didn't like it and thrown lot of warnings, app was little slow too. after that i recall my frist impression on scalacss

chandu0101 - scalacss has manythings that react-native don’t need , so was skeptical about adding as dependency

I almost droppped scalacss ,but one thing (it will be cool if we use same principles for both react and react-native ) stopped me doing that .I defined a simple trait

trait NativeStyleSheetScalaCss {
  private val camelCaseRegex = "[_-]+([a-z0-9])".r
  def isAllDigits(x: String) = x forall Character.isDigit
  private def camelCase(s: String) =
    camelCaseRegex.replaceAllIn(s, _.group(1).toUpperCase)
     protected object dsl extends DslBase {
       override def styleS(t: ToStyle*)(implicit c: Compose) = Dsl.style(t: _*)
     }
     def style(v: AV*) = {
       val p = json()
       v.foreach(t => p.updateDynamic(camelCase(t.attr.toString()))(if(isAllDigits(t.value.toString)) t.value.toString.toInt else t.value.toString))
       p
     }
}

this solved two issues mentioned above no prefixes and Int values , I was happy for a while, later i found that i'am using not supported styles (yeah react-native only supports 50 + styles...) and some styles(shadowOffset) accepts objects .

Now i have to write custom logic to throw compile time errors for unsupported styles and have to accept values other than string/int .. . I closed my IntellijIDEA and just doing random browsing then i came across this line

Intellectuals solve problems, geniuses prevent them - Einstein

http://i.imgur.com/mjBZI1m.gif

P.S : Most of the time I feel like super dumb but occasionally I feel like genius :P , in either way i am not intellectual.

Dropped scalacss , wrote simple styles module . In < 200 LOC i got everything i need ( type safe attr,values and support only allowed styles , no external proj dependencies )

David Barri
@japgolly
Apr 30 2015 09:09
Oh, that's unfortunate. I wouldn't start calling yourself a genius just yet though...
Chandra Sekhar Kode
@chandu0101
Apr 30 2015 09:09
lol even i don’t feel that either :P
David Barri
@japgolly
Apr 30 2015 09:09
:D
About the generated classnames, they are completely customisable. I provide two schemes out-of-the-box but you don't have to use them if you don't want to.
Chandra Sekhar Kode
@chandu0101
Apr 30 2015 09:10
classnames ? :S
David Barri
@japgolly
Apr 30 2015 09:11
Oh, by prefixes you mean browser prefixes, not classname prefixes?
Chandra Sekhar Kode
@chandu0101
Apr 30 2015 09:12
hmm yeah , even i got workaround for browser prefixes , but ...
David Barri
@japgolly
Apr 30 2015 09:12
Well similar for browser prefixes, there's a supported way to not generate them.
Doesn't need workaround :)
Chandra Sekhar Kode
@chandu0101
Apr 30 2015 09:12
this solved two issues mentioned above no prefixes and Int values , I was happy for a while, later i found that i'am using not supported styles (yeah react-native only supports 50 + styles...) and some styles(shadowOffset) accepts objects .
Now i have to write custom logic to throw compile time errors for unsupported styles and have to accept values other than string/int .. .
David Barri
@japgolly
Apr 30 2015 09:15
Dude, I'm replying to one aspect, not addressing everything you said. No need to copy&paste what you wrote only 1 min ago.
Chandra Sekhar Kode
@chandu0101
Apr 30 2015 09:16
i thought u still selling me scalacss :P , nvm cool :)
David Barri
@japgolly
Apr 30 2015 09:16
Godspeed.
Chandra Sekhar Kode
@chandu0101
Apr 30 2015 09:16
btw hows scalacss doing in u r big project ?
David Barri
@japgolly
Apr 30 2015 09:28
Really, really good man. Cos it's a large project and goes through much change, there's a noticeable before/after mental difference (anxiety vs confidence), and it's very satisfying.
Chandra Sekhar Kode
@chandu0101
Apr 30 2015 09:33
nice , now a days scala.js getting some attraction, its good that we have scalatags and scalcss ready and mature :)
David Barri
@japgolly
Apr 30 2015 09:54
Indeed. Stars on github just creep up with by themselves. I'm seeing more people causally mention scala.js on twitter. Life is good.
Otto Chrons
@ochrons
Apr 30 2015 09:55
yea, we need to keep the quality up!
and put some extra effort on documentation :)
Chandra Sekhar Kode
@chandu0101
Apr 30 2015 09:59
Screen Shot 2015-04-30 at 3.27.52 PM.png
@japgolly for u :P
Otto Chrons
@ochrons
Apr 30 2015 10:00
docs are always a pain :)
Chandra Sekhar Kode
@chandu0101
Apr 30 2015 10:02
indeed , but scalacss has quite good doc… .
David Barri
@japgolly
Apr 30 2015 10:19
What the? Where'd that slide come from?
It's a fair point about the DSL, it could use some more doco.
"Erm, no", "Gave up after a bit" and "Not quite ready for primetime" are pretty silly things to say. Baseless. Helps no one.
Otto Chrons
@ochrons
Apr 30 2015 10:31
it's still a late-night show, not prime time ;)
Steven Scott
@codingismy11to7
Apr 30 2015 10:46
I saw that slide before, but I can't remember where...
google to the rescue :)
Steven Scott
@codingismy11to7
Apr 30 2015 10:50
Oh dumb, the conclusion is "don't use scala.js"
@japgolly wouldn't give that too much credence
Chandra Sekhar Kode
@chandu0101
Apr 30 2015 11:17
yeah last side was funny .
David Barri
@japgolly
Apr 30 2015 11:37
Wow!
I was a little annoyed about what he said about scalacss - it's so easy to criticise ppl's work and effort without being helpful or constructive.
But that he, in the end, suggests that scala.js shouldn't be used....
That's just crazy.
Seb and Tobias have been working scala.js for years.
I'm gonna die with it in the top 5 things that revolutionised my entire programming life.
It's a miracle product.
Steven Scott
@codingismy11to7
Apr 30 2015 11:41
I think he didn't know what he was doing, and - more importantly - why
David Barri
@japgolly
Apr 30 2015 11:41
To just flippantly dismiss it like that.... Now I'm genuinely annoyed/sad.
Otto Chrons
@ochrons
Apr 30 2015 11:41
but it also highlights the importance of first impressions, documentation etc.
Steven Scott
@codingismy11to7
Apr 30 2015 11:41
He complained about line count, but didn't mention that he had, oh I dunno....TYPES
David Barri
@japgolly
Apr 30 2015 11:42
@codingismy11to7 +1
Steven Scott
@codingismy11to7
Apr 30 2015 11:42
haha "miracle" is exactly the word I used
David Barri
@japgolly
Apr 30 2015 11:42
:D
@ochrons I think you're right. No you're definitely right, but I feel that's not the whole story.
We def need to improve scala.js's initial impression - but I think ppl also have to be ready for it.
If we showed this guy immediately the benefits of types and compiler-safety, etc. he probably would still have dismissed it as overly verbose.
I think there's a path from where ppl like that are, to where we are.
It will be hard to cater first impressions to people of all positions on that path.
Otto Chrons
@ochrons
Apr 30 2015 11:46
well, he seems to be a Scala dev, looking at his other slideshares
David Barri
@japgolly
Apr 30 2015 11:46
is he?
Strange.
Otto Chrons
@ochrons
Apr 30 2015 11:46
and also knows Japanese :)
David Barri
@japgolly
Apr 30 2015 11:47
Yeah I saw the rust preso
Otto Chrons
@ochrons
Apr 30 2015 11:47
some others were also in JP
Justin du Coeur, AKA Mark Waks
@jducoeur
Apr 30 2015 12:37
Looking through the slides, the key thing is that he completely missed the point about what SJS is good for. Which may be a lesson for the SJS community in how we sell this.
I mean, he was trying to port a 100-line piece of JavaScript. Of course translating that to Scala isn't worth it -- even I might not bother with something that tiny. SJS's sweet spot grows as your problem gets larger and more complex. I suspect it starts getting worth it somewhere around 300-1000 lines of JS. When you get to something the complexity of Querki (~8k lines of Scala), it's a humongous win.
The moral of the story, though, is that strong typing is not the be-all and end-all of programming. Strong typing is specifically a way of coping with complexity. If you don't have complexity, you may not care so much.
David Barri
@japgolly
Apr 30 2015 22:54
@bblfish ping pong we have chat for scalacss too :)
@jducoeur Good point. seems much better than n + 10at low numbers.
This guy looked at n=1 and made his decision.