<FromGitter>
<j8r> @ArchaicLord I'm devops. I can recommend to have a little remote linux server like a Raspberry or in the Cloud. I'm developing in Crystal because of high level, good perf, and easy to ship (single binary)
<FromGitter>
<j8r> In your linux box try t
<FromGitter>
<j8r> put applications that people (you, familly, friends) will use :)
<FromGitter>
<j8r> @ArchaicLord By learning Crystal I've increased my dev skills, and even had a Ruby job offer. If you have public Crystal projects to present, you can too. This also helps for devops tools that use Ruby, and even Python ones
<FromGitter>
<ArchaicLord> @j8r cool. I was on a road map to learn vim and python. I was looking at zsh and terninaks. Came across alacrity. Asked a question there and was encouraged to look at rust. A week later I came across this and just keep getting side tracked.
<FromGitter>
<ArchaicLord> Ruby isn't something I have been interested in but python is for sure.
<FromGitter>
<Blacksmoke16> updating the error message generation on my validation lib
<FromGitter>
<Blacksmoke16> old: `'name' has failed the equal_to_assertion`
<FromGitter>
<Blacksmoke16> new: `'name' should be equal to John`
<FromGitter>
<Blacksmoke16> 🚀
<FromGitter>
<Blacksmoke16> can also override the message using placeholder values, so like `Expected {{field}} to equal {{value}} but got {{actual}}` would display as `Expected name to equal John but got foo`
<FromGitter>
<Aaron-Fleisher> Hi!
<FromGitter>
<Blacksmoke16> o/
<FromGitter>
<Aaron-Fleisher> I am converting my old C++ tcp server, and it's been going great so far. I don't want to go back. This language is awesome, just wanted to share!
<FromGitter>
<Blacksmoke16> 💯
<FromGitter>
<Aaron-Fleisher> What are you all working on / doing with crystal lang? :)
<FromGitter>
<proyb6> @hello2dj nodeja use multicore, while Crystal ran one core, you can spawn process or run in cluster, Crystal could be as fast as Golang fast HTTP
<FromGitter>
<proyb6> That because they were affected by database max pool, that drag down score
<FromGitter>
<hello2dj> yes i love crystal, i want use it replace node in production, but ....
<FromGitter>
<proyb6> The issue was rectify by lower max connection pool to 8 from 256
<FromGitter>
<proyb6> Its depend on your use case
<FromGitter>
<hello2dj> thank you
<FromGitter>
<Blacksmoke16> also understand node is a lot more mature of a lang, crystal isnt 1.0.0 yet so is time for improvement changes etc
<FromGitter>
<Blacksmoke16> but will come down to does it matter if it can handle 8k more requests per sec based on what your prod env is like?
<FromGitter>
<Blacksmoke16> i.e. in benchmark it might be lower but in real world how does it compare
<FromGitter>
<hello2dj> yeah it maybe need more time for crystal
<FromGitter>
<diegogub_gitlab> @hello2dj I replaced a Golang http service (redirect system) with crystal and it's working like a charm. plus , I have macros, templates , classes, generics, etc
<FromGitter>
<hello2dj> go is easy to newbie but it also has many other questions, By comparison i like crystal, but it is not 1.0.0
<FromGitter>
<hello2dj> so sad
<FromGitter>
<Blacksmoke16> not really a big deal imo, just means you'll have to keep an eye on breaking changes
<FromGitter>
<Blacksmoke16> depending on your project at least...
<FromGitter>
<proyb6> At this time, you have plenty of time to learn Crystal and internal implementation
<FromGitter>
<proyb6> H
<FromGitter>
<proyb6> What 1.p
<FromGitter>
<proyb6> Sorry, for garbage text haha
gangstacat has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter>
<hello2dj> you are right
rohitpaulk has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
akaiiro has quit [Remote host closed the connection]
<FromGitter>
<proyb6> And present us with cool shards, presentation or anything, it's your chance to create a new opportunity in what you have learn from the past and other side
OvermindDL1 has quit [Ping timeout: 250 seconds]
wmoxam has quit [Ping timeout: 276 seconds]
wmoxam has joined #crystal-lang
<FromGitter>
<Blacksmoke16> looks like i broke the spec lib
<FromGitter>
<Blacksmoke16> ``````
<FromGitter>
<Blacksmoke16> ^.^
thews has quit [Ping timeout: 240 seconds]
thews has joined #crystal-lang
<FromGitter>
<schoening> Could someone explain to this newbie what is going on here? How come a variable does not have to be passed into the function to be accessible inside the template :o ?
<FromGitter>
<anamba> render is a macro, so basically the content of the template is being dumped right into that method
<FromGitter>
<schoening> Ok, thanks :)
<FromGitter>
<schoening> I can't decide if I find this very neat or worrying :D haha, it certainly is a very different approach to other languages. Would a experienced crystal/ruby programmer have seen at a glance that this is a macro doing its thing?
<FromGitter>
<anamba> ruby doesn't have anything like that so it was new to me (i'm coming to crystal after 13 years of ruby)
<FromGitter>
<schoening> Oh ok
<FromGitter>
<anamba> macros are amazing but take some getting used to
<FromGitter>
<schoening> I guess its all about if you like explicit or implicit kind of code :) ⏎ Macros do sound pretty great. I'm glad I am trying out different languages that broaden my view.
<FromGitter>
<schoening> If i want to use mustache instead of ecr do I just install the crustache shard, or is there an option inside kemal where I toggle it :) ?
<FromGitter>
<anamba> i haven't tried kemal (shocking i know) but i would assume it's just a matter of the extension on the file you pass to `render`
blassin has quit [Ping timeout: 245 seconds]
blassin has joined #crystal-lang
<FromGitter>
<j8r> @ArchaicLord if you haven't progammed before,Rust isn't recommended. Crystal/Python are simpler to start with. The main problem of Python is it heavily depends on the system libs – it can run on one OS but not on another one :/
<FromGitter>
<hello2dj> rust is also a awsome language
<FromGitter>
<j8r> @hello2dj what's also important is memory consumption – this costs even more than CPU
<shmibs>
specifically, the reference-style markdown link that isn't converted to html here. looked at the documentation and it says "subset of markdown" but i'd assumed that was referring only to comment docs
<shmibs>
very new to this though, never written anything, so feeling uncertain where else to look...
<FromGitter>
<bew> Well the whole docs generator uses the same small Markdown engine as the comments, so yeah it's a subset, not everything works..
flaviodesousa has quit [Remote host closed the connection]
<shmibs>
oh ._.
<shmibs>
thank you
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 276 seconds]
rohitpaulk has joined #crystal-lang
ashirase has quit [Ping timeout: 268 seconds]
ashirase has joined #crystal-lang
<FromGitter>
<drum445> Who forked my repo? ;)
<FromGitter>
<drum445> Thanks anyways
<FromGitter>
<proyb6> I'm thinking how about changing space to 1 instead of 2 whitespaces?
<FromGitter>
<proyb6> Indentation
<FromGitter>
<drum445> What's your thinking behind that?
gangstacat has joined #crystal-lang
<FromGitter>
<proyb6> When I looking on mobile phone, I analyse 2 whitespaces seem a bit more when Crystal is excel in concise code, some code have nested scope would use 2, 4, 6... whitespaces can be a bit wasteful. I'm thinking if Crystal wants to be a different kind of languages, why not use single Indentation since it's so expressive and we can understand as easy as Basic syntax
<FromGitter>
<proyb6> It's like trying to be different
<FromGitter>
<drum445> I don't think it would be clear enough where each line is
<FromGitter>
<drum445> Python's 4 space is too much; I think 2 is ok
<FromGitter>
<drum445> But I guess it's preference
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 246 seconds]
<FromGitter>
<proyb6> Golang's space no doubt seems excessive
<FromGitter>
<aboeglin> Is there any library to mock DB ?
linuksz has joined #crystal-lang
linuksz has left #crystal-lang [#crystal-lang]
<FromGitter>
<drum445> Golang is ace
<FromGitter>
<j8r> @proyb6 single tab indentation?
<FromGitter>
<proyb6> @j8r Sorry, I mean single whitespace
<FromGitter>
<j8r> for single char indentation, tab fits better
<FromGitter>
<j8r> that's its purpose in fact
<FromGitter>
<ArchaicLord> @j8r I have little bits. Nothing to shout home about but I probably fine more tutorial s than anything else. I want to get into it deeper though. Choosing the right one is difficult.n
<FromGitter>
<ArchaicLord> .
<jokke>
hey there
<jokke>
i'm writing c bindings for the NATS c library and i'm currently struggling to understand how to make this play nice with libevent
<jokke>
how can i access the crystal internal event loop? i'm guessing it's the one i should be passing here
<jokke>
if i let the lib create threads for reading i'm running into trouble such as: Collecting from unknown thread
<FromGitter>
<aboeglin> anyone has some direction about my question above ? I tried to search but couldn't find anything. Since I see you speak about Go, I look for an equivalent of sqlmock.
<jokke>
aboeglin: i haven't seen one pop up yet
<FromGitter>
<drum445> Not to my knowledge matey
<FromGitter>
<aboeglin> So I'd need to somehow mock by hand the API my app relies on right ?
<FromGitter>
<aboeglin> the API of DB in that context obviously
<FromGitter>
<aboeglin> and what's the way to handle mocking in crystal ? You can just monkey patch modules so that the code test will import the mock ? ( a bit like in js ) Or do you need to inject the mock like you would say in Go ?
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter>
<j8r> @ArchaicLord the important point, IMO, isn't to learn, and after apply in a project, more the reverse - learn because of a real need . e.g. Start with Shell for simple scripts for basic system automation, then awk/Python for advanced file manipulation and then Crystal 😏 . What
<FromGitter>
<aboeglin> Well, I could also just mock my data layer somehow, might be easier to handle. So the test doesn't know about the DB at all. Something with like an in-memory array of my model as the context for the test.
<FromGitter>
<Blacksmoke16> where if they want to use the other type of validation that requires an external shard, make sure it exists before using it
<RX14>
distro maintainers may well want to change CRYSTAL_PATH to suit their packaging and I don't want to make it difficult for them
<RX14>
@Blacksmoke16 that's a lot more reasonable
<FromGitter>
<vladfaust> How `CRYSTAL_PATH` would affect `read_file("lib/myshard/shard.yml")`, @RX14?
<RX14>
by people not using shards...
<RX14>
as in there's no `lib` at all
<FromGitter>
<vladfaust> Ah, no problem, because I'm gonna use that code is shards only :D
<RX14>
shard source could be in /usr/src/ or similar
<FromGitter>
<vladfaust> Ah
<RX14>
right now nobody does that
<RX14>
but as i said i don't want to lock us in unneccesarily
<FromGitter>
<vladfaust> Conditional require then
<jokke>
any help with libevent integration? :/
<FromGitter>
<vladfaust> But as it's not a thing yet, gonna stick with my approach
<FromGitter>
<Blacksmoke16> atm im doing like `=> [:noop]` and just ignoring it when iterating
<RX14>
i'm not quite sure what that code is trying to do...
<FromGitter>
<Blacksmoke16> its defining a hash, where the key is the name of the annotation and the value is an array of fields that are to be read off of it
<FromGitter>
<Blacksmoke16> tl;dr it seems im not able to have an empty array, in any of those 3 formats i tried
<FromGitter>
<vladfaust> It highlights in Sublime, though
<FromGitter>
<vladfaust> Or maybe `macro init`, and init being a keyword
<FromGitter>
<kinxer> That seems like a really small quality of life improvement to change the language for, and it would probably be confusing for new Crystal users.
<FromGitter>
<Blacksmoke16> @ljuti ^ that will break your stuff, but is with it ;)
<FromGitter>
<kinxer> Why does the package vendor change for every Crystal release since 0.24.1?
akaiiro has quit [Ping timeout: 244 seconds]
<FromGitter>
<ArchaicLord> @j8r not heard of awk. I originally was trying to learn vim and python. But I got side tracked by zsh, then side tracked by learning and looking at different emulators where I got roped into looking at rust which lead me here lol. I am so lost down the rabbit hole.
<FromGitter>
<bararchy> something like that @Blacksmoke16
<FromGitter>
<bararchy> like you do `sort_by`
<FromGitter>
<bararchy> etc..
<FromGitter>
<bararchy> `max_by`
<FromGitter>
<bararchy> etc..
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter>
<bararchy> Thanks @Blacksmoke16 , yeha the block form does what I want :)
<FromGitter>
<Blacksmoke16> 👍
DTZUZO has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 245 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 272 seconds]
<FromGitter>
<codenoid> sup, why crystal color in github become black
<FromGitter>
<codenoid> this is so heart breaking
<FromGitter>
<codenoid> `UwU`
<FromGitter>
<Blacksmoke16> i mean its not really a big deal
<FromGitter>
<Blacksmoke16> black matches the logo more so either way :shrug:
<FromGitter>
<Blacksmoke16> maybe they did it after me :trollface:
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
<FromGitter>
<j8r> @ArchaicLord I would say, a little project to auto configure your Linux machine (in shell/make/python?) can be a good start :) On my side I've saved my dotfiles https://github.com/j8r/dotfiles , this saved me a lot of time. I use ZSH too, zim framezork, with a hand made prompt.
<FromGitter>
<j8r> @Blacksmoke16 in your name I see Black's mock :)
rohitpaulk has joined #crystal-lang
<FromGitter>
<ArchaicLord> yeah i need to seperate out my work stuff to things that can be used at/home work. ⏎ My work laptop is probbaly a big mess. Will need a lot of git ignore files on it
rohitpaulk has quit [Ping timeout: 245 seconds]
coderobe has joined #crystal-lang
akaiiro has joined #crystal-lang
<coderobe>
can you declare arrays containing an union?
<FromGitter>
<j8r> yes, `Array(Int32 | String)` for example
<FromGitter>
<j8r> add a `.new` to instantiate one
rohitpaulk has joined #crystal-lang
<coderobe>
hm yeah, the usual '[] of MyType' doesn't work, however
<FromGitter>
<j8r> that's not the usual syntax, but a syntactic sugar. Tthis work `[] of Int32 | String`
<FromGitter>
<j8r> if you do `typeof(array_var)` you'll see the real type behind. That's why i don't like the `of` syntax
rohitpaulk has quit [Ping timeout: 240 seconds]
<coderobe>
hrm, i had a garbage character in the code so it couldn't resolve the union - my bad
<FromGitter>
<m-o-e> @vladfaust well, i'm planning to make it optional soon (but haven't yet gotten around to figuring out the corresponding macro magic).
<FromGitter>
<m-o-e> in normal usage it's pretty much what you want, i.e. what you'd otherwise manually implement in your build process.
<FromGitter>
<vladfaust> That slows down the development
<FromGitter>
<vladfaust> Should be opt-in instead
devil_tux has quit [Client Quit]
<FromGitter>
<m-o-e> how so? the d/l is fast, the file is only 170kb
<FromGitter>
<m-o-e> but yea, caching would another thing to add
<FromGitter>
<vladfaust> With ENV variable, for example
<FromGitter>
<m-o-e> i do agree about the general concern however. it's not ideal.
<FromGitter>
<m-o-e> yes, i'm going to make it optional with an ENV var. i just wanted to get a first version out and haven't yet figured out how to access env vars in macros ;)
<FromGitter>
<m-o-e> yup well, when it comes down to it, some more details also have to be considered. e.g. you don't want to accidentally create a production build *without* a regex file
<FromGitter>
<vladfaust> It's up to you :)
<FromGitter>
<m-o-e> is there a way to include a macro from a separate file? squeezing a multi line macro in the middle of a string assignment doesn't feel right
<FromGitter>
<vladfaust> Yeah, you may call `\`cat`\` from a macro
<FromGitter>
<vladfaust> quote - cat - quote
<FromGitter>
<vladfaust> It inserts a file's content
<FromGitter>
<vladfaust> Flag for a shard, really?
<FromGitter>
<j8r> when you compile your program, yes, totally
<FromGitter>
<vladfaust> How to pass custom flags?
<FromGitter>
<m-o-e> well another option (that's how most other libraries do it) is to simply release a new version of the shard every time the regex changes
<FromGitter>
<m-o-e> but that requires people to update all the time. doesn't feel quite right either to me
<FromGitter>
<m-o-e> or simply don't assist the shard-user at all, just require them to provide the file themselves...
<FromGitter>
<m-o-e> well, it's just the general question of how to deal with required 3rd party assets that change frequently
rohitpaulk has joined #crystal-lang
<FromGitter>
<j8r> pin the version?
<FromGitter>
<m-o-e> well, you *want* the latest version
<FromGitter>
<j8r> so what's the problem? the best would be to have the choice
<FromGitter>
<m-o-e> yes, well, the choice is just a bit tricky. ;)
<FromGitter>
<m-o-e> in addition to the flag there should probably be caching, because a build without the regex file is useless even in development (if your tests rely on user-agents to be identified they'd break)
rohitpaulk has quit [Ping timeout: 244 seconds]
<FromGitter>
<j8r> what's regex file? Sorry I haven't followed
<FromGitter>
<m-o-e> perhaps just releasing a new shard version every month is indeed a better approach... i'll ponder it some more
<FromGitter>
<m-o-e> @j8r no worries, not so important. it's about my shard from earlier, which needs an external regex file and currently dl's it at build time https://github.com/busyloop/user_agent_parser
<FromGitter>
<j8r> that's the only way to ensure that your lib won't break for users - test the dependency for version x.x.x, then if tests are OK chose it and make a new release