RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
DTZUZU has joined #crystal-lang
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hmans has quit [Read error: Connection reset by peer]
snsei has joined #crystal-lang
hmans has joined #crystal-lang
ua has quit [Ping timeout: 256 seconds]
ua has joined #crystal-lang
<FromGitter> <drosehn> Okay, well, at least I now have an example of the second issue. Just crystal reacting poorly to a stupid (but legit!) change I made to the code.
cremes has joined #crystal-lang
jnyw has joined #crystal-lang
alex`` has quit [Ping timeout: 256 seconds]
alex`` has joined #crystal-lang
tea_ has joined #crystal-lang
<tea_> morning all
<FromGitter> <drosehn> Hi. (for small values of "all")
dragonkh has quit [Ping timeout: 268 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
snsei has joined #crystal-lang
<FromGitter> <watzon> Commit histories like this worry me sometimes
<FromGitter> <watzon> I guess I may need to make my fork of ssh2.cr its own beast. I'll be a little more reliable with updates
cremes has quit [Quit: cremes]
tea_ has quit [Ping timeout: 240 seconds]
tea_ has joined #crystal-lang
<FromGitter> <jwaldrip> is that your history?
<FromGitter> <jwaldrip> Oh what a kid does to commit history
tea_ has quit [Ping timeout: 248 seconds]
tea_ has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <jwaldrip> ah nvm, thats datanoise
tea_ has quit [Ping timeout: 264 seconds]
rohitpaulk has joined #crystal-lang
snsei has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
snsei has quit [Ping timeout: 276 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
<FromGitter> <nobilik> hi everybody. Just upgraded 23.1 to 24.1 and this ["838480798301"].map { |r| r.to_i64 } gives me [838480798301_i64] . Some kind of postfix? But my Postgresql doesn't want it at all. what to do????
<FromGitter> <nobilik> BTW this "838480798301".to_i64 gives me 838480798301
rohitpaulk has joined #crystal-lang
alex`` has quit [Ping timeout: 256 seconds]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 246 seconds]
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <Dillybob1992> Good afternoon!
hightower4 has quit [Ping timeout: 240 seconds]
<FromGitter> <jwaldrip> @Dillybob1992 it’s 9pm here!
<FromGitter> <Dillybob1992> USA, West coast? :D
cremes has joined #crystal-lang
cremes has quit [Client Quit]
<FromGitter> <bew> @nobilik `"838480798301".to_i64` gives me `838480798301_i64`
<FromGitter> <bew> @nobilik this postfix is there only when you inspect the number (for debug, or console display purpose for example)
<FromGitter> <bew> I think you should open an issue on the postgresql shard you're using to support 0.24.1
<FromGitter> <bew> they'll need to stop `inspect`-ing the numbers, and just use `puts` or sth similar
cremes has joined #crystal-lang
cremes has quit [Client Quit]
<FromGitter> <Dillybob1992> how large can a class be? for example, i have a `GameServer` class, that has the property `players`. the `players` is a array of type `Client`, which the client class stores the character_name, user_id, etc. how many clients can I create until the GameServer's class `players` become full, or is just a limit of the amount of system ram available for that server?
snsei has joined #crystal-lang
<FromGitter> <nobilik> @bew thanks for reply. I found the same in google group https://groups.google.com/forum/#!topic/crystal-lang/k_Be6kE7Dl0 . psql sees the postfix in this case for example `DB.exec "DELETE FROM photos WHERE photos.photo_id = ANY (ARRAY#{photos_to_delete_ids}::text[])"`
<FromGitter> <nobilik> @bew `photos_to_delete_ids`is an array of this kind
<FromGitter> <drosehn> The `players` array will keep expanding, although you might run into some performance issues. How many `clients` would you expect to create? Thousands? Millions?
<FromGitter> <Dillybob1992> a couple thousand or so would be ideal, but i do remove the client from the players array when they log off. so it should help with expansion / leaking i hope
<FromGitter> <drosehn> I wouldn't worry about "thousands". It might get dicey around "hundreds of thousands", but the only reason I say that is because none of the programs that I've written have created an array that large.
<FromGitter> <drosehn> Although in my cases I just fill up various large arrays, "do something", and then get rid of it all. I'm not constantly adding and deleting elements in a large array.
<FromGitter> <Dillybob1992> awesome then, thank you. that increased my confidence a lot, i was getting worried.
<FromGitter> <bararchy> @Dillybob1992 how abut using redis or something similar for session handling ?
<FromGitter> <bararchy> Instead of a huge array
snsei has quit [Remote host closed the connection]
<FromGitter> <Dillybob1992> well, i originally was doing that with nodejs using multiple nodejs processes, connecting to a redis server. but the pub subbing thing to notify other nodejs processes if a user entered a game, sent a message to friend, etc got really confusing. having just one process to worry about seemed easier to me. and after looking at kemal websocket benchmark, i think one master crystal process would be fine to
<FromGitter> ... house a couple thousand players. ⏎ ⏎ i do however, will run separate game instance servers on crystal that run a fixed timestep / game loop, that talk to the master server. so i can horizontally scale. i just figured a master server for matchmaking / simple chat would be fine with one crystal server.
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
rohitpaulk has joined #crystal-lang
flaviodesousa has joined #crystal-lang
<Groogy> Morning! o/
<FromGitter> <Dillybob1992> Morning o/
<FromGitter> <Dillybob1992> My cat just turned 21 and is still alive and going strong, he's the cutest little thing ever
<FromGitter> <Dillybob1992> I don't think they're supposed to live this long lol
mark_66 has joined #crystal-lang
<hmans> Maybe it's a vampire cat, and it's been drinking your blood while you sleep?
<hmans> Just putting that out there.
<FromGitter> <Dillybob1992> Haha
<hmans> It's not funny.
<hmans> A friend had a vampire hamster.
<FromGitter> <Dillybob1992> My condolences to your friend
<hmans> He's dead. Blood loss.
<hmans> Hamster moved on into the night. Now lives in the shadows. Feeds on rats, sometimes little children.
<FromGitter> <Dillybob1992> Spooky little thing
<FromGitter> <Dillybob1992> Dangerous
mamantoha has joined #crystal-lang
<crystal-gh> [crystal] bew opened pull request #5632: Use T#to_s instead of T#inspect for Array#to_s (master...Array#to_s-uses-T#to_s) https://git.io/vNwqh
hightower4 has joined #crystal-lang
<FromGitter> <bew> @nobilik #5632 should fix your usecase
hightower2 has joined #crystal-lang
hightower4 has quit [Read error: Connection reset by peer]
alex`` has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang
<FromGitter> <imonmyown> well yeah, good day to everyone :)
jnyw has quit [Ping timeout: 246 seconds]
cyberarm has quit [Ping timeout: 264 seconds]
snsei has quit [Remote host closed the connection]
<FromGitter> <Dillybob1992> good day
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
cyberarm has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <Dillybob1992> does `next` act kinda like javascript's ` continue `? skips that part of iteration?
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<crystal-gh> [crystal] asterite closed pull request #5594: Fix offset handling of String#rindex with Regex (master...jm/fix/5590) https://git.io/vNlnM
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
jnyw has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 255 seconds]
<FromGitter> <sdogruyol> @Dillybob1992 yeah
<travis-ci> crystal-lang/crystal#b05ad8d (master - Fix offset handling of String#rindex with Regex (#5594)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/332231268
snsei has joined #crystal-lang
<FromGitter> <Dillybob1992> @sdogruyol i really love your kemal websocket benchmark article
<FromGitter> <Dillybob1992> thanks :)
<FromGitter> <sdogruyol> thank you @Dillybob1992 :) Great to see there are some readers of that article :P
<FromGitter> <Dillybob1992> @sdogruyol yah, it's no brainer to switch from nodejs (imo at least) after seeing those numbers :D
snsei has quit [Remote host closed the connection]
<FromGitter> <sdogruyol> well..it's not just about the numbers. I also prefer Crystal to Node (I've used Node since 0.6.x lol)
snsei has joined #crystal-lang
<FromGitter> <Dillybob1992> yeah, true. i like the syntax, community, and flow of code too. i just never coded in ruby before and i still came to crystal haha.
<FromGitter> <sdogruyol> Ruby is a nice language ❤️ We took a lot of inspirations from Ruby when building Crystal
<FromGitter> <sdogruyol> we also improved upon it
<FromGitter> <Dillybob1992> <3
hightower2 has quit [Ping timeout: 276 seconds]
jnyw has quit [Quit: WeeChat 2.0.1]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
hightower2 has joined #crystal-lang
hightower3 has quit [Ping timeout: 260 seconds]
<FromGitter> <RKTZ> Can we see the differences between crystal and ruby somewhere?
<FromGitter> <RKTZ> I mean what was added to crystal
<FromGitter> <RKTZ> new types etc
<FromGitter> <RKTZ> so that I don't have to learn crystal from scratch :p
<FromGitter> <sdogruyol> not sure if there's an exact document for that
<FromGitter> <Dillybob1992> i saw this and shows some differences https://github.com/crystal-lang/crystal/wiki/Crystal-for-Rubyists
<FromGitter> <Dillybob1992> but not all i think, but that might help :)
<Papierkorb> Just use Crystal, as rubyists you shouldn't have many issues. If you've never used a statically typed language, the type system will be where you'll have to learn new stuff. As far the stdlib goes, don't waste your time on scientifically proving something exists or not, just write your code, if it doesn't compile check what's up, and proceed.
<FromGitter> <RKTZ> ok thanks
<FromGitter> <RKTZ> i will have a quick look a the doc in order not to miss new types
<FromGitter> <Dillybob1992> union types help me a lot
<FromGitter> <RKTZ> there is tuple and speaking of that what's the difference between named tuple and hash ?
<FromGitter> <l3kn> @RKTZ https://crystal-lang.org/api/0.20.2/NamedTuple.html "You can think of a NamedTuple as an immutable Hash..."
<Groogy> Tuple is fixed in its size after it is created
<RX14> @RTKZ named tuple is also more like an object in that there's a different type for each key
<RX14> A hash has the same type for all keys and all values
<RX14> They're not used as generic data bags like ruby because you erase the type information
<RX14> I recommend just playing with them, because they're used in almost entirely different situations
snsei has quit [Remote host closed the connection]
<FromGitter> <RKTZ> ok thanks !
<FromGitter> <RKTZ> > **<RX14>** A hash has the same type for all keys and all values
<FromGitter> <RKTZ> The doc says we can mix types
<Groogy> not for hashesh?
<Groogy> hashes*
<Groogy> unless you make the type of the key or value to be an actual union
<Groogy> yeah that makes the key type a union type
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
<Groogy> for instance in the value field, you would have to deduce if it is a "int or a string" each time you try to access the value
flaviodesousa has joined #crystal-lang
<FromGitter> <RKTZ> hmm ok
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <sdogruyol> wow, Google Cloud added official Elixir support https://cloud.google.com/elixir/ hope to see official Crystal support someday :P
<FromGitter> <Dillybob1992> same
rohitpaulk has joined #crystal-lang
alex`` has quit [Quit: WeeChat 1.9]
flaviodesousa has joined #crystal-lang
mamantoha has quit [Ping timeout: 240 seconds]
<RX14> @RKTZ it's all about terminology
<RX14> when I say there's a "single type" that includes union types which could be multiple types
<RX14> but to the compiler, it's just one type, which happens to be a union
<FromGitter> <Dillybob1992> been working hard converting my game server over from nodejs (https://i.gyazo.com/6ca925e67fbedef3ba58cee265882d20.png)
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter> <alex-lairan> Hi here :) ⏎ ⏎ I have a problem with alias types. ⏎ Here my code ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5a67383ee0141226507f645c]
<RX14> @RKTZ the important thing is that when you do hash[key] you always get the same type back
<RX14> whereas in ruby you don't, because types are at runtime
<RX14> @alex-lairan what are you trying to do?
<RX14> Symbol isn't a valid name for a local variable but you've put it in the place where you want a local variable to be
<RX14> do you mean def initialize(@block : DATA_TYPE, symbol : Symbol) ?
<RX14> or just def initialize(@block : DATA_TYPE, symbol) ?
mamantoha has joined #crystal-lang
<RX14> you're giving the alias type as a parameter just fine
<RX14> it's the NEXT parameter that's the problem
<FromGitter> <alex-lairan> Oh no, I'm just dumb ^^ I do a bit mistake with my type :p
<RX14> we tend to use CamelCase names for types though
<RX14> like alias DataType
<FromGitter> <alex-lairan> My type should be `Hash(Symbol, JSON::Any)` but I copy the proc with :(
<FromGitter> <alex-lairan> okay
<FromGitter> <alex-lairan> 👍
<RX14> ohh i see
<RX14> you want @block : DataType -> Symbol ?
<RX14> yep
<FromGitter> <alex-lairan> thanks for your help ! yes but I prefer `Proc(DataType, Symbol)` :)
<RX14> `@block : Proc(DataType, Symbol)` or `@block : DataType -> Symbol` are the same thing
<RX14> OK
<RX14> no problem
<FromGitter> <alex-lairan> I do a shards like https://github.com/trailblazer/trailblazer-activity
<RX14> cool
<FromGitter> <alex-lairan> Any idea how I can be more generic than `JSON::Any`? Because if I want to store a `User`, I need to deserialize the object :/
<FromGitter> <Dillybob1992> the person who created `.chomp` is AMAZING i love IT
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 255 seconds]
<FromGitter> <asterite> alex-lairan: you want to store any object? the only way is to introduce a module and have it included in every type you want to serialize
<FromGitter> <asterite> I consider it a hack, but, well, there's no other way (the language is very limited in this regard, with reflection, like in Go, this would be trivial to implement)
<FromGitter> <Dillybob1992> ```code paste, see link``` ⏎ ⏎ some reason this is returning 0 results found. but works if there is only 1 element in array. i tried `id in ?` but got mysql error, am i doing it right? [https://gitter.im/crystal-lang/crystal?at=5a67403be0141226507f99f2]
rohitpaulk has joined #crystal-lang
duane has joined #crystal-lang
cremes has joined #crystal-lang
thews has quit [Ping timeout: 255 seconds]
rohitpaulk has quit [Ping timeout: 276 seconds]
moei has joined #crystal-lang
rohitpaulk has joined #crystal-lang
thews has joined #crystal-lang
thews has joined #crystal-lang
thews has quit [Changing host]
dragonkh has joined #crystal-lang
<dragonkh> hi - when I have JSON.mapping(id: String) everything is cool - but now my json has Id - and when I change to JSON.mapping(Id: String) it does not like the capital I - is there another way to specify this?
<dragonkh> ah there is key
<FromGitter> <Dillybob1992> how can i convert an array to a comma delimited string? something like muffin = [1,2,3,4] ⏎ then do muffin.to_s, then just cut off the first and last characters? i found, if i can do a comma delimited string, it works in the MYSQL `where in` clauses
<FromGitter> <xfbs> muffin.join(", ")
<FromGitter> <Dillybob1992> wow, super useful patrick, thanks
<FromGitter> <Dillybob1992> ALOT!
<FromGitter> <straight-shoota> That works, but you really shouldn't build MySQL queries that way. There's so much that can go wrong.
<FromGitter> <Dillybob1992> got it.`result = db.query_all "select username from users where id in (#{client.blocked.join(",")})", as: {String}` `blocked` datatype is int32, soi think i'll be fine for possible mysql injection right?
<RX14> ideally youd be able to just do "where in ?" and then pass client.blocked as an argument
<RX14> like you can with strings
<RX14> but alas
<RX14> its brokew
<FromGitter> <Dillybob1992> yeeah, should i make mysql issue on it or is what im doing edge case?
<FromGitter> <Dillybob1992> github issue* wow, derp
<RX14> it should be supported, i'd make a github issue
<FromGitter> <xfbs> Random question but is there a code formatter for crystal out there?
<FromGitter> <xfbs> Been using `cargo fmt` for rust and `clang-format` recently and they're quite useful
<RX14> lol yes
<RX14> `crystal tool format`
<RX14> it's alredy built in
<FromGitter> <xfbs> Ahh sneaky! Nice :)
<FromGitter> <Dillybob1992> i love how it will remove , at the wrong place sometimes :D
<FromGitter> <Dillybob1992> i mean, if you have the , at the wrong place, it fixes it
<FromGitter> <Dillybob1992> pretty cool
LastWhisper____ has joined #crystal-lang
<FromGitter> <xfbs> Oh no the `crystal tool format` even matches the indentation of `=` for constants? That's kinda sexy!
<RX14> yeah it does a lot
<FromGitter> <Dillybob1992> saves me arthritis
mark_66 has quit [Remote host closed the connection]
<RX14> it's so nice to just not worry about formatting
<RX14> since you cand get it to run on save
<RX14> you just do :w
<RX14> and then you have it formatted
<RX14> no matter how much of a mess happened
<FromGitter> <Dillybob1992> i will venture to say, moving to Crystal instead of js has saved me from arthritis in itself too 👏 . My god im just comparing my code from js, all the promise waterfall chains.. such a mess i feel.
<FromGitter> <xfbs> Ahh I need to plug it into my vim maybe. But yeah it's also a social thing, when all codebases have same formatting the friction when looking at other (older?) code is much smaller
<RX14> well, you'll gain a lot of cleanliness just by rewriting it @Dillybob1992
<RX14> but crystal does help to keep things concise
sz0 has joined #crystal-lang
<FromGitter> <Dillybob1992> This (https://i.gyazo.com/8db913ba4310c6c18b481fd7bb28ce31.png) isn't my cleanest code in Crystal (still new), but just comparing one on my game functions, it's night n day
rohitpaulk has quit [Ping timeout: 255 seconds]
<RX14> @Dillybob1992 are you use `last_insert_id` works?
<RX14> are you sure*
<RX14> oh wait this is mysql
<RX14> never mind
<RX14> ignore me i'm thinking in postgres
<FromGitter> <Dillybob1992> hehe, np
<RX14> in postgres you use RETURNING <column name> on insert
<RX14> and treat it like a select
<FromGitter> <Dillybob1992> O_o
<RX14> it's because postgres can have primary keys of any type
<RX14> text, uuids, shapes
<RX14> and so you need to specify the type
<RX14> in mysql they can only be integers so your last_insert_id is always an integer
<RX14> and so it can be typed
<FromGitter> <Dillybob1992> yeah, someone said earlier something good about postgres couple days ago, but iuno if should convert. mysql seems simple for a simpleton like me lmao
<RX14> oh sure, do one thing at once
<RX14> if you *do* convert to postgres do it after you're comfortable with crystal
<RX14> I recommend trying postgres out though in the future
<RX14> then you can make an informed decision an any future projects because you know both
<FromGitter> <Dillybob1992> yeah for sure. i also heard path of exile uses it as well for their databses
<RX14> postgres has a lot more features tan mysql which help you model your data
<FromGitter> <Dillybob1992> really popular in game development studios
<RX14> postgres is a lot more "strongly typed" and mysql
<RX14> it helps you catch errors earlier if you add constraints
<RX14> and you can do awesome stuff like store JSON in the database
<RX14> and make indexes on the contents of the json
<RX14> not that thats what you want to do if you can help it
<FromGitter> <Dillybob1992> that sounds cool actually
<FromGitter> <Dillybob1992> native json in db? or do u have to retrieve it to parse?
cremes has quit [Quit: cremes]
<RX14> it's native json
<RX14> stored as binary
<FromGitter> <Dillybob1992> O_O now that's cool!
<RX14> you can query on the contents of it
<FromGitter> <fridgerator> if you use JSONB type, you can actually query it
<RX14> so do stuff like
<FromGitter> <fridgerator> ^
<RX14> where json.key.value = something
<RX14> (it's not that syntax)
<RX14> but you can do stuff like that
<RX14> although - you should use it in moderation
<RX14> using normal columns is usually better
<FromGitter> <Dillybob1992> lhow's th eperformance compared to mysql
<RX14> you probably won't notice the difference
<FromGitter> <Dillybob1992> ima check it out, sounds enticing
<RX14> @Dillybob1992 finish your port to crystal first!
<RX14> one thing at a time :)
<FromGitter> <Dillybob1992> ya good idea
<RX14> @Dillybob1992 how long have you been programming?
<FromGitter> <Dillybob1992> 3-4 years, hbu?
<RX14> probably 5-6
<RX14> i was just going to say it looks like you picked up crystal pretty quickly
<FromGitter> <Dillybob1992> thanks, well honestly i asked a lot of my questions here in gitter
<FromGitter> <Dillybob1992> and it helped a LOT!
<RX14> good
<RX14> that's what we're here for after all :)
<FromGitter> <Dillybob1992> do you have a computer science background?
<RX14> not... really
<FromGitter> <Dillybob1992> really?
<RX14> yeah I self-taught
<FromGitter> <Dillybob1992> i thought some p.h.d, or master level degree
<RX14> i'm at university now
<RX14> first year
pta2002 has quit [Quit: ZNC 1.6.5+deb2build2 - http://znc.in]
rohitpaulk has joined #crystal-lang
<Vexatos> @Dillybob1992 programming is so easy you can teach it yourself with fairly little effort :P
<RX14> programming is easy
<RX14> software development is hard
<FromGitter> <Dillybob1992> i think one of the major mistakes that happened to me, that hindered my ability to comprehend programming as much as i'd like, is not takingthe right classes in community college / highschool. for example, the highest math i know is pre-algebra. i wish i would have done better in math and stuff so i can understand the concepts of vectors more now. however, to be honest, the godot engine has taught me
<FromGitter> ... vectors and other math really well just by using it. but i do wish i had a more compound level of education. ⏎ ⏎ for example, i grew up just copying snippets from stack overflow and never really "learning how to program" subconciously, i just put pieces of code together to make it work. but the more I understand Crystal or nod ... [https://gitter.im/crystal-lang/crystal?at=5a67688ed9f895c3604f8f18]
<Vexatos> Where I went to school, maths were mandatory all the way through. It helps a lot for the thing I am studying, but I don't think anything other than algebra is needed for programming
<RX14> @Dillybob1992 you need a bit of maths for game development
<RX14> and for several fields of programming
<RX14> but thats more related to the problem domain
<RX14> for just writing webapps you really don't need to learn maths
<RX14> you can be a very competent and useful developer with no maths kills at all
<RX14> skills*
<Vexatos> As long as you don't go into scientific computing
<RX14> you probably want a bit of basic discrete maths theory eventually
<Vexatos> (It is fairly easy not to go into scientific computing)
<FromGitter> <Dillybob1992> yeah, well, thank god the godot engien has all built in math methods for us because i'd be so lost, lmao.
<RX14> i've never tried game programming
<RX14> i should
<FromGitter> <Dillybob1992> although, i understand vectors and sin and cos now but that's it, bcz im doing just a 2d game
<FromGitter> <Dillybob1992> i will never dive into 3d, my mind goes blank
<RX14> yeahh
<RX14> same
<Vexatos> I taught myself programming when I was 15 or so, so eighth-grader maths are clearly enough for basic programming - that was way before vectors
<FromGitter> <Dillybob1992> @RX14 if u ever get free time away from crystal, i highly recommend Godot engine
<FromGitter> <bmulvihill> the main thing computer science degree gave me was a vocabulary, but concrete skills take practice and experience that you don't have a lot of time for in university. As RX14 mention discrete math is very useful and can help you understand things
<FromGitter> <bmulvihill> and doesn't require any super advanced math skills
<RX14> yeah, discrete maths is fairly easy
<RX14> it's kinda... common sense?
<Vexatos> I study chemistry so advanced maths are kind of my bread and butter, but I hardly ever need any of that for programming
<FromGitter> <Dillybob1992> i did take a "math in society" course inc ommunity college. is that kinda what that is?
<RX14> in that it maps well into real-world problems
<FromGitter> <bmulvihill> discrete math is like a blend of mathematics
<FromGitter> <bmulvihill> that form the foundation of computer science
<FromGitter> <Dillybob1992> i passed with a 1.6 gpa (fail was 1.4) :P
<RX14> @Dillybob1992 discrete maths is about sets and graphs and logic
<FromGitter> <bmulvihill> logic, set theory, some proofs
<RX14> yeah
<RX14> proofs you don't really need to know
<FromGitter> <Dillybob1992> path finding in graphs?, shortest route stuff?
<RX14> yeah
<FromGitter> <Dillybob1992> oh ya, yep that's it
<FromGitter> <Dillybob1992> i took that
<FromGitter> <bmulvihill> some algorithms, but mainly to show how things work
<FromGitter> <bmulvihill> ie divide and conquer, recursion
<FromGitter> <Dillybob1992> djiskirra algorithm or w/e is all i remember from that class. see, that's the thing. all that and that's the only thing i taken away from the course
<FromGitter> <Dillybob1992> math is just not my thing
<RX14> big-O and sorting is useful too
<RX14> sorting more as an example
<RX14> well binary searching comes up every so often
<FromGitter> <bmulvihill> yeah discrete math isn't super algorithm focused, but you learn the basics of algorithm analysis
<RX14> but in realisty you always use array.sort from your stdlib
<RX14> so sorting is more thoeretically useful
<Vexatos> I've only ever had purely theoretical maths, heh
<RX14> but thats algorithms
<RX14> not discrete
<FromGitter> <bmulvihill> most county colleges offer discrete math, I always recommend my non CS programmer friends to shell out the $300 and take it
<FromGitter> <bmulvihill> its worth it IMO
<Vexatos> Is that some kind of private school, that it costs money?
<RX14> shh Vexatos
<FromGitter> <bmulvihill> county college costs money in America lol
<RX14> you know the answer so don't bring up politics
<Vexatos> I was honestly not sure, sorry
<RX14> pls
<FromGitter> <Dillybob1992> i was watching a interview of bjarne (C++ guy) and he said he wasn't a math major at all, in fact, he was joking in the interview how he was terrible at it. just proves what you guys are saying is true
<RX14> computer science is such a wide field
<RX14> from people who are purely software engineers who need next to no maths and just work on code for websites or tools for other programmers
<Vexatos> @Dillybob1992 as long as you know basic algebra, i.e. + - · ÷, you're essentially good
<RX14> or people who work with interfacing CS with a problem domain
<FromGitter> <bmulvihill> doesn't matter to me I joined the Army when I was 18 so I went for free :P
<RX14> like for example scientific computing
<RX14> or something else where you need to know the problem domain and software engineering
<RX14> those are typically more mathsy
<Vexatos> yea, scientific computing is the other side of the maths spectrum
<RX14> yeah, clearly
<Vexatos> You won't ever have to touch that unless you become a scientist yourself, though
<RX14> they don't learn software development
<RX14> naming their variables a and b and c
<FromGitter> <Dillybob1992> @vexatos ya for some reason after watching his interview it boosted my confidence a lot
<RX14> lol
<Vexatos> Scientists don't know software development, that's why they still pay €2000 for MATLAB licenses :/
<RX14> when I was interfacing with the sgp4 satellite model all their variable names were trash
<RX14> just incomprehensible
<Yxhuvud> no, it is because there is a lot of legacy code and because matlab comes with a literal shitton of modules implementing algorithms well
<RX14> inb4 julia shilling
<FromGitter> <Dillybob1992> what is MATLAB i don't even..
<FromGitter> <Dillybob1992> i don't want to know :D
<Vexatos> RX14, I recently compiled a quantum chemistry program written in FORTRAN that looked like (and probably was) from the 1980s, it was essentially incomprehensible magic
<RX14> fortran is cool tho
<Vexatos> It really is
<RX14> matlab isn't
<Vexatos> It's one of the few old languages that still work extremely well
<Vexatos> MATLAB is outdated, overpriced, and breaks all the time anyway
<RX14> @Dillybob1992 it's a terrible programming language that engineers use
<Vexatos> It costs €2000 per license
<Vexatos> for non-commercial use
<RX14> or free for students
<FromGitter> <Dillybob1992> LOL
<FromGitter> <Dillybob1992> that's all i want to know about it, made my day your comment RX14 :D
<RX14> it's not quite that simple
cyberarm has quit [Ping timeout: 240 seconds]
<RX14> but you're never going to need it
<RX14> so it's close enough
<RX14> it has support for complexes and matricies and vectors built-in which is cool I guess
<RX14> but other languages like julia can do that and not suck
cyberarm has joined #crystal-lang
<Vexatos> The only reason why people still use MATLAB is because they use programs written in MATLAB and why rewrite it in a better language when you could instead spend your time earning money
mamantoha has quit [Ping timeout: 240 seconds]
<FromGitter> <Dillybob1992> gonna check out this julia lang r/ quick :D
<Vexatos> RX14, I like that you managed to advertise Julia without me even mentioning it once
<RX14> wew
<Vexatos> @Dillybob1992 it's my favourite programming language
<RX14> (it sucks)
<Vexatos> (less than MATLAB)
<RX14> (true)
<FromGitter> <Dillybob1992> @vexatos wait, less than matlab what do u mean?
<FromGitter> <Dillybob1992> like, worse?
<Vexatos> Julia is a more modern approach to the same types of problems that MATLAB used to be used for
<Vexatos> it sucks way less than MATLAB, is what I meant
<FromGitter> <Dillybob1992> Ohhh
<FromGitter> <Dillybob1992> My bad, yeah i get you.
<Vexatos> It is basically MATLAB if it wasn't written in 1644
<RX14> by an idiot
<Vexatos> And it's free
<RX14> And open source
<Vexatos> a modern language built for scientific computing, from the ground up. MATLAB is essentially its main competitor, along with numpy
<Vexatos> but numpy is a pain to write large programs in
<FromGitter> <Dillybob1992> for some reason since i've been using crystal and knowing what these "Int32" ares n stuff, seems like i can understand other languages that use them better. in nodejs/js, we never had to deal with that (data types) statically typed is what i mean i guess
<Vexatos> Julia is a very new language though, and science is slow, so it will take many more years until people widely adopt it
<Vexatos> It is better in just about every aspect though, compared to its competition
<RX14> @Dillybob1992 learning programming languages is very useful in computer science
<Vexatos> once you know one, learning more is really easy.
<RX14> every new programming language you learn you learn a bunch of new concepts and techniques
<RX14> Vexatos, not true at all
<RX14> moving from dynamic -> static
<RX14> or the other way
<RX14> or functional to imperative or the other way
<RX14> and the more concepts and techniques you know, you have more tools to solve programs in any programming language
<Vexatos> There are, however, languages you probably shouldn't be learning
<RX14> I havent tried a new programming language since I found crystal, and I need to
<RX14> i need to do something in rust
<FromGitter> <Dillybob1992> yah this statically compiled thing is a whole new world to me. i feel like i've been spoiled in nodejs
<RX14> and go
<RX14> and haskell
<RX14> and elixir
<RX14> and knick their good ideas
<RX14> nick*
<RX14> @Dillybob1992 statically typed*
<RX14> static compilation is somethng else
<FromGitter> <Dillybob1992> oops, yeah
<FromGitter> <Dillybob1992> statically typed
<FromGitter> <Dillybob1992> in any event, it feels like a whole new world with statically typed. i guess bcz it is?
<RX14> yeah
<RX14> its a good thing to learn
<RX14> it helps when using dynamically typed languages too
<RX14> learn the "rules" of types before you break them by using dynamic languages I think
tankfeeder has joined #crystal-lang
<tankfeeder> o/
<dragonkh> I'm enjoying Crystal - having a compiler to point out my mistakes rather than trying to figure them out at runtime is very nice
<dragonkh> especially when learning
<dragonkh> not sure what language I will try next though
<FromGitter> <Dillybob1992> im relly liking this julia syntax
<FromGitter> <Dillybob1992> but i like crystalmore
<dragonkh> I learned D a couple of years ago when I wanted something with good performance - and it's quite nice - but I like that Crystal has the feel of Ruby
<dragonkh> D is not a very popular language though - it's always seems to get compared to Rust - and Rust have done a way better job with the community etc
cremes has joined #crystal-lang
cremes has quit [Client Quit]
<FromGitter> <ShriekBob> I'm mostly sat here waiting for the windows compiler. I don't feel like I know enough Crystal to assist, but I really want to write some games engine components in it
<RX14> soon(tm)
<dragonkh> nice
<FromGitter> <ShriekBob> Seems odd to jump in half way through a major process without much language capability
<dragonkh> I wrote a Tank game that used CSFML in D - I was thinking about porting it to Crystal for fun - but not had time
<FromGitter> <ShriekBob> games is my industry, and writing renderers are my jam, but it means I really need direct Vulkan and DX12 access
<FromGitter> <ShriekBob> I think CrSFML exists
<dragonkh> Thats my tank game: https://github.com/kingsleyh/dtanks
<dragonkh> should be fairly easy to port to Crystal using CrSFML then
<FromGitter> <ShriekBob> I'd just like to roll my own. I know renderers and game engines, and thus it's a good way for me to learn Crystal
<FromGitter> <ShriekBob> Not sure what I'd do with it yet, but I'd like to go all Handmade Hero in Crystal
<FromGitter> <ShriekBob> it'd be interesting to find some performance gaps too I think, given the real time performance requirements
<FromGitter> <PlayLights_twitter> Looks like strict_decode on Base64 class is not implemented yet right?
<FromGitter> <asterite> It seems so. There's a quite confusing commit here: https://github.com/crystal-lang/crystal/pull/1153/commits/cafe35aaf39fd9c1d73e3f036fdbb53ff5a231bc . Someone thought they were the same, then removed. Someone should probably implement those (but I don't know much about all the differences)
flaviodesousa has quit [Ping timeout: 256 seconds]
cremes has joined #crystal-lang
cremes has quit [Client Quit]
<FromGitter> <Dillybob1992> Who's tha tone guy who mentioned the song Star Boy last week
<FromGitter> <Dillybob1992> Anyways, been listening to that song on repeat for a while now, thanks :D
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <KevinSjoberg> If I try to run `crystal init lib .` within an empty Git directory, it fails with the error message `file or directory . already exists`. Wouldn't it be more accurate to add files in place then?
pta2002 has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
relyks has joined #crystal-lang
hightower3 has joined #crystal-lang
<FromGitter> <faustinoaq> I think so, meanwhile you can do something like: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a678fb7d9f895c360509599]
<FromGitter> <faustinoaq> Wait, it didn't as expected 😅
<FromGitter> <bew> You can do `crystal init foobar .` in master version
<FromGitter> <faustinoaq> @bew no, you can't 😅 ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a67918a5a9ebe4f75c5b6b8]
<FromGitter> <bew> Use bin/crystal ?
<FromGitter> <KevinSjoberg> @bew well, wouldn't that initialize the project under foobar in the current directory?
<FromGitter> <KevinSjoberg> I want to add files in place. `/some/path/foo $ crystal init lib .` creating files directly in `foo`.
<FromGitter> <bew> Isn't this what you want ?
<FromGitter> <bew> Yes that's xhat it does
<FromGitter> <bew> What it should do at least
<FromGitter> <KevinSjoberg> oh, `name` is just used for the templates?
<FromGitter> <KevinSjoberg> thought it was used for the generated path as well.
<FromGitter> <bew> It would be `crystal init lib foo .` to create a new lib project named foo in current directory
<FromGitter> <bew> Yes, name is for templates
<FromGitter> <bew> When you don't specify a path, `name` is used as the directory too
Ven`` has joined #crystal-lang
frojnd has joined #crystal-lang
<frojnd> Hi there.
<FromGitter> <KevinSjoberg> @bew right. I still think doing `crystal init lib .` in directory `foo` should create a new project named `foo` in the directory `foo`.
<frojnd> If I have a spec: HelloWorld.hello.should eq("Hello, World!") this mean I have to have HelloWorld class and inside hello method, right? But how do I define hello method so wen running HelloWorld.hello it would puts someting?
<frojnd> I mean I could do HelloWorld.new.hello but this wont work for this spesific spec
<frojnd> I am just learning crystal through exercism and docs...
<FromGitter> <bew> Would be `def self.hello; puts "Hello World!"; end`
<FromGitter> <bew> Make sure to read the docs bout class & module
<frojnd> FromGitter: you meant for me right?
<FromGitter> frojnd, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/crystal-lang/crystal
<frojnd> Ah ok
<FromGitter> <bew> Yes frojnd ;)
<frojnd> You areon gitter then :) @bew
<frojnd> Marking your nick in gitter I have to prepand `@` ?
<oprypin> long story short, yes
<oprypin> actual long story: you can start a message with "bew, " or "bew: " and @ will be added https://github.com/oprypin/critter/blob/master/gitter.cr#L74
<FromGitter> <bew> That's nice!
<frojnd> Are there any code styles out there for crystal?
<frojnd> Is it def self.compute(first_strand, second_strand) or is it self.compute( first_strand, second_strand )
relyks has quit [Quit: relyks]
<FromGitter> <bew> Yes frojnd, right in the docs: https://crystal-lang.org/docs/conventions/
<frojnd> @bew, thanx
<FromGitter> <bew> Also you can use the crystal formatter, to format your code
<frojnd> I just installed https://github.com/rhysd/vim-crystal
<frojnd> Gotta check the help, I see there is formatter included
<FromGitter> <bew> You'll have the command `:CrystalFormat` iirc, I use this a lot
<frojnd> Yeah it's `:CrystalFormat`
<crystal-gh> [crystal] RX14 closed pull request #5632: Use T#to_s instead of T#inspect for Array#to_s (master...Array#to_s-uses-T#to_s) https://git.io/vNwqh
<FromGitter> <drosehn> i'm (slightly) sad that I wasn't here for the earlier discussion of programming languages. I've always liked exploring different programming languages.
<dragonkh> you could always start up another discussion on the topic :)
<FromGitter> <drosehn> Heh. Well, I was waiting to see if there would be a groundswell of support for that. 😄 (though actually I'm kinda busy right now)
<dragonkh> heh
<FromGitter> <drosehn> I will say that I did dabble with `go` for awhile, when it was first announced. I get the impression that crystal's developers have already picked up the parts of `go` which are the most interesting, and that I wouldn't recommend spending time on it. Not if you're already good with crystal.
<FromGitter> <drosehn> https://research.hackerrank.com/developer-skills/2018/ -- this survey has some results which might be of interest for the next time a discussion about languages flares up here.
<dragonkh> I have been doing Elm and I don't think I want to go back to Javascript - despite it being an in demand skillet according to the site you linked
<dragonkh> also I'm not really a big fan of Python - I much prefer Ruby and subsequently Crystal - so I guess I'm not going to to be filling any of those particular demands
<FromGitter> <drosehn> I should also note that I do nothing with web-based development, and don't have much interest in it. Well, I have *some* interest, but I have so many other programming projects that I know I'll never actually do any web-level development.
<dragonkh> I enjoy web development - It's a nice break from working on backend stuff
<dragonkh> I'm not very interested in css though - I prefer to leave that to people who enjoy it
<FromGitter> <drosehn> I'm a little puzzled by the big difference between python and ruby, since in many ways they're pretty similar. I think the big advantage for python is the scientific libraries which have been built up for it. I'd like to see libraries like that implemented in crystal. In my copious spare time, of course.
<dragonkh> yeah Python has a ton of libraries and is the recommended way to get started coding on Raspberry PI and for kids etc
<dragonkh> but I just don't like the space delimiting in Python
<dragonkh> which is weird as I can cope with it ok in Elm and Haskell
<FromGitter> <drosehn> I dabbled in Python before ruby really showed up, and the space-delimiting thing doesn't really bother me at all. If you're a fan of "code style", you're probably doing something similar to that anyway. I did some programs in Python, but it didn't really grab my interest.
<FromGitter> <drosehn> But then Ruby came along and *everything* was an object, and that seemed like that would make for interesting programming choices. I'm still pretty happy with ruby for most things.
<dragonkh> I did Perl before Ruby arrived - and then a bit of PHP in parallel
<dragonkh> I remember people constantly asking me what is Ruby - until Rails arrived - then people constantly asked me do you know Rails
<FromGitter> <drosehn> Well, I did perl before python. And while I could see that my perl code sucked (especially as programs grew larger), python wasn't a dramatic enough change for me to switch away from perl. Maybe that was a stupid decision on my part, but that's how I felt.
duane has quit [Ping timeout: 240 seconds]
<dragonkh> I'm glad I switched to Ruby - although I could not get a job doing Ruby - and by the time jobs started appearing I was doing Java in Banks - and the pay gap was too big to start taking Ruby work
<dragonkh> as a professional programmer I take only jobs in languages that pay well - even though in my spare time I love to code in niche languages like Crystal
<FromGitter> <drosehn> I work as part of the computer center in a college, so I'm used to not being paid well... 😄 But it does mean I can work on a wide range of things, and I enjoy that.
<dragonkh> The big win for me with Crystal - is the compiler and the type system - I would definitely like to see more syntactic pattern matching like Haskell and Scala
<FromGitter> <drosehn> We recently made setup accounts on Box.com, and it turned out that someone had written a very good ruby API for working with the information Box.com makes available. So suddenly one of the guys I worked with was extremely interested in ruby.
<dragonkh> nice
<dragonkh> you could port it to Crystal :)
<dragonkh> aww no free option on Box.com
<dragonkh> oh yes there is
<dragonkh> an individual plan
Ven`` has quit [Ping timeout: 246 seconds]
<Papierkorb> dragonkh: Question is then, are you already abusing case tuple statements?
<dragonkh> Papierkorb well depends on what you mean by abusing - I'm using them for sure
Ven`` has joined #crystal-lang
<dragonkh> although I've recently started using them less, as having too many items is a bit clunky
<RX14> I still havent found someone give me a usecase for more pattern matching
<dragonkh> I think it's just sugar in the main - which is generally subjective - I could with some thought propose some usecases
dragonkh_ has joined #crystal-lang
<dragonkh_> bah
Ven`` has quit [Ping timeout: 240 seconds]
dragonkh_ has quit [Client Quit]
dragonkh_ has joined #crystal-lang
dragonkh has quit [Ping timeout: 246 seconds]
dragonkh_ is now known as dragonkh
Ven`` has joined #crystal-lang
duane has joined #crystal-lang
Ven`` has quit [Ping timeout: 264 seconds]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ven`` has joined #crystal-lang
Ven`` has quit [Ping timeout: 256 seconds]
Ven`` has joined #crystal-lang
jnyw has joined #crystal-lang
qard has joined #crystal-lang
moei has quit [Quit: Leaving...]
qard has quit [Client Quit]
Ven`` has quit [Read error: Connection reset by peer]
Ven` has joined #crystal-lang
cremes has joined #crystal-lang