notjack
2020-5-13 17:09:46

I think css-syntax would make more sense than css-syntax3, personally


deactivateduser60718
2020-5-13 17:24:02

Believe me, I understand. I never liked numbers in collection names. I only entertain it since packages conflict on collection names easily. I figure if the package tracks W3C specs, the collection names can follow their levels (read: editions).


deactivateduser60718
2020-5-13 17:28:52

I guess it wouldn’t be bad if css-syntax tracked cross-level changes. They would have to share code somewhere anyway.


deactivateduser60718
2020-5-13 17:29:03

“They” being the modules inside the collection.


notjack
2020-5-13 17:59:06

Do you have any interest in writing a #lang css?


soegaard2
2020-5-13 18:00:53

Not #lang css, but close: https://docs.racket-lang.org/css-expr/


deactivateduser60718
2020-5-13 18:01:39

Yes, and I did recently write a pidgin lang that used css-expr. It sectioned off racket/base and css-expr rulesets with a #:begin-css-expr keyword.

#lang css-pidgin (define some-color '\|#888\|) #:begin-css-expr [* #:color ,some-color]


deactivateduser60718
2020-5-13 18:01:51

I didn’t release it because it seemed too opinionated.


deactivateduser60718
2020-5-13 18:03:28

When the parser is fleshed out, it will be possible to write a CSS superset that targets css-expr. Then you’d have a pure-Racket CSS preprocessor lang. :slightly_smiling_face:


deactivateduser60718
2020-5-13 18:04:13

(To be fair css-expr already has preprocessor features. It’s just a pain to type in it)


notjack
2020-5-13 18:05:36

A lexer and syntax colorer also means we can get syntax highlighting in example code used in #lang slideshow presentations, which would be neat


deactivateduser60718
2020-5-13 18:07:00

On that note, do you know where I can find a simple color:text<%> implementation example?


deactivateduser60718
2020-5-13 18:07:20

I’m assuming what you’re suggesting entails defining one.


samth
2020-5-13 18:09:09

notjack
2020-5-13 18:09:17

Not a clue. I’ve never made one myself. Does Beautiful Racket talk about how to implement syntax highlighting?




deactivateduser60718
2020-5-13 18:12:56

Lookee there :eyes:


soegaard2
2020-5-13 18:13:46

I had forgotten all about it! There were at least one nice feature:


deactivateduser60718
2020-5-13 18:14:42

Wow, you went all the way down to some CSS component value grammars.


deactivateduser60718
2020-5-13 18:15:53

There’s some CSS-SYNTAX–2.1 specifics that I’d probably leave out, but would you mind if I adapted some of that with credit to you in the project?


soegaard2
2020-5-13 18:18:07

Use whatever you can.


deactivateduser60718
2020-5-13 18:18:14

Thanks so much!


samth
2020-5-13 18:18:53

I’ll note that that code actually runs today


samth
2020-5-13 18:19:11

(I swapped the planet require for just using racket/base for with-output-to-string)


soegaard2
2020-5-13 18:21:56

Looking at the code: I have a feeling that the grammar follows some specification. Otherwise there are a few odd rules (like the one for the letter A).


deactivateduser60718
2020-5-13 18:23:12

Eyeballing it, it looks like it follows https://www.w3.org/TR/CSS2


soegaard2
2020-5-13 18:23:28

soegaard2
2020-5-13 18:23:44

I am not sure why.


deactivateduser60718
2020-5-13 18:24:28

The W3C’s specs only speak of a tokenizer and parser. Does Racket’s idea of a lexer conflict in some way?


soegaard2
2020-5-13 18:24:57

A “lexer” and a “tokenizer” is the same.


deactivateduser60718
2020-5-13 18:25:19

Yes, but I wasn’t sure if the spec forced a semantic difference. (EDIT: clarity)


deactivateduser60718
2020-5-13 18:25:44

For example, a “parse error” in the spec is not a reason to throw an exception.


deactivateduser60718
2020-5-13 18:26:03

But a parse error can occur in the lexer OR parser.


deactivateduser60718
2020-5-13 18:26:44

Since weird details like that crept up, I figured one of them justified a different module.


soegaard2
2020-5-13 18:29:12

Could be. The syntax-colorer can’t throw errors halfway through, say, as string: "foo


notjack
2020-5-13 19:26:13

How many different CSS packages (on both the catalog and PLaneT) are there? If some of them are deprecated / unmaintained / outdated maybe we could update them to point to the others.


deactivateduser60718
2020-5-13 19:38:41

That’s what I’m doing now. I came across https://pkgd.racket-lang.org/pkgn/package/w3s, which has the same mission as my own package. It’s undocumented and biased towards a desktop app though. For that reason I edited my own package README to include this blurb:

If prudent, I may also include dependencies from other projects and reprovide their bindings in the right collections. That would depend on if the license of the outside code is compatible with the license of this repository, and written consent of the author(s). Those authors will also appear in the credits.


deactivateduser60718
2020-5-13 19:46:16

To do this, since the w3c package already uses a css collection, this means that css-* collections would depend on css/* modules. :worried:


notjack
2020-5-13 20:06:34

I recommend either reaching out to the authors of other CSS packages and asking if they’d be willing to move their code around or update their docs, especially if they’re not maintaining or using the project anymore.


notjack
2020-5-13 20:12:24

for instance, it would be much nicer if the w3c package put its css collection inside an outer w3c collection (so you’d import it with (require w3c/css))


notjack
2020-5-13 20:12:33

that would be much better for all involved


rokitna
2020-5-13 23:32:52

It always feels like a language with a module system shouldn’t have these kinds of name collision issues.


sorawee
2020-5-13 23:34:19

Yeah, would be nice to have something similar to rename-in but for collections.


sorawee
2020-5-13 23:35:39

Does the collection system give us anything meaningfully useful? JS doesn’t have this concept and it seems to do OK


samth
2020-5-14 00:42:44

It gives you (or really @lexi.lambda) the ability to define typed/2htdp/universe in a separate package