[HN Gopher] Crystal 1.11.0 Is Released
___________________________________________________________________
Crystal 1.11.0 Is Released
Author : ksec
Score : 90 points
Date : 2024-01-14 15:41 UTC (7 hours ago)
(HTM) web link (crystal-lang.org)
(TXT) w3m dump (crystal-lang.org)
| mratsim wrote:
| It's been a while since I heard about Crystal.
|
| What's the state of Windows support.
|
| How did the compiler speed drama unfold?
| diggan wrote:
| > What's the state of Windows support.
|
| https://github.com/crystal-lang/crystal/issues/5430
|
| > UPDATE 2023-04-24:
|
| > All the main platform features for Windows are finished!
|
| > There are still some smaller stories pending. Project board:
| https://github.com/orgs/crystal-lang/projects/11/views/5
|
| > You can support the ongoing development financially: Windows
| suppport (https://opencollective.com/crystal-
| lang/projects/windows-sup...) project on Open Collective.
| hamandcheese wrote:
| Is it just me, or does Crystal have a disproportionate amount
| of Windows demand? I feel like every time Crystal comes up,
| someone asks (or complains) about Windows support.
| dimgl wrote:
| Anecdotal, but I think this is just the case with all
| projects of this nature. People on Windows don't like not
| being able to use stuff.
|
| The same thing was happening with Bun, and yet I've met lots
| of Windows developers who hate JavaScript.
| dbalatero wrote:
| I've noticed a lot more developers on Windows across the
| board, as more folks learn programming.
| mratsim wrote:
| I asked because Crystal was notorious for not having it.
| dleslie wrote:
| If a language doesn't have Windows support then it's
| inappropriate for commercial native application development.
| ukd1 wrote:
| I sponsored a bunch of work on this years back; I wanted it
| so I didn't have to use Go for cross-platform binaries for a
| CLI client. I ended up having to use Go, but I hope one day
| it ships so I can avoid it a little more (I don't hate it,
| but prefer crystal).
| voidfunc wrote:
| Windows isn't popular on HN, but it's a major platform with a
| lot of devs. You gotta get out of the HN bubble.
| arcanemachiner wrote:
| It took me 2 decades to get out of the Windows bubble.
|
| I'll enjoy my time here when I can get it.
| straight-shoota wrote:
| Crystal Core developer speaking.
|
| I don't think it's disproportionate. Windows is a huge
| platform with lots of developers. Also you don't hear anyone
| asking for other OS support because all other major operating
| systems are supported. So there's no real comparison.
| pjmlp wrote:
| As language nerd it is interesting to see the Crystal
| improvements, congratulations on keeping it going.
| mg wrote:
| I like the first code example on https://crystal-lang.org
| # A very basic HTTP server require "http/server"
| server = HTTP::Server.new do |context|
| context.response.content_type = "text/plain"
| context.response.print "Hello world, got
| #{context.request.path}!" end puts
| "Listening on http://127.0.0.1:8080" server.listen(8080)
|
| Nicely concise!
|
| This would be the Python equivalent: # A very
| basic HTTP server from http.server import
| BaseHTTPRequestHandler, HTTPServer class
| RequestHandler(BaseHTTPRequestHandler): def
| do_GET(self): self.send_response(200)
| self.send_header('Content-type', 'text/plain')
| self.end_headers() self.wfile.write(bytes(f"Hello
| world, got {self.path}!", 'utf8')) httpd =
| HTTPServer(('', 8080), RequestHandler) print("Listening
| on http://127.0.0.1:8080") httpd.serve_forever()
|
| Would like to see it in more languages.
| alwaysbeconsing wrote:
| Would not Ruby be the comparison to do? In which case it I
| think is nearly identical to the Crystal.
| doublerabbit wrote:
| TCL: proc webServer {chan addr port} {
| while {[gets $chan] ne ""} {} puts $chan
| "HTTP/1.1 200 OK\n Connection: close\nContent-Type:
| text/plain\n" puts $chan "Hello World!"
| close $chan } socket -server webServer
| 8080 vwait forever
| mg wrote:
| That lacks a few things: 1: The comment
| 2: Printing the status message ("Listening on ...")
| 3: Outputting "Hello world, got {request.path}!"
| Aka http request parsing and string extrapolation.
| ReleaseCandidat wrote:
| Haskell with WAI (more or less, guess there is some conversion
| from `Bytestring` needed when using `rawPathInfo`)
| {-# LANGUAGE OverloadedStrings #-} import
| Network.HTTP.Types import Network.Wai import
| Network.Wai.Handler.Warp (run) app :: Application
| app request respond = do respond $
| responseLBS status200
| [("Content-Type", "text/plain")] ("Hello
| world, got" <> rawPathInfo request <> "!") main ::
| IO () main = do putStrLn "Listening on
| http://127.0.0.1:8080" run 8080 app
| beanaroo wrote:
| Not exactly the same but various basic HTTP server
| implementations are presented at
| https://rosettacode.org/wiki/Hello_world/Web_server
| colesantiago wrote:
| It looks like Crystal is gaining traction.
|
| Which companies use Crystal in anger / production in front of
| real users?
| DASD wrote:
| I believe Kagi is a heavy user of the language.
| ukd1 wrote:
| My last company (Rainforest QA) used it in quite a few places
| when ruby wasn't fast enough, though a lot of Go too.
| compumike wrote:
| At Heii On-Call, we use Crystal to power the API server
| https://api.heiioncall.com/ as well as other internal
| components.
| Piribedil wrote:
| Maybe not up to date : https://crystal-lang.org/used_in_prod/
| 1vuio0pswjnm7 wrote:
| Invidious, a self-hosted YouTube front-end. is written in
| Crystal.
| acheong08 wrote:
| And its resource usage is depressing. Isn't Crystal garbage
| collected? I'm not sure why it has memory leaks.
|
| Also, >300 MB of RAM usage (in docker. Some might be the
| system) with only 2 users after running for a while seems a
| bit too much
| prh8 wrote:
| We use it to do nightly sitemap generation of over 30 million
| links. Takes about 30 minutes, replaced a Ruby (Rails) process
| that took hours.
| fransje26 wrote:
| From the landing page (and trying a few tutorials):
|
| https://crystal-lang.org/reference/1.11/index.html
|
| I couldn't quite determine the reason of being of the Crystal
| language. Could someone with experience with the language explain
| what is its appeal, and why it would be worth trying/learning?
|
| Thanks!
| helen___keller wrote:
| Crystal is basically taking Ruby and adding compilation and a
| strong static type system.
|
| I enjoy writing it but don't think there's any particular
| reason to try/learn it, unless you happen to also be a ruby dev
| who prefers compiled, strongly typed languages.
| WJW wrote:
| Why would a language need a specific reason to exist? It's a
| nice language with Ruby-ish syntax, strict typing, a go-like
| runtime and it compiles down to something quite fast if you
| take a little bit of care.
| Bjartr wrote:
| I interpret the question less as asking for justification for
| why it exists and more as wanting to learn what problems it
| ought to be used to solve because of an interest in putting
| it in one's "toolbox" as it were.
| aeturnum wrote:
| To me, it kind of sits between Golang and Rust in terms of
| intent. I think the goal is to deliver reliable runtime
| characteristics at the speed of a compiled language, while
| generally only demanding as much specificity as higher-level
| interpreted languages (i.e. Ruby). For me I reach for it when I
| want something that's fast (like go or Rust) but which I can
| write quickly (like Python or Ruby).
| ukd1 wrote:
| Reason; no idea - but the appeal for me is it's very ruby-like,
| and super fast (except, compiling). Some programs I've moved
| from ruby use >10x less memory, and are generally faster. It's
| mostly as a nice to write as ruby, except the compile time.
| Concurrency is very go-like, and there are a reasonable amount
| (not ruby-like though) level of libraries for use.
| orthoxerox wrote:
| As far as I understand, work on Crystal started when Ruby on
| Rails was the hottest web framework. The original purpose was
| going to be running your RoR apps that outgrew MRI. Yes, code
| would have to be adapted to run on Crystal, but that would be
| much easier than rewriting everything in a completely new
| language.
| DistractionRect wrote:
| My understanding, it's ruby like, but statically typed and
| compiled. Basically instead of trying to retrofit ruby with
| these features without breaking things (like Shopify and
| friends do with JITs, AOTs, sherbert, etc), this is bottom up
| approach around these features.
|
| Due to it's infancy the packages are sparse, so what some
| people do is a hybrid approach, where they write their thing in
| Ruby/Rails and kick out the slower parts to Crystal. This kinda
| gives the best of both worlds. Crystal (last I checked) had
| slow compile times, so gives you the dev velocity and package
| availability of ruby, plus the speed of a compile language when
| you need it. The compile times on Crystal stay low because
| you're only writing a small parts/microservices of your
| application in Crystal.
___________________________________________________________________
(page generated 2024-01-14 23:01 UTC)