<crystal-gh>
[crystal] miketheman opened pull request #4449: Add num_cpus to System module (master...miketheman/numcpus) https://git.io/vHLL0
literal has quit [Ping timeout: 260 seconds]
literal has joined #crystal-lang
<FromGitter>
<fridgerator> that doesn't provide the server language
<FromGitter>
<fridgerator> Im not sure, but I would guess that the server is in crystal
<duckqlz>
so kemal or router.cr ?? any opinons ?
<FromGitter>
<fridgerator> depends on your needs, kemal has lots of tools (csrf, sessions storage, etc) : https://github.com/kemalcr
<FromGitter>
<fridgerator> all broken out into modules
<FromGitter>
<fridgerator> router.cr is slightly faster, from what I remember
<duckqlz>
fridgerator: kemal seems like a lot of magic, router at least looks a little less intense. Has anyone seen any benchmarks for crytal compared to ADA Web Server?
Yxhvd has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
mark_66 has joined #crystal-lang
Philpax has joined #crystal-lang
MatrixTraveler[m has quit [Remote host closed the connection]
TheGillies has quit [Remote host closed the connection]
sija[m] has quit [Read error: Connection reset by peer]
krigare[m] has quit [Remote host closed the connection]
braidn[m] has quit [Remote host closed the connection]
thelonelyghost has quit [Read error: Connection reset by peer]
kodo[m] has quit [Remote host closed the connection]
Lex[m] has quit [Remote host closed the connection]
statikowsky has quit [Remote host closed the connection]
sz0 has joined #crystal-lang
zipR4ND has quit [Ping timeout: 258 seconds]
splitty__ has joined #crystal-lang
splitty___ has quit [Ping timeout: 246 seconds]
<FromGitter>
<molovo> So I started playing with some ideas for a possible `crsh`, and I’m already wondering whether it would be a good idea. Biggest stumbling block is that any shell pretty much depends on sourcing and executing files, which isn’t possible in a compiled language.
<FromGitter>
<molovo> Managed to get a nice prompt with git info on the right hand side though, which was easier than I anticipated, and so much quicker - running everything through fibers so all the git calls are done in parallel which is far quicker than in any other shell
statikowsky has joined #crystal-lang
MatrixTraveler[m has quit [Remote host closed the connection]
sija[m] has quit [Remote host closed the connection]
kodo[m] has quit [Read error: Connection reset by peer]
braidn[m] has quit [Read error: Connection reset by peer]
thelonelyghost has quit [Read error: Connection reset by peer]
Lex[m] has quit [Remote host closed the connection]
krigare[m] has quit [Remote host closed the connection]
TheGillies has quit [Write error: Connection reset by peer]
Dreamer3 has quit [Ping timeout: 260 seconds]
oz has quit [Ping timeout: 260 seconds]
<FromGitter>
<akzhan> More interesting is REPL. Is anything exists?
<FromGitter>
<bew> I also thought about this (script vs compiled stuff in a shell) many time before, and I always came back to my original idea: make a shell without the "scripting" part (or only a minimal part of it)
<FromGitter>
<molovo> @akzhan No, not that I’ve seen. I was aiming for both in one - A REPL that proxies commands through to system. The whole shell syntax will be Crystal (if I can get it working)
oz has joined #crystal-lang
<FromGitter>
<straight-shoota> Have a scripting language in Crystal ;)
Dreamer3 has joined #crystal-lang
MatrixTraveler[m has joined #crystal-lang
<FromGitter>
<akzhan> I suppose that Shell in Crystal will have no more than existing ones like zsh.
<FromGitter>
<molovo> Need to implement something like `lazy_require` in Crystal - compiles the file into a temporary command (like with `crystal run`) and then executes it with a system call
<FromGitter>
<molovo> Otherwise scripting won’t be possible at all
<FromGitter>
<akzhan> Crystal to LLVM JIT is solution
<FromGitter>
<molovo> Yes it would be perfect. The other way I considered doing it which would be more performant, is keeping a cache of compiled files. So when a script is called, it is compiled and stored somewhere, and then the compiled version is run. On each call the timestamp of the source and compiled versions are compared. If the script is newer it gets recompiled, otherwise just call the compiled version
<FromGitter>
<straight-shoota> If it is run as an external binary, it might be tricky to expose internals of the REPL environment to the custom "script"
<FromGitter>
<bew> was thinking about that, but this would only apply to scripts you invoke, not with stuff you write directly as input
statikowsky has quit [Remote host closed the connection]
<FromGitter>
<bew> @straight-shoota could still be done via a daemon that can be controlled by other processes (via unix sockets?)
<FromGitter>
<bew> and the custom script would get directions (unix socket path) via an environnement variable for exemple
<FromGitter>
<bew> @molovo I just looked at you github, you have a lot of amazing stuff!
<FromGitter>
<straight-shoota> Yeah, but that still requires such an interface which will always be lacking compared to scripting languages with direct access to the scripting environment
<FromGitter>
<molovo> @bew :smile: thanks buddy
<FromGitter>
<straight-shoota> compiled binaries for direct input could be cached as well, although it won't be very frequent that the same one is ran again and again
<FromGitter>
<molovo> Actually a daemon might not be a bad way to go - so that actual shell interface as you use it on the CLI has no state, but it’s all managed by a daemon in the background. That way both user input and scripts can retrieve variable definitions etc. from the daemon and then it would be consistent between the two. So if I run `echo $VAR`, the shell asks the daemon for the value, and then prints it
<FromGitter>
<molovo> Would keep the CLI far more responsive, as all of those calls could be handled asynchronously via sockets rather than the shell itself managing it
<FromGitter>
<molovo> Although variable inheritance would be horrible in that scenario. I should think about this some more
<FromGitter>
<bew> what do you mean by "variable inheritance" ?
<FromGitter>
<molovo> So in ZSH/Bash/sh, when you call a function, it automatically inherits all environment variables from the calling function. But then you can specify local variables within that, which overwrite the inherited one, but aren’t exported back up the to the script which called it. Similiar to how `var` and `let` work in JavaScript. But then, when you call an external script, it also inherits the variables, and you
<FromGitter>
... can change anything you want, local or not, and it won’t be modified in the script that called it. If we’re managing all variables in memory in some external daemon, trying to separate out all those different states for what is essentially the same variable would be horrible
<FromGitter>
<molovo> I’ve no idea how the traditional shells do it
<FromGitter>
<bew> I think they just fork
<FromGitter>
<bew> with pipes to still have access to opened IOs, or sth like that
<FromGitter>
<akzhan> Environment variables of forked process inherits from parent by default.
<FromGitter>
<molovo> That would make sense
<FromGitter>
<bew> but imo, that variable inheritance hell is only the result of shell simplification stuff regarding variables, shared state, etc.. I don't see exactly where it would appear with crystal code "as scripts"
braidn[m] has joined #crystal-lang
krigare[m] has joined #crystal-lang
kodo[m] has joined #crystal-lang
thelonelyghost has joined #crystal-lang
Lex[m] has joined #crystal-lang
TheGillies has joined #crystal-lang
<FromGitter>
<molovo> It wouldn’t for external programs. They would work exactly the same as running a compiled crystal program now. But in order to have something like `.crshrc`, to allow users to configure their environment, you’d need to be able to source that file, run it, and have it affect the state within the currently-running shell. That’s not currently possible
sija[m] has joined #crystal-lang
<FromGitter>
<bew> via a daemon it could, otherwise I don't know..
<crystal-gh>
[crystal] mverzilli pushed 1 new commit to master: https://git.io/vHtfW
<crystal-gh>
crystal/master ac6deff Eduardo Silva: Add man page to crystal (#2989)
<FromGitter>
<bew> @mverzilli thanks! Maybe you didn't read the all discussion, the experiment is to have a crystal shell, which could be able to run "crystal compiled-script" that still can control the shell (prompt, etc..)
zipR4ND has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter>
<molovo> Basically a crystal REPL which proxies shell commands through to SH
<FromGitter>
<mverzilli> my bad, I thought you were thinking of a ZSH "replacement"
<FromGitter>
<bew> I was thinking about a zsh "replacement" but more as a long-term project than the experiment currently running
<FromGitter>
<bew> if I understand corrctly that you're doing an experiement
<FromGitter>
<mverzilli> :)
<FromGitter>
<bew> I'll have *some* other projects to complete before I start this one!
<FromGitter>
<molovo> Yeah, it’s just an experiment. I’d love to have a full shell environment with everything done in Crystal, but I think it’s probably a pipe dream. OOP has been around for ~30 years and no one has managed an OOP shell yet. There must be a reason for that
<FromGitter>
<molovo> Just building a replacement for traditional shells, where EverythingIsAString would actually be fairly straightforward in comparison
<FromGitter>
<mverzilli> well there's Powershell (don't yell at me :P)
<FromGitter>
<straight-shoota> @molovo Shell scripts are by design not intended for highly complex software (although sometimes they're used for that). And thats where OOP has its strength. For most scripts there would probably be less perceivable benefit.
<FromGitter>
<molovo> I know that, I’ve developed quite a lot of ZSH software myself. But that’s the point. Imagine if your command line was a Crystal REPL? Being able to type environment variables, have constants, proper arrays and hashes, rather than relying on word splitting alone. Your command line essentially becomes a programming interface
Raimondii has joined #crystal-lang
<FromGitter>
<akzhan> by the way, can Crystal be used to build libraries?
<FromGitter>
<bew> not easy as building program, but it can, by compiling to object files, then link thoses object files into a shared library
<FromGitter>
<bew> you'll need a C-like interface to initialize and manipulate the library
<FromGitter>
<bew> I asked once to ysbaddadden if it was possible to share the GC between the host & the library, he told me it was possible IIRC, but I have no idea how..
<FromGitter>
<bew> ( *too many `d` in his name ^^* )
zipR4ND has quit [Quit: Leaving.]
sz0 has quit [Quit: Connection closed for inactivity]
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
greengriminal has joined #crystal-lang
statikowsky has quit [Remote host closed the connection]
<FromGitter>
<crisward> I am trying to encrypt some text, the same way I've done it in node. However I'm not sure how to do this in crystal. In node the code is ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Any ideas where I should look for help with this? [https://gitter.im/crystal-lang/crystal?at=5924536b2b926f8a6784fb97]
<FromGitter>
<akzhan> @sdogruyol just want to note that #4433 doesn’t fix https://github.com/kemalcr/kemal/issues/251 ⏎ ⏎ So please fill new issue with POC if problem still exists on crystal@master.
<FromGitter>
<sdogruyol> @akzhan thanks for the heads up :+1:
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
mark_66 has quit [Remote host closed the connection]
snsei has quit [Remote host closed the connection]
greengriminal has joined #crystal-lang
greengriminal has quit [Client Quit]
greengriminal has joined #crystal-lang
greengriminal has quit [Client Quit]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
greengriminal has joined #crystal-lang
greengriminal has quit [Remote host closed the connection]
wontruefree has joined #crystal-lang
wontruefree has quit [Quit: Is gone... Just plain old gone]
<FromGitter>
<akzhan> я
Raimondi has quit [Quit: WeeChat 1.8-dev]
Raimondi has joined #crystal-lang
wontruefree has joined #crystal-lang
wontruefree has quit [Quit: Is gone... Just plain old gone]
TheLemonMan has joined #crystal-lang
<FromGitter>
<megatux> Hi! question, ...today I was reading about Ruby's class instance variables & the difference with class variables...the same applies to Crystal?
<FromGitter>
<drosehn> I think I'd call them "class variables" vs "instance variables". Saying "class instance variables" causes a small short-circuit in my brain. But yes, crystal does have variables at both levels.
<FromGitter>
<bew> > Class variables are inherited by subclasses with this meaning: their type is the same, but each class has a different runtime value. For example:
<FromGitter>
<drosehn> There might be some other documentation on them, but I'm not aware of any. Note that there is a lot of crystal-specific documentation that I have *not* read, so it's easy to believe that I missed it.
<FromGitter>
<drosehn> Hmm. Yeah. Is that true in ruby? It might be that I'm often going through instance-methods to access class-variables, in which case I might not notice. (it's also true that I do not use subclasses very often).
<FromGitter>
<megatux> I think that's the difference between class instance & class variables in Ruby, the 'sharing' when subclassing
<FromGitter>
<megatux> so, if every class has it's own value, that is the Ruby's class-instance behavior, AFAIK. ...How do I get the Ruby's @@variable way of sharing a value in all my child classes?
<TheGillies>
class variables are satan IMHO :P
<FromGitter>
<bew> TheGillies yeah, there are another way of having globals
<FromGitter>
<molovo> I have a semantics question. If I have a class with variables that are only accessed externally, would it be better to have a variable with a getter, or a method which returns the value? For example, a `Command` class, that provides `name` and `description` for consumption elsewhere.
<Papierkorb>
molovo, a getter is a method which returns the value. Use the `getter` macro if possible.
<FromGitter>
<molovo> Yeah, that’s the way I’m doing it - just wondered if it was worth bypassing the instance variable since I’m never going to use it inside the class
<FromGitter>
<bararchy> Is there a way to watch a folder and get an event when file\files have changed ? (added, removed, modified)
<FromGitter>
<drosehn> Looking at my Pickaxe book, the few times they use "class instance variables", they mean the exact same thing as "instance variables", or "per-object variables".
<FromGitter>
<megatux> yeah, the object is a Class in this case. I wanted to know if Crystal is the same
<FromGitter>
<molovo> @bararchy Ah! That explains why it’s always so slow to respond :D
<FromGitter>
<mverzilli> `inotify` would be great!
Ven has joined #crystal-lang
DissonantGuil3 has quit [Quit: WeeChat 1.7.1]
Ven is now known as Guest41355
<FromGitter>
<megatux> just, Linux only
<FromGitter>
<mverzilli> OSX has `fsevents`, it'd be a matter of abstracting over those
Guest41355 has quit [Ping timeout: 272 seconds]
Ven_ has joined #crystal-lang
<RX14>
looks like 4gb isn't enough to compile crystal's specs... which is a problem for 32bit CI
<RX14>
so are there any solutions?
<bmcginty>
RX14: Can the spec be split, compiled into it's own executables, and then have another spec to make sure all the priors run successfully? (I'm kind of just thinking out loud, so idiocys likely. :))
<FromGitter>
<mverzilli> crosscompiling?
TheLemon1an has joined #crystal-lang
<RX14>
that's cheating
<RX14>
plus I tried that already
<RX14>
as I explained in the issue it didn't work out
<RX14>
i'll add a swapfile to get the compiler compiling itself, but specs? seems a stretch
Ven_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<delef> Thank you!
TheLemon1an has quit [Remote host closed the connection]
wontruefree has joined #crystal-lang
Renich_ has quit [Quit: Renich_]
<RX14>
@mgarciaisaia i'll try swapfile + --no-debug + --threads=1 now
<FromGitter>
<bew> @RX14 what's the error?
<RX14>
well it just runs out of memory lol
<FromGitter>
<bew> Like malloc fail? Or fork fail?
<RX14>
i've never seen it fail with anything but a fork fail
<RX14>
interestingly enough
<FromGitter>
<bew> The fact that the forks are only needed for exec'ing some littles programs, I think we could resolve this error by having less memory to copy during the fork
<RX14>
memory isn't copied on fork
<FromGitter>
<bew> (this is my reflexion only, will test some stuff now)
<FromGitter>
<mgarciaisaia> @RX14 do you have any of the builds that failed due to memory?
<FromGitter>
<bew> Stack os copied IMO
<FromGitter>
<bew> Is*
<RX14>
probably
<RX14>
but thats 8MiB tops
<RX14>
so i doubt it's that
<FromGitter>
<bew> But then why the fork could get out of memory if it allocates nothing?
<FromGitter>
<bew> (almost)
<RX14>
because the virtual memory space isn't big enough? i have no idea
<FromGitter>
<mgarciaisaia> Thanks - I was going to ask for the link. I can't get to understand Jenkins UI :(
<RX14>
well it is a bit complicated
<RX14>
but just click on stuff that looks interesting
<RX14>
you can't break anything unless you're logged in
Ven has joined #crystal-lang
Ven is now known as Guest25118
<FromGitter>
<mgarciaisaia> That's a weird log :/
<RX14>
it is indeed
<RX14>
and it only happens with llvm 4.0 which is super weird
<FromGitter>
<mgarciaisaia> StackOverflow says you're missing the `-lffi` flag or something like that. I don't get *why* it needs that - any clue? ⏎ https://stackoverflow.com/a/20206371/641451
<RX14>
it's definitely a bug in crystal not the linker - it only happens on llvm 4.0
<FromGitter>
<fridgerator> is the only difference between crystalshards.xyz and crystalshards.org the styling?
<oprypin>
latter also force redirects to https ¯\_(ツ)_/¯
Guest25118 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<mgarciaisaia> @RX14 is there a concrete way in which we could help you get the CI working? Troubleshooting the build, deciding the matrix?
<RX14>
deciding the matrix would be good... I think doing every llvm version for every target is a bit over the top
<RX14>
so i think every llvm version for 64bit and latest llvm for every other target
<RX14>
actually randomized llvm version for each target would be ideal
<RX14>
i need to sort out how we share the jenkinsfile between nightlies and PR builds though
<RX14>
but deciding on the contents would be great so I can test stuff out
<RX14>
and it looks like that llvm4.0 issue is reproducible
havenwood has quit [Excess Flood]
havenwood has joined #crystal-lang
havenwood has joined #crystal-lang
havenwood has quit [Changing host]
havenwood has quit [Client Quit]
<wontruefree>
running the crystal specs utilizes less of my CPU then I would have thought
<RX14>
only 1 core
<RX14>
hopefully a maxed core though
<wontruefree>
not even
<wontruefree>
like a quarter of one core
<RX14>
std or full specs?
<wontruefree>
yeah
<RX14>
it maxes a core for me
<wontruefree>
it has spiked at 70%
<wontruefree>
weird
<wontruefree>
I wonder if there is like a file hander limit or something I am running into
<wontruefree>
I have a mac at work so it is very vanilla
<wontruefree>
I am running it in verbose mode right now
<wontruefree>
I can check it again without that flag
<wontruefree>
maybe the extra IO blocks it
<FromGitter>
<mgarciaisaia> @Rx14 a couple of months ago we were thinking of building OSX/3.9, Linux64/3.9, Linux64/3.5 for each commit. But it doesn't seem wise to build 3.9 for OSX given that Homebrew ships Crystal with 4.0.
<RX14>
for each commit is a different matter
<RX14>
we don't even want to run each architecture for each commit I think
<RX14>
just linux, osx on 1 llvm version each
<RX14>
nightly matrix should be later
<RX14>
but maybe *not* exhaustive
<RX14>
s/later/larget
<RX14>
s/later/larger
<RX14>
darnit
<FromGitter>
<mgarciaisaia> We're trying to drop 3.5, also, so I'm not sure we want to do that - or maybe keep it until we officialy drop 3.5
<RX14>
well we should be dropping 3.5 soon
<FromGitter>
<mgarciaisaia> You say we *don't* want to run *everything* nightly?
<RX14>
well it'd get expensive
<FromGitter>
<mgarciaisaia> Or that we should start slowly?
<RX14>
we really need compiler work to get cross-compiling --prlude empty on windows possible
<RX14>
currently they use a hack dumping the llvm bitcode to test their crystal port it looks to me
<wontruefree>
yeah looks hacky
<wontruefree>
it also looks massive
<wontruefree>
especially with the file structure changes and stuff
<wontruefree>
seems like it could be very easy to miss something in a merge like this
<RX14>
well that PR won't be merged at once
<RX14>
see the comments at the bottom
<wontruefree>
also it seems like it would break a lot of other PRs in the queue
<RX14>
we're planning to merge it in parts
<RX14>
we'll also be moving platform-specific parts to a new `Platform` module at the same time
<wontruefree>
ok
<wontruefree>
cool
<RX14>
so yeah it'll take some work
<FromGitter>
<mgarciaisaia> It's more kind of a spike than anyhting
<RX14>
hmm?
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter>
<mgarciaisaia> Not an actual PR to be merged, but more exploring the space and doing a first attempt at the issue - then we'll rework it to merge it in a clean, nice way
<RX14>
ah i see what you mean
wontruefree has quit [Quit: Is gone... Just plain old gone]
Majost has quit [Ping timeout: 240 seconds]
Majost has joined #crystal-lang
greenbigfrog has quit [Ping timeout: 240 seconds]
greenbigfrog has joined #crystal-lang
Dreamer3 has quit [Quit: Computer has gone to sleep.]
duckqlz has quit [Quit: leaving]
snsei has quit [Remote host closed the connection]