Hacker News new | ask | show | jobs
by igravious 3222 days ago
> Data literals. That is, the values manipulated in the programs have a textual representation which is both readable for humans and executable as code. --8<--

This is not a dig at Kotlin/Java/Whoever but it bugs me (coming from Ruby) no end when regexen don't get to have a regex literal syntax and a match operator. I was going through the Kotlin language docs last night and its such a concise language with well thought out syntax and this omission jumped out at me.

Is it me? Do others really not think it's a big deal? I learned how to code via BASIC then ASM then C and early C++ and none of these had regex literals so for the longest time I literally (hah) did not know what I was missing. Now I can't imagine why a language wouldn't have them. I guess Ruby shows its Perl heritage. But Javascript has 'em, you go Javascript, and thus Typescript. And don't get me started on raw strings """Yuck!""" dear Lord, how gruesome. I think how Perl6 is brace savvy is the way forward. I'd also like to be able to specify my own braces to construct my own type as a shorthand, that'd be great DSL, so that,

     i = %something%
would construct an instance of type Foo assuming the correct %T% (by way of example) constructor syntax. That'd be neat-o.
1 comments

> I'd also like to be able to specify my own braces to construct my own type as a shorthand, that'd be great DSL

That's the purpose of readtables in Common Lisp, defining custom readers for converting external representation to internal ones.

Thanks, I'll check it out.