jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.18.7 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
Philpax has joined #crystal-lang
ponga has quit [Quit: Connection closed for inactivity]
Oliphaunte has joined #crystal-lang
Philpax has quit [Ping timeout: 258 seconds]
pawnbox has joined #crystal-lang
Philpax has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
Philpax has quit [Ping timeout: 240 seconds]
pawnbox has quit [Ping timeout: 244 seconds]
Philpax has joined #crystal-lang
kulelu88 has quit [Quit: Leaving]
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
snsei has joined #crystal-lang
x0f_ has joined #crystal-lang
x0f has quit [Ping timeout: 258 seconds]
x0f has joined #crystal-lang
x0f_ has quit [Ping timeout: 258 seconds]
Oliphaunte has quit [Remote host closed the connection]
snsei has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
snsei has joined #crystal-lang
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 258 seconds]
pawnbox has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
snsei has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 240 seconds]
akwiatkowski has joined #crystal-lang
mark_66 has joined #crystal-lang
Philpax has quit [Ping timeout: 240 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
alsm has joined #crystal-lang
bjz has joined #crystal-lang
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 276 seconds]
ponga has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Client Quit]
<crystal-gh> [crystal] jhass closed pull request #2972: Add IO::Sized (master...feature/sized-io) https://git.io/vKsdL
pawnbox has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 276 seconds]
<travis-ci> crystal-lang/crystal#d4f50a9 (master - Merge pull request #2972 from RX14/feature/sized-io): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/143829579
Cidan has quit [Ping timeout: 264 seconds]
latemus has joined #crystal-lang
zz_Cidan has joined #crystal-lang
zz_Cidan is now known as Cidan
Cidan has quit [Changing host]
Cidan has joined #crystal-lang
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 246 seconds]
pawnbox has joined #crystal-lang
Philpax has joined #crystal-lang
soveran has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Philpax has quit [Read error: Connection reset by peer]
Oliphaunte has quit [Ping timeout: 240 seconds]
Philpax has joined #crystal-lang
Philpax has quit [Read error: Connection reset by peer]
psylone has joined #crystal-lang
psylone has quit [Client Quit]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
buggs has joined #crystal-lang
Raimondii is now known as Raimondi
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<FromGitter> <sdogruyol> hey all
<FromGitter> <mose> hey hey
trapped has joined #crystal-lang
<j2k> Is it possible to have variables in kemal's layout view (and its subviews)? sdogruyol ?
<FromGitter> <sdogruyol> what do you mean?
<FromGitter> <sdogruyol> you can have variable in your views
<j2k> but wat about the layout view?
<FromGitter> <sdogruyol> you can yield the subview via content
<FromGitter> <sdogruyol> you can also use content_for / yield_content for view specific conditinal stuff
<FromGitter> <sdogruyol> e.g custom javascript, html
<j2k> Aha this is almost what I need.
<j2k> sdogruyol: I'm basically trying to add a login/logout button in my navbar.ecr, which is a partial of my layout.ecr
<FromGitter> <sdogruyol> ugh
<FromGitter> <sdogruyol> you yield your own io
pawnbox has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 246 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
Philpax has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
<j2k> Seems like the setup script is borked https://gist.github.com/Vanhecke/9cf66164a0b356b06d8a110ef8a32c92
<jhass> j2k: well, it doesn't install apt-transport-https
<jhass> so on a very very minimal system it fails, yeah
<j2k> Ok, that means someone changed the runner image
<jhass> mainly because debian thinks its a good idea to split every line of code into its own package ;)
<j2k> crystal on openbsd _when_
<jhass> which runner image?
<j2k> gitlab's whatever docker image
<jhass> I don't follow
<j2k> Gitlab compiles/tests my crystal app
<jhass> aha
<jhass> no idea what the setup is there
<j2k> they run it in a docker image for ruby :P
<jhass> the repo recently switched to https
<jhass> so that's why we need apt https support now
<FromGitter> <sdogruyol> meh
<FromGitter> <sdogruyol> i want something like this ⏎ ⏎ ```STORE = {} of String => Box``` [https://gitter.im/crystal-lang/crystal?at=5783a3583eaf66535e757d98]
<FromGitter> <sdogruyol> yet we can store `Box` without any type then what's the point of boxing :/
<FromGitter> <sdogruyol> cant*
<jhass> you can, just get a pointer to it
<jhass> its point is that it's a class, so on the heap
<jhass> so you can box struct's into it
<FromGitter> <sdogruyol> well i want to store any `T` within STORE
<jhass> how do you know which one it is?
<jhass> later
<FromGitter> <sdogruyol> well
<FromGitter> <sdogruyol> this is kinda hacky but something like this
<FromGitter> <sdogruyol> i need some kind of thread local storage for context
<FromGitter> <sdogruyol> nvm the constant btw just for quick try
<jhass> fiber local rather?
<FromGitter> <sdogruyol> yeah fiber in our case
<FromGitter> <f> Hi everyone!
<jhass> mh, there was a question on fiber/thread local storage somewhere but I can't find it anymore
<jhass> Until we allow Object as generic type argument, there's no sane generic solution
<jhass> Ary's recommendation for now was to monkey patch custom accessors into Thread or Fiber
<jhass> and then use Fiber#current/Thread#current to access it
<FromGitter> <sdogruyol> still how i can store `T` in somewhere
<FromGitter> <sdogruyol> i'd like a `HTTP::Context` storage that can hold any object
Oliphaunte has joined #crystal-lang
Raimondii has joined #crystal-lang
<j2k> jhass: FYI - this how I now use gitlab CI (thanks to your docker img): https://gist.github.com/Vanhecke/4f3abe4ea1ca4417293fe0d5657c8875
<j2k> its free for private repos, so quite cool
<jhass> cool
<jhass> keep in mind to rebuild that imagine shortly after each release (after I rebuilt the base)
<jhass> or does it get rebuild on each run?
<j2k> yeah
Raimondi has quit [Ping timeout: 240 seconds]
<jhass> I see, great
Raimondii is now known as Raimondi
mark_661 has joined #crystal-lang
<FromGitter> <sdogruyol> is there a way to constantize a string a.la `"Asd".constantize" => Asd : Class`
mark_66 has quit [Ping timeout: 240 seconds]
<RX14> jhass, i removed the leftover comment
mark_661 has quit [Read error: Connection reset by peer]
<jhass> <3
mark_66 has joined #crystal-lang
<jhass> sdogruyol: no really sane one
<RX14> jhass, i wonder what the cost of using the active_delimiter_buffer rather than just a offset in delimiter_buffer as an int is
<leafybasil> Hey crew, where are getter/setter documented? I can't seem to find in docs
<RX14> in objest
<RX14> object*
<RX14> leafybasil, https://crystal-lang.org/api/0.18.7/Object.html#getter%28%2Anames%29-macro
<leafybasil> RX14: thanks, that makes sense now that you say it
<leafybasil> Also 18.7!? OMGEE.
<RX14> what crystal version are you on?
<leafybasil> Some version of 17.4
<leafybasil> I'll update later today
<RX14> ah
<RX14> at least its not 0.15.0
<leafybasil> :)
<RX14> or something like that
<FromGitter> <sdogruyol> ah crap
<FromGitter> <sdogruyol> i really hope that `T` as generic type argument comes soon
<jhass> you mean Object?
<RX14> just the generic stuff
<RX14> in general
<jhass> well Ary decided to work on parallelism first
<RX14> just being able to hold an object reference and dispatch inspect and to_s on it regardless of type
<leafybasil> I wanted to wrap an API, but their keys are annoyingly camelCased so using the JSON mapping macro would result in deep rage. This leaves me three obvious options, 1) use the macro but map the fields with methods, 2) parse the json and set values by hand 3) write a custom PullParser that modifies the keys while parsing. Any other suggestions?
<FromGitter> <sdogruyol> practically we can't store an Object :/
<jhass> leafybasil: JSON.mapping has the form of foo_bar: {key: "fooBar", type: String}
<leafybasil> Oh
<leafybasil> Beautiful
<leafybasil> jhass: beautiful.
<jhass> I think it was key, there's something like it at least
<leafybasil> I didn't see it but I have a habit of scanning too quickly
mark_66 has quit [Quit: Leaving.]
Philpax has quit [Ping timeout: 252 seconds]
kulelu88 has joined #crystal-lang
kulelu88 has quit [Changing host]
kulelu88 has joined #crystal-lang
<FromGitter> <alex-lairan> Hi everyones, I have a problem with File writing.
<FromGitter> <alex-lairan> I want to write on a log file, this is my code: ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5783c17d59cfbd4c5e79f927]
* jhass waits for the question
<FromGitter> <alex-lairan> ho sorry x)
<FromGitter> <alex-lairan> Why this don't write on the log file?
<FromGitter> <alex-lairan> On normal time, this write on the daily.log file?
<FromGitter> <alex-lairan> But it's just create the file without write inside
<jhass> mh, probably because you don't call .close
<jhass> well we already had this discussion, no?
<RX14> did we?
<jhass> I remember something like that, yes
<FromGitter> <alex-lairan> Ok thank ! Does I need to close each time I want to write?
<jhass> no, just at the end of your program
<jhass> btw did you see the Logger class in stdlib?
<jhass> RX14: anyway, I can't confidently argue either side either
<FromGitter> <alex-lairan> No I didn't see this class
p0nce has left #crystal-lang [#crystal-lang]
<FromGitter> <alex-lairan> I go see the documentation of it !
<FromGitter> <alex-lairan> Thank !
<jhass> yw
<RX14> jhass, found it
alsm has quit [Ping timeout: 244 seconds]
soveran has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
ponga has quit [Quit: Connection closed for inactivity]
triangles has quit [Quit: Leaving]
tomchapin has joined #crystal-lang
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 276 seconds]
snsei has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
<RX14> jokke, PR'ed crouter to make it work with crystal 0.18.0+
<jokke> Thx!
<jokke> I don't have my pc with me right now but I'll look into it later alright?
<RX14> yeah, thats ok
<RX14> travis passes though
<jokke> Yeah it's just that i can't log into github from my phone
<RX14> oh...
<RX14> i always manage
<jokke> Yeah it's complicated. New phone and such
tomchapin has joined #crystal-lang
<RX14> heh, i understand
<jokke> I see crystal dropped support for "string": foo hash syntax...
<RX14> yep
<jokke> Why?
<RX14> named tuple now
<jokke> Oh
<jokke> Alright then
<RX14> which is immutable, and what people should be using for option hashes
Oliphaunte has joined #crystal-lang
<jokke> Ah I see
<jokke> But why not force usage of symbols for keys
<RX14> because each k:v pair can have a different type
<jokke> Mmh
<RX14> what do you mean force usage of symbols as keys?
<jokke> For option hashes
<RX14> the idea is that {k: v, "key": v} is always a named tuple
<jhass> ^
<RX14> and => is always hash
<jhass> second external names can have spaces
<RX14> it's unifying the syntax
<jhass> third you might want to create a named tuple from json with keys having spaces
<RX14> hmmn
<RX14> is named tuple json-compatible?
<jhass> yes
<RX14> huh nice
<RX14> except null
<RX14> heh
zodiak_ has quit [Ping timeout: 252 seconds]
<jhass> oh, we lack Nil.from_json?
<RX14> no
<RX14> i was saying if you pasted in json
<RX14> as a named tuple
<RX14> null would have to be renamed as nil
<jhass> oh you mean like that
<jhass> I meant
<jhass> >> NamedTuple(foo: String).from_json(%("foo": "bar"))
<DeBot> jhass: undefined method 'from_json' for NamedTuple(foo: String):Class - https://carc.in/#/r/13mm
<jhass> heh
<jhass> + require but you get
pawnbox has quit [Read error: No route to host]
<RX14> nice
pawnbox has joined #crystal-lang
<RX14> also forgot {}
<jhass> yeah
<RX14> around the object
<jhass> and half the words in my last sentences
pawnbox_ has joined #crystal-lang
<jokke> Oh so now we have to write { :foo => bar}
<jokke> :(
<RX14> yeah but hash literals aren't used as much in crystal
<RX14> so its not as big a deal
<jokke> Yeah I guess so
<RX14> crystal's community seems to favour immutability, plus NamedTuple is kinda more useful because of the different types for different keys
<RX14> and the whole compile time error stuff
pawnbox has quit [Ping timeout: 240 seconds]
zodiak has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vKn9Q
<crystal-gh> crystal/master 6102cb8 Ary Borenszweig: Fixed #2982: incorrect type lookup
triangles has joined #crystal-lang
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<travis-ci> crystal-lang/crystal#6102cb8 (master - Fixed #2982: incorrect type lookup): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/143963448
tomchapin has joined #crystal-lang
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 264 seconds]
<RX14> jhass, is there any way to require everything in a directory apart from one
<RX14> because crystal is complaining that a util macro I have is defined after a piece of code
<RX14> but it's actually required both before and after
<jhass> I'm not sure how that would even look like syntax wise
<RX14> and i can't reduce the bug
<RX14> it's just so annoying
<RX14> i do a require "./util/**" then require "./**"
<RX14> and it still complains a util method is defined after
<RX14> which is just dumb
<RX14> it's a macro expansion in an expansion and all pretty much an edge case i guess
<RX14> i guess i'll have to rename util to aaautil
<asterite> RX14: does it work if you require the file that defines the macro in the file that uses it?
<RX14> asterite, nope
<RX14> and i simply can't preproduce it
<RX14> it worked in 0.15.0
<RX14> now i'm upgrading this project its broken
<asterite> then it worked out of pure luck in 0.15
<RX14> uhh
<asterite> if you can reduce it and report it, great :)
<asterite> otherwise there's not much we can do
<RX14> what do you mean worked out of pure luck
<asterite> well, even without reducing, just a link to the repo
<RX14> it's private
<RX14> so i would have to reduce it quite a bit
<asterite> it means that using a macro that is found after the code that uses it sometimes work and sometimes it crashed the compiler
<asterite> ah, ok
<RX14> well at least strip bits out and anonymise it
<RX14> well its a pretty simple macro
<RX14> plus it was expended in some sort of tripply nested macro fudge
<RX14> so it's probably run on like the third macro pass
<RX14> because it's in a proc in a crouter route
<RX14> asterite, https://carc.in/#/r/13n9
<RX14> there we go
tomchapin has joined #crystal-lang
<RX14> i assume require doesn't track the files it's required previously
<RX14> because if it did then it wouldn't be required twice and have the error
<RX14> oh
<RX14> wait
<RX14> thats interesting
<RX14> verry interesting
<RX14> so i need to move the require for crouter after my util code
<RX14> thats an easy enoguh work around
<RX14> asterite, its even worse: https://carc.in/#/r/13nb
<RX14> its just bugged
<RX14> i literally can't compile my code
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/vKcfA
<crystal-gh> crystal/master 7fd2b33 Ary Borenszweig: Added `Class#nilable?` and `Union.nilable?`
<crystal-gh> crystal/master dc9f526 Ary Borenszweig: Fixed #2983: `JSON.mapping` doesn't work with nilable type when missing key
akwiatkowski has quit [Ping timeout: 244 seconds]
willl has joined #crystal-lang
ssvb has quit [Remote host closed the connection]
soveran has joined #crystal-lang
<travis-ci> crystal-lang/crystal#dc9f526 (master - Fixed #2983: `JSON.mapping` doesn't work with nilable type when missing key): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/143986284
Guest10105 has joined #crystal-lang
<Guest10105> Is there any way in Crystal to transform a block of code to a string?
<Guest10105> similar to the Ruby 'sourcify' gem's `to_source` method
<Guest10105> but it would need some different trick, since (AFAIK) that gem actually reads the source code of the current file
akwiatkowski has joined #crystal-lang
<RX14> asterite, wow thts quite a reduction
sebler_ has quit [Remote host closed the connection]
sebler has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vKcYH
<crystal-gh> crystal/master 177828e Ary Borenszweig: Fixed #2984: Macros not correctly working inside proc literals and other places
tomchapin has joined #crystal-lang
pawnbox has joined #crystal-lang
Renich has joined #crystal-lang
Guest10105 has quit [Quit: Guest10105]
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<travis-ci> crystal-lang/crystal#177828e (master - Fixed #2984: Macros not correctly working inside proc literals and other places): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/144000465
<RX14> do you know whay?
<RX14> also will the macro fix make it into a 0.18.0 fix?
<RX14> 0.18.x*
snsei has quit [Remote host closed the connection]
<jhass> I think the current plan is to have no 0.18.x anymore
Oliphaunte has quit [Remote host closed the connection]
<RX14> but i can't compile on 0.18.x
<RX14> sooo
<RX14> what do I do?
<RX14> build my own custom compiler version?
<RX14> this is a major bug
<RX14> like, macros don't work in procs!
<RX14> thats something that requires a bugfix release to me
<jhass> RX14: I forgot which distro you're on
<RX14> arch
<RX14> but i'm running this project using docker
<RX14> so i'd have to build my own crystal docker container release
<RX14> which is kinda a pain
<jhass> mh yeah, you have to then
<RX14> considering I use the unofficial alpine linux package
<RX14> which i don't even know how its build
<RX14> built*
Renich has quit [Quit: leaving]
soveran has quit [Remote host closed the connection]
<crystal-gh> [crystal] beno opened pull request #2985: suppress newlines (master...suppress-new-lines) https://git.io/vKcRn
tomchapin has joined #crystal-lang
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Oliphaunte has joined #crystal-lang
ylluminate has joined #crystal-lang
jsaak_ has quit [Ping timeout: 264 seconds]
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Doug__ has joined #crystal-lang
deverly has joined #crystal-lang