ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.22.0 | Fund Crystal's 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
<FromGitter> <akzhan> Reason: Security, Vulnerability, Bots, Mailware using play.crystal...
<FromGitter> <akzhan> So there is sandbox
muhlisbc has quit [Quit: AtomicIRC: The nuclear option.]
<TheGillies> not sure if you mean malware or if mailware is actually a thing
<TheGillies> i mean it sounds legit
bjz has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 246 seconds]
Ven has joined #crystal-lang
Ven has quit [Client Quit]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
_whitelogger has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter> <bigDaddyS1oth> hey peeps, did radix get deprecated? Or something funky happening to it? I can't do a complete `shards install` because it tosses up this error once it tries to install radix: `git command failed: git ls-tree -r --full-tree --name-only -- shard.yml (). Maybe a commit, branch or file doesn't exist? ⏎ `
<FromGitter> <johnjansen> take a look in kemal https://github.com/kemalcr/kemal/blob/master/shard.yml check the V etc
<FromGitter> <dummied> Evening. This is my second time playing around with crystal, and I'm running into a bit of trouble I can't seem to square on my own. I'm attempting to connect to a sqlite database using an absolute path. I've confirmed that the path to the file (as the string I'm passing into `DB.open`) works when thrown into the command line `sqlite3`, but crystal gives me a consistent "Connection Refused". Any tips/pointers?
<FromGitter> <drujensen> Hi Chris. What URL are u using? sqlite3://absolute-path
<FromGitter> <dummied> sqlite3:///Users/chrisvannoy/Library/Group\ Containers/UBF8T346G9.Office/Outlook/Outlook\ 15\ Profiles/Main\ Profile/Data/Outlook.sqlite
<FromGitter> <drujensen> Try taking the two slashes out
<FromGitter> <drujensen> sqlite3:/Users...
<FromGitter> <dummied> That did it. Thanks!
<FromGitter> <drujensen> Good to hear!
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
whomp has joined #crystal-lang
<whomp> hi, in this code, https://gist.github.com/anonymous/cd9122225f5511def01a3351976232f3, i get the error "Error in prog.rb:5: can't use Set(T) as a generic type argument yet, use a more specific type"
<whomp> any ideas how to fix this?
<whomp> got it now!
<FromGitter> <drujensen> :+1:
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
_whitelogger has joined #crystal-lang
whomp has quit [Ping timeout: 260 seconds]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 272 seconds]
<crystal-gh> [crystal] akzhan opened pull request #4434: Documentation for OpenSSL::HMAC class. (master...doc-openssl/hmac.cr) https://git.io/vHJ6K
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
<crystal-gh> [crystal] akzhan opened pull request #4435: Extract OpenSSL::Error to separate source file, document it (master...extract-openssl-error-and-reorder-openssl-requires) https://git.io/vHJPV
whomp has joined #crystal-lang
whomp has quit [Ping timeout: 255 seconds]
bjz has quit [Ping timeout: 272 seconds]
bjz has joined #crystal-lang
TheLemonMan has joined #crystal-lang
<TheGillies> Is there a way to do foo = "bar" and then somehow pass foo to a macro but in "bar" form?
<Papierkorb> ?
<Papierkorb> TheGillies: what do you want to do?
<oprypin> TheGillies, https://carc.in/#/r/21w0
<oprypin> in short, use `resolve` on the passed constant
<TheGillies> ok so it's a little more complicated. Im parsing a struture from a file into a var and I want to use that structure in a macro
<TheGillies> so like foo = YAML.parse_file(config) and then use foo in macro with {% for k,v in foo %}
<Papierkorb> That's obviously not possible
<oprypin> TheGillies, well you literally can't. you're parsing the file at runtime. macros are done before all of that - at compile time
<Papierkorb> Macros are not time machines
<oprypin> aaand what Papierkorb said
<TheGillies> But hte file exists at compile time
<TheGillies> it there a way to read file at compile time?
<RX14> it would be possible if the macro language exposed a yaml parser
<Papierkorb> The code isn't executed at compile time
<RX14> but it doesn't
<oprypin> ok if you can parse it using compiletime constructs only then it's doable
<RX14> i'd suggest using run() for something like this
<oprypin> or you can use https://crystal-lang.org/api/0.22.0/Crystal/Macros.html#run%28filename%2C%2Aargs%29%3AMacroId-instance-method
<Papierkorb> TheGillies: Write a program which reads it and writes the code to stdout, then use `{{ exec "foo.cr" }}` or the like
<RX14> TheGillies, what exactly do you want to generate from the yaml
<TheGillies> So compile time constructs are different than runtime? I thought compile time stuff ran just like runtime stuff, obviously I have no idea what I'm talking about heh
<oprypin> yes
<TheGillies> RX14: It's a mapping of routes to handlers
<RX14> they're entirely seperate languages
<RX14> unfortunately
<TheGillies> Im used to elixir macros where you can do this sort of thing :(
<TheGillies> but I guess they have a VM so they're cheating
<FromGitter> <akzhan> It’s statically typed language with code compiled before execution.
<FromGitter> <akzhan> Of course we can - load dinamically created/compiled code
<TheGillies> >NOTE the compiler is allowed to cache the executable generated for filename and only recompile it if any of the files it depends on changes (their modified time). This is why it's strongly discouraged to use a program for #run that changes in subsequent compilations
<TheGillies> So not a good idea for something that reads config file
<RX14> uhh
<Papierkorb> Use macros instead to describe routes
<RX14> no i think it's just the executable that's cached
<RX14> not running it
<RX14> i'm not sure
<RX14> otherwise how would ecr work
<RX14> that depends on a template file which is passed as an arg to run
<oprypin> yeah it's fine
<RX14> and changing the icr file works just fine
<oprypin> if the dependent program would read the config file at its compile time it would not be updated
Ven has joined #crystal-lang
<oprypin> but dependent program's runtime operations can be anything - and its runtime output becomes the main program's compiletime result
Ven is now known as Guest55917
<FromGitter> <akzhan> constants can be used easily: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=59201cac00efc2bb3e87c15e]
<oprypin> i've already shown this
<FromGitter> <akzhan> Thanks, i was played your code and simply show another case )
<oprypin> ok
Guest55917 has quit [Ping timeout: 260 seconds]
<TheGillies> Is there a way to get result of `run` into a literal so I can use in a macro for loop?
Ven_ has joined #crystal-lang
<oprypin> probably not
<oprypin> TheGillies, best you can do is like https://crystal-lang.org/api/0.22.0/Crystal/Macros/MacroId.html#lines%3ACrystal%3A%3AMacros%3A%3AArrayLiteral%28StringLiteral%29-instance-method
Ven_ has quit [Ping timeout: 246 seconds]
Ven_ has joined #crystal-lang
<RX14> Papierkorb, wording these SHA1/MD5 warnings is pretty hard, "password checks" is a bit vague, and md5/sha1 shouldn't be used in password hashing anyway so i'm not sure what to put
<Papierkorb> > shouldn't be used in password hashing anyway
<RX14> well i mean even sha256
<Papierkorb> That's why we need to tell them not to
<RX14> script/bcrypt should be used
<Papierkorb> Because people still think that it's okay to use SHA-1.
<Papierkorb> Or that they "just need to add a few rounds"
<RX14> but sha256 is still secure, doesn't mean it should be used for password hashing
<Papierkorb> You may know that, but others don't
<Papierkorb> The wording is hard to get right of course
<FromGitter> <akzhan> Thanks, @oprypin just write another example (1.cr for example): ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5920217392217cca5895d963]
<RX14> for sure the note's fine but it feels like we should be more generic
Ven_ has quit [Ping timeout: 268 seconds]
<Papierkorb> RX14: I think both is necessary. This is kinda a security reminder, and as we can't force people to not do security related things if they have no idea, we need to lend them a hand and show them in general and for specific use-cases, what's a bad idea
<Papierkorb> Maybe something like "This algorithm is not intended to be used to secure access to resources, like user passwords."
Ven_ has joined #crystal-lang
<Papierkorb> Ideally, with a mention of bcrypt or scrypt, if any of those two is in the stdlib
<RX14> bcrypt is in
<RX14> Crypto::Bcrypt::Password is great
<Papierkorb> Then append "See `Crypto::Bcrypt::Password` for this use-case"
<TheGillies> Anyone know where "resolve" is located?
<TheGillies> in docs
<TheGillies> Thanks
<RX14> Papierkorb, i generally dislike the crypto layout in the stdlib anyway
<Papierkorb> RX14: Yeah it needs another look at, the whole `Crypto` module is a mess right now
<RX14> there's the "openssl" module which should be replaced by generic APIs which multiple providers can implement
<Papierkorb> And that
<RX14> and then there's crypto/digest
<RX14> and yeah
<RX14> it's a mess
Ven_ has quit [Ping timeout: 246 seconds]
<Papierkorb> The Digest stuff imho is in a at least better shape than it was before my PR. Should be added a ton of other algorithms though.
<RX14> yeah
f-mer has joined #crystal-lang
<RX14> the digest/crypto modules should probably use openssl if it's available
<RX14> and fall back to crystal
<Papierkorb> Fallbacks are hard
<RX14> yeah
<TheGillies> I just use libsodium c bindings heh
<Papierkorb> I'd prefer everything in Crystal code. otherwise, the crystal code is poorly tested and breaks
<RX14> and i'd :nodoc: the whole of OpenSSL
<FromGitter> <akzhan> Crystal is highly depends on openssl afaik
<RX14> Papierkorb, well it should be possible
Ven_ has joined #crystal-lang
<RX14> have a crypto.cr which uses pkgconfig to test for openssl
<RX14> and then require dependently
<RX14> in macros ofc
<RX14> have subfolders for the openssl, libsodium and crystal impls
<Papierkorb> I don't see much wrong with crystal implementations
<RX14> timing attacks
<RX14> the "proper" impls are typically written in assmebly
<RX14> to avoid timing attacks via optimizations
<RX14> and for performance
<RX14> it's hard to avoid timing attacks *in assembly*
<RX14> let alone in crystal which is very removed
<Papierkorb> Sure timing attacks, but I'm not sure if those are applicable to common uses... if not used for password stuff.
<RX14> but they should be secure from timing attacks by default
<FromGitter> <akzhan> Just reviewed and OpenSSL is required stuff for HTTP::(Server|Client)
<RX14> because how are users supposted to know?
<f-mer> Hello. Having a question regarding blocks and constructors. Is this the right place to ask?
<RX14> @akzhan you can pass -Dwithout_openssl to not use openssl with the http stuff
<Papierkorb> f-mer: sure go ahead
<FromGitter> <akzhan> So I agree witg generic classed but dislike any fallbacks because OpenSSL is required).
<f-mer> This is the snippet. Shouldn't this work?
<Papierkorb> FromGitter: You can't mix `&block` arguments with `yield`. Remove the argument and try again
<FromGitter> Papierkorb, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/crystal-lang/crystal
<Papierkorb> f-mer: : You can't mix `&block` arguments with `yield`. Remove the argument and try again
<RX14> Papierkorb, uhh
<RX14> that doesn't work either
<f-mer> ype
<f-mer> yep*
<RX14> that's weird
<FromGitter> <akzhan> @RX14 thanks for the point. OK
<f-mer> it seems lik yielding inside the constructor breaks
<RX14> and yes, &block arguments work just fine with blocks via yield
<RX14> Papierkorb, maybe we should just statically link libsodium or the likes
<f-mer> Passing yield to an instance method after initialization works. Is this a bug, should i open an issue?
<Papierkorb> As long it's pluggable, I don't mind much which lib is used in the end RX14
<Papierkorb> f-mer: That is a bug
<RX14> basically it breaks if you add `with self`
<RX14> which is weird
<TheGillies> just realized I can set routes in kemal at runtime
<RX14> yup
<RX14> it uses a radix tree for routing
<TheGillies> well f me, that makes things easier
<RX14> this is the shard kemal uses
<RX14> it's pretty generidc
<RX14> (although i'm not convinced about the speed of the lookup)
<RX14> it seems like a *lot* of code
<FromGitter> <akzhan> Regex lookup should be 3 times slower than radix tree. But it’s not tested by me
<RX14> regex look up should be way slower than 3 times
Ven_ has quit [Ping timeout: 268 seconds]
<RX14> well, with pcre at least
Ven_ has joined #crystal-lang
<FromGitter> <akzhan> Btw, I want to test replace libpcre with irregex - but it’s not one day task.
<RX14> i'd rather offer pcre or https://github.com/google/re2
<RX14> re2 is fast and pcre is featureful
<RX14> not sure where irregex would fit in but we'd need to have a way of choosing the regex type
Ven_ has quit [Ping timeout: 240 seconds]
<f-mer> Thanks for your help! Have a good day!
<RX14> f-mer, no problem
<TheGillies> ugh back to square one, kemal uses "render" which is a macro
<RX14> yup
<TheGillies> seems like you shouldn't need a macro unless arg needs to be processed raw
<RX14> you can't use ecr without using macros
<TheGillies> but arg is just a sstring
<TheGillies> RX14: Im just looking that up now
<RX14> ecr is a compile time thing
<RX14> you could use other templating engines
<TheGillies> ah
<TheGillies> so ecr needs macros ok
<RX14> but if you want ecr you need to know all the templates at compile time
<TheGillies> makes sense
<RX14> as it's a compiled template
<TheGillies> right. I mean I know them, there just are methods for me to easily use them how I want to :P
<TheGillies> just aren't*
<RX14> what are you trying to do?
<TheGillies> RX14: essentially https://play.crystal-lang.org/#/r/21wo
<RX14> but why
<RX14> why toml and not configure this in crystal
<TheGillies> because it's for not crystal programmers
<TheGillies> it's just a binary that takes a config file and maps it to another binary
<TheGillies> That's the end goal anyway
<TheGillies> like "/foo" could run the foo binary
<oprypin> TheGillies, uhhhh parse toml and put it into a crystal source file and then use the config as a compile time construct ¯\_(ツ)_/¯
<TheGillies> oprypin: That's what i've been trying to do. I need to iterate over the construct though, only macro interation method i know is "for" and it wants a literal
<oprypin> TheGillies, i mean as in 1. run a program that reads config.toml and writes it into a file config.cr CONFIG = { ... }
<oprypin> 2. compile the actual program that has require "config" and uses CONFIG
<TheGillies> oh and just require file the?
<TheGillies> the file
f-mer has quit [Ping timeout: 260 seconds]
<TheGillies> I swear I'm dyslexic
<RX14> that's what the run macro does, runs a normal crystal program at compile time and interprets it's stdout as crystal code
<oprypin> RX14 , oooh i get it now
<RX14> so just have a crystal file which parses the toml and emits the kemal routes
<RX14> oprypin, you didn't understand the run macro?
<oprypin> {{run("toml_parser.cr")}} assuming toml_parser.cr writes a crystal data structure to stdout would achieve the same effect as that require
<oprypin> RX14, no i was just like "welp it returns a string, what now"
<RX14> lol
<TheGillies> It's not a string it's actual crystal code
<TheGillies> heh
<RX14> sure run() returns a string
<RX14> a macro string
<RX14> which is pased using {{}}
<TheGillies> Ah
<TheGillies> got it
<TheGillies> Thats what I meant, but I didn't know how to say it
<RX14> you can use run() and then use .stringify on it
<RX14> and then do whatever with the string
<RX14> but by default it returns the code as a macroid
<RX14> which is pasted as crystal code like a normal macro
splitty__ has joined #crystal-lang
splitty_ has joined #crystal-lang
splitty___ has quit [Ping timeout: 246 seconds]
splitty__ has quit [Ping timeout: 268 seconds]
<oprypin> any neat way to do uhhh reject_with_index! other than manually incrementing?
<oprypin> in fact i dont even need the item, i literally determine whether the item stays only by its index
Ven has joined #crystal-lang
Ven is now known as Guest16010
<TheGillies> victory is mine
<TheGillies> [tyler@tyler-pc spreedemo]$ curl localhost:3000?FOO=moooo
<TheGillies> This is a bash script. FOO is equal to moooo
<oprypin> the worst part about the incrementing is that it's the last operation in the block so i also have to keep around the boolean
<TheGillies> reads route from config.toml and then executes binary with params as env variables
<oprypin> yay
<TheGillies> the unix webserver
<TheGillies> heh
<RX14> oprypin, surely you can use upto/downto/range so you don't use while
<oprypin> RX14, that is still tricky because then all the indices shift while i delete
<RX14> oh you're doing it in-place
<oprypin> python `arr = [x for x, i in enumerate(arr) if random(len(arr)) >= i]`
<RX14> you could just use reject! and keep the index
<RX14> oprypin, but that's not in-place
<RX14> doing it out of place is easy
<oprypin> makes no difference to me
<oprypin> i dont mind
<RX14> isn't that what we discussed yesterday?
<oprypin> no way
<oprypin> crystal `i = 0; arr.reject! { cond = (rand(arr.size) < i); i += 1; cond }`
<oprypin> hah funny that this crstal code is actually shorter xD even though it's not a one liner
<RX14> i = 0; arr.reject! { (rand(arr.size) < i).tap { i += 1 } }
<RX14> is shorther
<RX14> but maybe not as clean
<oprypin> O_o
<oprypin> yeah i never really learned when tap is appropriate
<RX14> tap is "execute this block but return the reciever always"
<RX14> and it also get the reciever as a parameter
<oprypin> cool
<RX14> so "foo".tap { |f| "bar" }
<RX14> returns foo and f is foo
<RX14> it's useful for debug in the middle of expressions, adding a mutation at the end of an expression without saving it in a variable
<RX14> etc
<RX14> if you want look around the stdlib
<RX14> it's got some neat usages
whomp has joined #crystal-lang
Guest16010 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
whomp has quit [Ping timeout: 260 seconds]
<FromGitter> <akzhan> btw a month ago was 0.22.0 release. just time to release update.
<FromGitter> <akzhan> 1) 22.1?)
<FromGitter> <akzhan> there a some long standing bugs fixed.
<RX14> an 0.22.1 will probably be released sometime soon but thats up to the core team
<RX14> there's some breaking changes
Qchmqs__ has joined #crystal-lang
<oprypin> RX14, any chance of eliminating one of them? :|
Qchmqs__ is now known as Qchmqs
<FromGitter> <akzhan> 😱
<RX14> oprypin, yeah it's on my todo list...
<RX14> also it'd still be a breaking change
<RX14> just reduced in scope
Ven has joined #crystal-lang
Qchmqs__ has joined #crystal-lang
Ven is now known as Guest87036
Qchmqs has quit [Ping timeout: 240 seconds]
<TheGillies> Is there a way to capture errors that happen with ``?
<FromGitter> <luislavena> @TheGillies error codes? you can use `$?` to capture the process status details (exit code)
<FromGitter> <luislavena> if you want to capture the error vs the standard out, then you need to use `Process` instead.
<FromGitter> <luislavena> https://crystal-lang.org/api/0.22.0/toplevel.html#%60%28command%29%3AString-class-method
<FromGitter> <luislavena> and
<TheGillies> ah `$?` will work, thanks
<FromGitter> <luislavena> https://crystal-lang.org/api/0.22.0/Process.html#run%28command%3AString%2Cargs%3Dnil%2Cenv%3AEnv%3Dnil%2Cclear_env%3ABool%3Dfalse%2Cshell%3ABool%3Dfalse%2Cinput%3AStdio%3Dfalse%2Coutput%3AStdio%3Dfalse%2Cerror%3AStdio%3Dfalse%2Cchdir%3AString%3F%3Dnil%29%3AProcess%3A%3AStatus-class-method
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 246 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
<TheGillies> hrrmmm
<TheGillies> Process.run outputs curl output to error even if there's no error
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vHJxe
<crystal-gh> crystal/master 3109923 Ary Borenszweig: Fixed #4437: Uknown key in access token json: id_token
<oprypin> TheGillies, it does not mean an error happened. stderr is often used as "secondary output" for any diagnostic messages
<oprypin> curl puts the actual data you downloaded into stdout so it has to put everything else into stderr
<RX14> Papierkorb, I pushed a new warning with some recommendations
<oprypin> look who made a commit :)
<RX14> oh, no I didn't
<RX14> oprypin, yeah I saw
<RX14> I wish jenkins' terminal wasn't terrible and worked like circleci's
Qchmqs__ has quit [Quit: Konversation terminated!]
<oprypin> welp ported my program to ruby for the sake of it, it's hella slow as expected
<oprypin> 3.666s vs 1m49.591s wow
<RX14> what does it do oprypin?
<oprypin> genetic algorithm for generating a timetable
Guest87036 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snsei has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cyberarm_ has quit [Ping timeout: 260 seconds]
cyberarm has joined #crystal-lang
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vHUf0
<crystal-gh> crystal/master 6b1067a RX14: Add | as a string delimiter
cyberarm has quit [Ping timeout: 268 seconds]
A124 has quit [Ping timeout: 255 seconds]
cyberarm has joined #crystal-lang
A124 has joined #crystal-lang
cyberarm has quit [Ping timeout: 240 seconds]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vHUJM
<crystal-gh> crystal/master 6dffcff Ary Borenszweig: Fixed #236: macro lookup conflicts with method lookup when including into toplevel
<RX14> yay asterite's back
<crystal-gh> [crystal] asterite closed pull request #4430: Add new `?~` (boolean `=~`) operator. (master...boolean-equal-tilde-operator) https://git.io/vHvDb
<crystal-gh> [crystal] asterite closed pull request #4422: Add .editorconfig template on crystal init command. (master...add-editorconfig-on-crystal-init) https://git.io/v9xkS
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vHUUu
<crystal-gh> crystal/master b2def93 Jonne Haß: Fix IO::Memory#gets_to_end to consume the IO
tilpner has quit [Quit: :wq]
<FromGitter> <fridgerator> Working on crystal again?
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <jwoertink> nice! Just saw that
<crystal-gh> [crystal] asterite reopened pull request #4422: Add .editorconfig template on crystal init command. (master...add-editorconfig-on-crystal-init) https://git.io/v9xkS
<FromGitter> <jwoertink> Has anyone built a babel crystal binding?
<FromGitter> <jwoertink> pretty sure this isn't what I'm looking for http://everquest.allakhazam.com/db/item.html?item=79458 :smile:
<RX14> lol
<FromGitter> <jwoertink> yeah, that thing
<RX14> why would it need crystal bindings?
<RX14> how would you even bind it, it's in JS?
<RX14> just looks like you should incorporate it in your makefile
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<FromGitter> <jwoertink> well, maybe not "binding", but more like what this gem does https://github.com/babel/ruby-babel-transpiler
<FromGitter> <jwoertink> I saw there's ductape.cr which can read javascript
<FromGitter> <jwoertink> so I guess that could be used to do the transpiling
<FromGitter> <jwoertink> I'm just curious if anyone has already done that work or not
<RX14> looks unlikely
<FromGitter> <jwoertink> Yeah, I didn't see anything looking around. Right now fez has ruby as a dependency just for the sake of that gem, and the sass one.
<RX14> I don't get why you wouldn't just use babel directly myself
<RX14> not everything has to have a DSL in your favourite language
<FromGitter> <jwoertink> agreed. Using babel directly would either require it to be included in your web app (which I don't like), or have node as a dependency
<RX14> if it's for programatic usage sure but for web frameworks they should just use something like webpack on the commandline
<FromGitter> <jwoertink> which would defeat the purpose of getting rid of ruby
<RX14> don't you need node to run it anyway?
<FromGitter> <jwoertink> no
<FromGitter> <jwoertink> I don't have node installed
<FromGitter> <jwoertink> I actually haven't used webpack yet. Maybe I can just start looking in to that route since it seems to be getting more popular
<FromGitter> <jwoertink> guess it's time to install node!
<RX14> i havent actually used webpack directly
<RX14> i found a tool called vbuild which appeals to me a lot more as an opinionated tool with sane defaults
<RX14> built on top of webpack
<RX14> aand it's changed name?
<FromGitter> <jwoertink> oh? Haven't heard of that either. Damn, I'm out of the loop
<RX14> yeah it's not much used I think
<RX14> it's called this now
<RX14> i guess it transcended being a vue specific tool so it got renamed poi? idk
<FromGitter> <jwoertink> oh ok. Thanks for the link!
<FromGitter> <akzhan> Node/tsnode is root of frontend technologies de facto. Webpack - kind of something strange deal with assorti of good and bad javascript practices. Anyway it has no alternative yet.
snsei has quit [Remote host closed the connection]
<RX14> and the poi docs are broken because some random cdn's down...
pduncan has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
pduncan has quit [Ping timeout: 258 seconds]
<Papierkorb> RX14: But CDNs don't go down (scnr)
<RX14> heh
<RX14> I've been kicked off a CDN
<FromGitter> <bew> How?
<crystal-gh> [crystal] asterite reopened pull request #4430: Add new `?~` (boolean `=~`) operator. (master...boolean-equal-tilde-operator) https://git.io/vHvDb
<RX14> it's as if people think that if they open enough issues for some sort of non-global namespacing it will happen
guest has joined #crystal-lang
guest has quit [Client Quit]
<FromGitter> <bew> Why https://github.com/crystal-lang/crystal/issues/4436#issuecomment-302881945 doesn't go into infinite loop of calls to `self.new`?
<RX14> because the overidden new requires a block
<RX14> no block is given on the new used
<FromGitter> <bew> Oohh... And I lost 10mins of my life... Thx!
yogg-saron has joined #crystal-lang
<FromGitter> <bigDaddyS1oth> ^That'll happen a lot in programming.
<FromGitter> <bew> Ahah yeah I know, but I ran into this specific problem myself a lot of times already (with block, without block), but can't get used to it... In a few decades maybe! ^^
<oprypin> i think things would be better if it required an explicit signature
<oprypin> `def foo(bar, &)` like `def foo(bar, &block)` but you dont care about referencing it
<FromGitter> <bew> Thats a nice idea, but I'm not sure asterite will agree with that
<FromGitter> <bew> Eg. `def foo` (without block), `def foo(&)`(with block), the necessity to add parentheses only for that is not optimal imo
<FromGitter> <bew> Especially when the method with block is a few line long
<oprypin> i think parentheses should be necessary anyway
<oprypin> should be required, that is
<RX14> why? it's ugly
<RX14> and not neccesary
<RX14> "properties" being functions, having exactly the same syntax is one of the things I like most about ruby
<oprypin> it's not necessary to make an exception for that case
<oprypin> i'm not talking about calls.
<RX14> def foo() is an error in crystal iirc
<RX14> and I like that
<oprypin> >> def foo(); 5; end
<DeBot> oprypin: #=> nil - https://carc.in/#/r/21xg
<oprypin> no it certainly isn't
<RX14> oh, i must be mistaken
<oprypin> >> def foo a; 5; end
<DeBot> oprypin: Syntax error in eval:17: unexpected token: a (parentheses are mandatory for def arguments) - https://carc.in/#/r/21xi
<RX14> oh yeah that was what it was
<RX14> sorry
<oprypin> parentheses are mandatory, .. oh except for that one case
<oprypin> just arbitrary
<RX14> it's not arbitrary
<RX14> when the 1 case is when they're empty
<RX14> it's unneccesary visual noise when reading code
<RX14> one of the things that ruby got very very right is making code as easy to read as possible with very few noisy symbols
<oprypin> got it right in a few specific places but not generally
<RX14> I disagree, I like ruby's syntax a lot
<oprypin> I want to measure the time my program takes to run, I don't care about these user/sys/whatever things, just want a number, what should i use?
<RX14> still use time
<RX14> just check real time
<RX14> ignore the user/sys ones
<RX14> other than that i don't know
<oprypin> ok I want to automate this because i want to optimize for time by tweaking a constant
<RX14> make a crystal script?
<oprypin> crystal script that parses the output of `time` or what
<RX14> no just executes the program and collects t1 and t2
<FromGitter> <akzhan> Btw, what is recommended to build flame graphs of code profile?
<RX14> there's scripts to parse perf output as a framegraph
<RX14> if you're on osx I have no idea
<oprypin> mmm good stuff https://crystal-lang.org/api/0.20.0/Benchmark.html#realtime%28%26block%29%3ATime%3A%3ASpan-instance-method
<FromGitter> <akzhan> Yes, i’m on macos.
<RX14> @akzhan see https://schani.wordpress.com/2012/11/16/flame-graphs-for-instruments/ which uses the script here https://github.com/brendangregg/FlameGraph and instruments "just work" on a crystal binary.
<RX14> you should use --release --debug as crystal compile flags though
<RX14> so you get optimizations *and* debug info
<FromGitter> <akzhan> Thanks @RX14
<oprypin> that's a new one
<RX14> oprypin, which?
<RX14> instruments?
tilpner has joined #crystal-lang
<oprypin> --release --debug
<RX14> is it?
<oprypin> i mean it sounds crazy
<RX14> it doesn't really. release/no release is optimization level, all --debug has ever done has emit debug info or not which is orthogonal
yogg-saron has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <bigDaddyS1oth> Hey fellas I'm still getting an issue with radix on `shards install`. `git command failed: git ls-tree -r --full-tree --name-only -- shard.yml (). Maybe a commit, branch or file doesn't exist?`
<FromGitter> <bigDaddyS1oth> I've changed to `branch: master` `version: ~> 0.3.8` and `commit: [the current commit]`
<oprypin> bigDaddyS1oth, do you get any output from that git command? try to run it manually
<FromGitter> <bigDaddyS1oth> `fatal: Not a git repository (or any parent up to mount point /) ⏎ Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).`
<oprypin> ehhhh can you run it in any git repository that contains shard.yml?
<oprypin> honestly i have no idea, just testing the fringe theory that your git version is too old
<FromGitter> <bigDaddyS1oth> I'll pick one of the shard folders in the `/lib` folder
<FromGitter> <bigDaddyS1oth> nnnnnope same output
<oprypin> those are not git repositories
<FromGitter> <bigDaddyS1oth> damn uh...now I gotta recall where I've ran `git init`
<FromGitter> <fridgerator> possible to rescue from undefined method?
<oprypin> fridgerator, it is a compile time error
<FromGitter> <fridgerator> oh right
<oprypin> no exception is happening, nothing to rescue
<oprypin> fridgerator, you can try if thing.responds_to? :method_name
<FromGitter> <fridgerator> yep, thats what i'm looking for
<FromGitter> <fridgerator> I tried it already, but forgot the `?`
<oprypin> and feel free to share the actual use case. this is really rarely needed.
whomp has joined #crystal-lang
<FromGitter> <fridgerator> I'm writing an extension for Crecto, I need to see if a method is defined on a user defined class
<FromGitter> <fridgerator> else I will provide a default
<FromGitter> <fridgerator> but I don't want to add the default to crecto, because its not needed if the extension library is not used
<oprypin> doesnt tell me much. nevermind.
<FromGitter> <bigDaddyS1oth> @oprypin I think it's because that particular shard.yml file is in a folder I created just to have a bunch of shards to look at the source code if I ever decide to get more into that
<oprypin> bigDaddyS1oth, just git clone them, that's better anyway
<oprypin> what can be easier than copying an url from the address bar and doing git clone
<FromGitter> <bigDaddyS1oth> @oprypin yea it makes more sense that way once I think about it...
<FromGitter> <bigDaddyS1oth> I can run `shards install` in any of the shards in the `../lib` folder, just not the directory I created where the `.shards` `lib`are.
<oprypin> uhhh this sounds weird
<FromGitter> <bigDaddyS1oth> exactly
<FromGitter> <bigDaddyS1oth> I'll just `git clone` them. Easier than whatever I'm attempting to do
tilpner has quit [Quit: :wq]
tilpner has joined #crystal-lang
zipR4ND has joined #crystal-lang
zipR4ND1 has quit [Ping timeout: 240 seconds]
whomp has quit [Ping timeout: 260 seconds]
whomp has joined #crystal-lang
bjz has joined #crystal-lang
<whomp> hi, i'm getting the following issue: https://gist.github.com/anonymous/eb24dae2327749e23558ee7555b377a2
<whomp> i looked at https://github.com/crystal-lang/crystal/issues/3063 and tried `brew unlink pcre && brew link pcre`, but no dice
<FromGitter> <carsonbaker> can you upgrade your libiconv?
<FromGitter> <carsonbaker> your issue isn't related to pcre as far as I can tell. try re-installing iconv.
<whomp> i'm at libiconv 1.15, although homebrew tells it doesn't want to symlink it because os x already provides a version
<whomp> i did `brew install libiconv`
<TheGillies> Kinda odd https://pastebin.com/WC8XJinZ
<TheGillies> Doesn't even touch my code
<FromGitter> <carsonbaker> @thegillies can you paste your code?
<FromGitter> <carsonbaker> @whomp your path prefix of /opt/local/... makes me think you're using macports, not homebrew. do you have both installed, or something?
<oprypin> lol
<TheGillies> my crystal app is #1 on https://lobste.rs/ woo
<TheGillies> all 10 lines of it heh
<oprypin> TheGillies, well the error is obviously on the line date = Time.parse(date_content, "%FT%X%z")
<TheGillies> oprypin: Are you being facetious? heh
<oprypin> TheGillies, ?
<TheGillies> the error in /usr/lib/crystal/concurrent/future.cr doesn't look like an obvious time parsing error to me
<oprypin> TheGillies, it just propagates through that
<oprypin> i know by know that crystal's stack traces may as well not be there
<FromGitter> <carsonbaker> @thegillies the first line of your error says it all: "Expecting number (Time::Format::Error)".
<TheGillies> Ah makes sense now in hindsight
<FromGitter> <carsonbaker> just because the backtrace doesn't list your code, doesn't mean your code isn't at fault / executing.
<TheGillies> I thought it as an interal error with concurrency and timing
<FromGitter> <carsonbaker> there's more than one call stack here.
<TheGillies> was an*
<TheGillies> I didn't realize it was failing to parse my time
<TheGillies> Makes sense in hindsight but it's a bit of a red herring heh
<FromGitter> <carsonbaker> ya
<whomp> FromGitter, yeah, i'll try uninstalling all macports stuff
<FromGitter> whomp, I'm a bot, *bleep, bloop*. I relay messages between here and https://gitter.im/crystal-lang/crystal
<whomp> feels so good
<FromGitter> <fridgerator> is it possible to render another ecr template file from within an ecr template file? like a partial?
<oprypin> fridgerator, at the very least you can insert results of rendering one template into another template
<whomp> works now, thanks carsonbaker~
<whomp> *!
<FromGitter> <carsonbaker> cool deal
Ven has joined #crystal-lang
Ven is now known as Guest81488
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter> <elorest> What is the convention involving hyphens vs underscores for file names. In ruby at least for the first long time it was underscores but I’m seeing a ton of hyphens in crystal projects.
<TheGillies> I was just wondering the same thing today
<Papierkorb> file names? underscores
<TheGillies> oops wrong chan
<FromGitter> <elorest> I would think so because i think it looks way cleaner. But many things in crystal use hyphens including crystal-db, crystal-mysql, etc.
<FromGitter> <elorest> Hmmm. I hope so but I’m seeing a lot of hyphens.
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 246 seconds]