Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 18 13:16
    hugopl closed #12062
  • May 17 20:20
    Blacksmoke16 synchronize #12044
  • May 17 18:19
    straight-shoota edited #11947
  • May 17 18:19
    straight-shoota milestoned #11947
  • May 17 18:18
    straight-shoota closed #11971
  • May 17 18:18
    straight-shoota closed #11970
  • May 17 17:21
    HertzDevil labeled #12063
  • May 17 17:21
    HertzDevil labeled #12063
  • May 17 17:21
    HertzDevil labeled #12063
  • May 17 17:21
    HertzDevil opened #12063
  • May 17 16:29
    HertzDevil labeled #12062
  • May 17 13:50
    hugopl opened #12062
  • May 17 13:50
    hugopl labeled #12062
  • May 16 19:05
    lbguilherme synchronize #11947
  • May 16 17:29
    straight-shoota milestoned #11971
  • May 16 17:15
    straight-shoota closed #12038
  • May 16 17:15
    straight-shoota closed #12036
  • May 16 17:14
    straight-shoota edited #12038
  • May 16 13:47
    straight-shoota closed #12051
  • May 16 13:47
    straight-shoota closed #12050
From IRC (bridge bot)
@FromIRC
<riza> or does it have to be a case statment
<riza> I'm having an awful time attempting to increment two iterators at once
George Dietrich
@Blacksmoke16
Case or if with is_a should do it
From IRC (bridge bot)
@FromIRC
<riza> case fails me because I have two iterators I need to mutually advance
<riza> this is what I tried, anyway: case ; when a === stop || b === stop ; else ... end
<riza> I'm also noticing tonight that ranges can't be decreasing and I'm a little twinging at that too
George Dietrich
@Blacksmoke16
I'd just use the latter approach then
From IRC (bridge bot)
@FromIRC
<riza> I think I'm just going to abandon iterators entirely and twiddle the bits myself
<riza> I was surprised about the decreasing range but that's what ruby does too so there must be some sort of reason
Ary Borenszweig
@asterite
riza: maybe zip the iterators? ;-)
And for decreasing Iterator you can do x.to(y)
From IRC (bridge bot)
@FromIRC
<xyhuvud> I have a small idea of what riza may be fiddling with :⁠D
Ary Borenszweig
@asterite
Haha, me too :-)
From IRC (bridge bot)
@FromIRC
<xyhuvud> todays exercise was so easy and short the top list server crashed due to load :X
Ary Borenszweig
@asterite
Really? That's great news. I guess I'll be streaming for just a few minutes then. I think Eric puts an easy exercise after a tough one (yesterday wasn't that hard, but you needed to think about a different way to represent things)
ddd
@Dan-Do
How can I tell crystal build to use a single "header only" (.h without .c)?
ddd
@Dan-Do
I made a fake.c
# include "header.h"
But after compiled with gcc -c ... the object file removed two functions. Weird!
From IRC (bridge bot)
@FromIRC
<riza> @asterite oh, great suggestion, thank you
From IRC (bridge bot)
@FromIRC
<holst> I have a couple of observations: Crystal lang needs something that is taggable and searchable; crystal lang is not. crlang vs. #crlang is great ;⁠-)
<holst> Also, I think the Goals of the project are non-orthogonal. In total 6 goals but they can be reduced down to at least 5 or even 4 if we accept the fact that OOP is not a goal in itself
<holst> Have anyone written a good JSON / microservice tutorial for crlang? I think I am struggling a lot with moving from say Python or Javascript to Crlang due to the parsing and typing requirements. I have been looking for some kind of best practice guide for this but I have not found one
<holst> do we really need to define the complete API response univerise in the client application just to "get some job done"? If so it puts a great barrier to writing small client apps that uses a big server API
<holst> case in mind: docker engine API
From IRC (bridge bot)
@FromIRC
<holst> and kubernetes API
<straight-shoota> What do you mean with "complete API response univerise"?
<holst> the generated APIs are completely terrible, 100K LOC monsters
<straight-shoota> What generated APIs? Who generated them and why?
<holst> say you do docker inspect <container> there might be a lot of data in there which is mostly useles to the application that did the query.
<holst> @straight-shoota: the generated APIs are by the project maintainers (obviously not generated for crystal)
<straight-shoota> I don't follow what your asking about
<straight-shoota> I believe you have assumed some implicit context, but it does not communicate
<holst> thats the complete output for a docker inspect
<straight-shoota> yes, I got that. Still don't know what your problem is
<holst> If I were to implement a complete class description for the entire response I would just not use crlang for that
<straight-shoota> y not?
From IRC (bridge bot)
@FromIRC
<holst> Useless work. I do not have any need for the code that talks about the Network parameters say. So why would I write code for it
George Dietrich
@Blacksmoke16
could also just use JSON.parse ofc. then you have to deal with typing in a more painful to use way like data.as_a[0].as_h["Id"].as_s versus data[0].id
From IRC (bridge bot)
@FromIRC
<holst> I would prefer if I could work with a dynamic type instead to at least dig myself down to the part that I am interested in
George Dietrich
@Blacksmoke16
fwiw you dont need to add properties and stuff for things you wont need
From IRC (bridge bot)
@FromIRC
<straight-shoota> I don't know. But you stated as a premise that you wanted a complete class representation of that JSON data
<holst> I think that is the opposite of what I wanted
<holst> I questioned if that was the way to go in a typed language like crlang; or golang which has a generated API; that is typically what they do
<straight-shoota> You can go completely dynamic with JSON.parse as Blacksmoke16 mentioned. Or you use JSON::Serializable and only add mappings for the fields your interested about.
<holst> So you can have a "view" of a type and have the non-referenced fields just dropped?
<straight-shoota> Yes
<holst> Ok, I will try something out and ask for some feedback if you think its "best practice" style or not
George Dietrich
@Blacksmoke16
From IRC (bridge bot)
@FromIRC
<straight-shoota> This example is a bit more concise: https://play.crystal-lang.org/#/r/cetw