pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Philpax has joined #crystal-lang
<FromGitter>
<kofno> OK... I'm trying to use the Compiler class internally in my project. When I remove that code, everything works fine.
<FromGitter>
<kofno> I bet I'm just including the compiler command and it's running the compiler CLI... ugh...
<FromGitter>
<kofno> yup... that's what I'm doing...
pawnbox has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
<adam12>
jhass: Did you write Process.exec? :) :)
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
Philpax has quit [Ping timeout: 244 seconds]
soveran has quit [Remote host closed the connection]
<FromGitter>
<danieldraper> Hi everyone — New crystal developer here :) Curious if anyone can share a better way to access a row from the database. Currently I have something that looks like: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ When the hash key is missing then it throws and exception which is fair enough but is there a nice way to access this? I assumed `user[“first_name”]?` would have worked however not the case.
onethirtyfive has quit [Remote host closed the connection]
onethirtyfive has joined #crystal-lang
the_drow_ has joined #crystal-lang
Philpax has quit [Ping timeout: 244 seconds]
Philpax has joined #crystal-lang
the_drow_ has quit [Quit: This computer has gone to sleep]
Philpax has quit [Ping timeout: 244 seconds]
pawnbox has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
davidklsn has joined #crystal-lang
<FromGitter>
<sdogruyol> @danieldraper you can do user.fetch("first_name", "")
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<FromGitter>
<danieldraper> Thanks, is there a way to use the PG::Result with JSON.mapping? Haven't been able to get anything working
<FromGitter>
<danieldraper> All the examples I've seen use a macro which doesn't seem to allow for flexibility where you want different JSON keys from what is in the database and converters etc
mounibec has joined #crystal-lang
xxxx has joined #crystal-lang
davidklsn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mounibec has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
wiiw has quit [Ping timeout: 244 seconds]
davidklsn has joined #crystal-lang
mark_66 has joined #crystal-lang
bjz has joined #crystal-lang
xxxx is now known as wiiw
mounibec has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
mounibec has quit [Client Quit]
mounibec has joined #crystal-lang
mounibec has quit [Client Quit]
pawnbox has quit [Read error: Connection reset by peer]
mounibec has joined #crystal-lang
NeverDie has joined #crystal-lang
mounibec has quit [Client Quit]
Ray___ has joined #crystal-lang
pawnbox has joined #crystal-lang
mounibec has joined #crystal-lang
wiiw has quit [Read error: Connection reset by peer]
Ray___ has quit [Client Quit]
pawnbox has quit [Read error: Connection reset by peer]
<jhass>
adam12: yup
<jhass>
jwoertink: We decided to keep the type inference algorithm simple, that means it doesn't try to guess from methods as that would require typing them first. Another way to solve this is to have @data : Hash(YAML::Type, YAML::Type) at the class level
<jhass>
adam12: good way is kinda subjective, it'll certainly work and we probably don't have anything better atm
<jhass>
wmoxam: sounds like a compiler bug, if you have code to reproduce it please open an issue :)
scottj has left #crystal-lang [#crystal-lang]
mounibec has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
matp has quit [Remote host closed the connection]
matp_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
pawnbox has joined #crystal-lang
matp_ has quit [Ping timeout: 240 seconds]
onethirtyfive has quit [Remote host closed the connection]
crystal-lang622 has joined #crystal-lang
<crystal-lang622>
hi
crystal-lang622 has quit [Client Quit]
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Remote host closed the connection]
trapped has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
matp has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<FromGitter>
<tomb0y> hey guys, quick question: ⏎ is there a similar lib for crystal like rubocop for ruby? ⏎ (I'd love to play around with the idea if there's nothing out there so far, or just browse the code if it already exists)
<Yxhuvud>
tomb0y: crystal tool format
<Yxhuvud>
or well, maybe not that similar but anyhow
<FromGitter>
<tomb0y> I'll look into it, thanks!
the_drow has joined #crystal-lang
_ht has joined #crystal-lang
<FromGitter>
<ssaatya> Hello
<FromGitter>
<ssaatya> How should i include HTTP::Client
<FromGitter>
<kofno> The compiler defaults to a prelude file named "prelude". Does that file exist somewhere?
<txdv>
kofno: /opt/crystal/src/prelude.cr
<FromGitter>
<kofno> hrm... when I run a compiler from code, I get `while requiring "prelude": can't find file 'prelude'`
<FromGitter>
<kofno> seems like I'm doing something wrong.
<FromGitter>
<ssaatya> can anyone help
<FromGitter>
<kofno> `require "http/client"`
<FromGitter>
<ssaatya> inside a class
<FromGitter>
<kofno> maybe provide some example code that isn't working
<FromGitter>
<kofno> and someone might be able to help you fix it
<FromGitter>
<ssaatya> class AUR ⏎ include HTTP::Client ⏎ ⏎ def searchPackage(package, by : String = "name-desc") ⏎ url = "aur.archlinux.org/rpc/?v=5&type=search&by="+ by + "&args=" + package ... [https://gitter.im/crystal-lang/crystal?at=57a4801ed097eb6b2cc77ce5]
<FromGitter>
<kofno> You have to `require "http/client"` before you can use it. And it's not a module, so you can't include it. --> https://carc.in/#/r/162a
<FromGitter>
<ssaatya> HTTP is a module ⏎ but i'm unable to include
<FromGitter>
<ssaatya> module
<FromGitter>
<kofno> You were trying to include HTTP::Client. The client is not a module.
<FromGitter>
<kofno> For the code you provided there is no need to `include` anything
<FromGitter>
<ssaatya> yes you were correct
<FromGitter>
<ssaatya> thanks
the_drow has quit [Quit: This computer has gone to sleep]
<FromGitter>
<ssaatya> But still i'm unable include HTTP module
soveran has joined #crystal-lang
<FromGitter>
<kofno> I don't understand what problem you are trying to solve by including HTTP. Here's that same code, with HTTP included --> https://carc.in/#/r/162l
<FromGitter>
<kofno> Is that what is causing my error? Or is this a value judgement?
soveran has joined #crystal-lang
<FromGitter>
<kofno> I tried to use some of the convenient requires, but if I wanted the compiler I needed to grab some other files.
mounibec has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pduncan has joined #crystal-lang
<BlaXpirit>
you're probably right about that
mounibec has joined #crystal-lang
<FromGitter>
<kofno> It may be possible to do what I want by reassembling some of those pieces on my own, but at some point I'll just be duplicating effort.
<FromGitter>
<kofno> but I still thought the prelude error was weird.
<FromGitter>
<kofno> ^ I've come back and re-read that comment. I hope that tone didn't come across as dismissive or ungrateful. Genuine thanks! Really appreciate the feedback.
pduncan has joined #crystal-lang
<adam12>
jhass: Yeah - I actually need exec for something I'm building, so it caught me off guard when I saw it in source.
mkl0501 has joined #crystal-lang
<adam12>
jhass: Since I looked at source a few days ago and obviously it wasn't there.
<jhass>
it was easy enough to do ;)
<adam12>
Much thanks.
<adam12>
Now if you could write some sort of process title changer you'd have done all the hardwork for me.
<adam12>
jk
<jhass>
it's actually surprisingly hard to do
<jhass>
not portable the slightest
<adam12>
Yeah - I mocked up something that I think works in Linux, but obviously not Mac
<adam12>
Which I suspect is the hardest.
daekano has joined #crystal-lang
soveran has quit [Remote host closed the connection]
kulelu88 has joined #crystal-lang
<crystal-gh>
[crystal] asterite pushed 4 new commits to master: https://git.io/v6YPv
<crystal-gh>
crystal/master c441a36 Ary Borenszweig: Compiler: reverted some bindings logic
<crystal-gh>
crystal/master 88ae2f4 Ary Borenszweig: Compiler: `||` now does type filtering. Fixes #2464
<crystal-gh>
crystal/master 33c3eff Ary Borenszweig: Fixed bug related to `if` and multiple `&&`
<FromGitter>
<jwoertink> @jhass thanks for the note about the type inference
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
<FromGitter>
<jwoertink> This is saying since "@address is inferred to be Address, because the class method Address.unknown has a return type annotation of Address"
<FromGitter>
<jwoertink> In the case of the YAML `as_h` method, that method has a return type annotation of `Hash(Type, Type)`
<FromGitter>
<jwoertink> so, assigning the value of `as_h` to an instance variable should work, but it fails
<FromGitter>
<mverzilli> hi Jeremy, the title of that section is "Assigning the result of a *class method* that has a return type annotation", and `as_h` is an instance method
<FromGitter>
<mverzilli> note `Address.unknown` is a class method
<FromGitter>
<jwoertink> Oh, so that actually makes a difference in type inference...
<pduncan>
this is probably a dumb ? but I haven't had much luck finding an answer to it: when a dep goes into `./libs`, is there a way to set up `crystal build` so that I don't have to write `require "./libs/blah/blah"` in my source?
<FromGitter>
<jwoertink> You shouldn't have to require "./libs" ever. It will already look in libs. just `require "blah/blah"`
Oliphaunte has quit [Remote host closed the connection]
<pduncan>
I must be doing something else wrong then, because when ever I do that and run `crystal build src/foo.cs` I get an error about crystal not finding `blah` in `./src/`
<pabs>
hello paul duncan!
<pabs>
<-- also named paul duncan
<FromGitter>
<jwoertink> lol
<jhass>
could we remove the fake values please? What's the actual error message?
<pduncan>
hi pabs!
<pduncan>
sure, just a sec
<pduncan>
ugh, and now I can't reproduce it. sorry, it's fine
<jhass>
:)
<pduncan>
my bonehead moment for the day, hopefully the only one :-P
_ht has left #crystal-lang [#crystal-lang]
<FromGitter>
<jwoertink> I have many of those. The key is to recover from them quick before anyone else realizes lol
<pduncan>
I usually at least try to recover before getting to the "embarrass myself on IRC" step, but didn't accomplish that this time :)
<FromGitter>
<jwoertink> :smile:
Oliphaunte has joined #crystal-lang
pmetzger has joined #crystal-lang
<pmetzger>
Howdy! I'm not quite sure trying to read the docs, but does Crystal do parametric polymorphism? Does it have type variables?
Oliphaunte has quit [Ping timeout: 250 seconds]
<pmetzger>
(Those are two distinct questions of course though they're interrelated.)
mark_66 has quit [Remote host closed the connection]
mounibec has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<pmetzger>
So an upper case single letter is a type variable (and one presumably can't name a class after a single upper case letter then.)
<pmetzger>
Since "Number" can be used as a type restriction, does that imply that "Number" is a superclass of integers and floats and such, or is it some other sort of thing?
<pmetzger>
(Sorry for asking so much.)
<FromGitter>
<jwoertink> The `T` is specific. You could name a class `F`
<FromGitter>
<jwoertink> There's also a `U`. I'm still a bit unclear on these, but I think `T` is generic, and `U` is union
<pmetzger>
the "Free Variables" section of "Type Restrictions" says: "If you use a single uppercase letter as a type restriction, the identifier becomes a free variable"....
<pmetzger>
(In general, one often wants more than one type variable when defining parametrically polymorphic functions....)
<FromGitter>
<jwoertink> ^ that's above my paygrade >_<
dialtoneInsomnia has joined #crystal-lang
matp has joined #crystal-lang
<pmetzger>
Hrm. Number isn't a superclass of Complex?
Oliphaunte has joined #crystal-lang
soveran has quit [Remote host closed the connection]
dialtoneInsomnia has quit [Ping timeout: 250 seconds]
<asterite>
pmetzger: maybe it should, but some methods must be redefined to raise (for example `<=>`)
<pmetzger>
BTW, Ruby compatibility is said to be a non-goal, but the language is very close to Ruby. How much of a non-goal is it? :)
<FromGitter>
<kofno> HOT DOG! My compiler experiment started working when I set my CRYSTAL_PATH!
<adam12>
pmetzger: I'm pretty sure if Ruby code works as-is with Crystal, consider it a happy accident.
<asterite>
pmetzger: with that we are basically saying "don't expect crystal to compile your ruby programs", but we do try to keep syntax+API compatibility when we think Ruby is fine there
poulet_a has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<pmetzger>
So is there a desire to leverage the existing Ruby ecosystem to get useful libraries and tools off the ground, or is that a non-goal?
<BlaXpirit>
pmetzger, it is impossible
<pmetzger>
impossible because...?
<pmetzger>
(Clearly code would require reworking but it looks like huge chunks of stuff could just be lightly modified...)
<BlaXpirit>
pmetzger, for the same reason as with Python's ecosystem
steenuil has joined #crystal-lang
<BlaXpirit>
well ok it's uncomparable but yeah
<pmetzger>
I'm not sure I follow what issue with python's ecosystem you're referring to?
poulet_a has left #crystal-lang [#crystal-lang]
mounibec has joined #crystal-lang
A124 has joined #crystal-lang
zodiak has joined #crystal-lang
<jhass>
pmetzger: basically, if we can make an API pretty or like Ruby, we make it pretty instead
<jhass>
that has priority over Ruby compatibility
<pmetzger>
Though it seems that, if only by accident, it looks a lot like Ruby.
<jhass>
well, many of us are Rubyists after all, we do find a lot of Ruby's APIs pretty ;)
zodiak_ has quit [Ping timeout: 264 seconds]
LastWhisper____ has joined #crystal-lang
LastWhisper____ has quit [Read error: Connection reset by peer]
LastWhisper____ has joined #crystal-lang
beverast has joined #crystal-lang
<pmetzger>
Are the sources compatible with the latest LLVM releases?
<pmetzger>
(The docs seem to indicate LLVM 3.5 and 3.6 only but I don't know if they're up to date.)
<jhass>
pmetzger: 0.18.7 is still linked at 3.5 but master is able to link against 3.8
<jhass>
and 0.19 will likely ship linked against 3.8
<pmetzger>
cool.
<pmetzger>
So if I build from source from github I can use 3.8 I presume.
<BlaXpirit>
pmetzger, yes, but of course you still need the latest release of crystal installed, which is statically linked to llvm 3.5
<BlaXpirit>
for bootstrapping
<BlaXpirit>
hm might be 3.6
<jhass>
nope, 35
davidklsn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
soveran has quit [Remote host closed the connection]
LastWhisper____ has quit [Ping timeout: 252 seconds]
soveran has joined #crystal-lang
davidklsn has joined #crystal-lang
<pmetzger>
What's the policy on licenses? It seems to be Apache license but GMP is in use and that's GPLed?
beverast has quit [Ping timeout: 250 seconds]
soveran has quit [Remote host closed the connection]
<BlaXpirit>
> Dual LGPLv3 and GPLv2
davidklsn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
davidklsn has joined #crystal-lang
mounibec has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
onethirtyfive has joined #crystal-lang
pmetzger has quit [Remote host closed the connection]
<crystal-gh>
[crystal] CodeSteak opened pull request #3100: Websocket masking: replace `% 4` with `& 0b11` for performance. (master...faster-websocket-masking) https://git.io/v6OZF
Crizkov has joined #crystal-lang
<Crizkov>
Hello @asterite: Which IDE do you use for create Crystal? RubyMine or something like that?
<jhass>
I think Ary was a sublime text user too
Crizkov has quit [Ping timeout: 250 seconds]
A124 has quit [Quit: '']
triangles has joined #crystal-lang
<asterite>
I use sublime text in vi mode :-)
<FromGitter>
<jwoertink> Is the shards `postinstall` working? Or is that a feature that's gonna be implemented later?
<FromGitter>
<jwoertink> I just tried `postinstall: echo "ALL DONE"`, and it did nothing, so I wasn't sure
ShriekBob has joined #crystal-lang
ShriekBob has quit [Quit: Page closed]
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: https://git.io/v6Oux
<crystal-gh>
crystal/master 0a84d9a Ary Borenszweig: Fixed #3099: Formatter: match indentation of first line in multiline strings
<FromGitter>
<jwoertink> The reason I ask is because I was hoping to do something like `postinstall: crystal build --release -o ./guardian libs/guardian/guardian.cr`
Oliphaunte has quit [Remote host closed the connection]
<crystal-gh>
[crystal] asterite pushed 2 new commits to master: https://git.io/v6OzY
<crystal-gh>
crystal/master 81a0162 CodeSteak: replace `% 4` with `& 0b11` for websocket masking performance