Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 13:47
    straight-shoota closed #12051
  • 13:47
    straight-shoota closed #12050
  • 12:17
    beta-ziliani edited #7318
  • May 15 08:43
    r00ster91 closed #7318
  • May 15 08:17
    r00ster91 closed #7690
  • May 14 17:01
    Blacksmoke16 labeled #11995
  • May 14 13:03
    webhive closed #12055
  • May 14 10:19
    straight-shoota milestoned #12051
  • May 14 10:00
    I3oris edited #12051
  • May 14 08:45
    oprypin review_requested #11977
  • May 13 23:29
    Blacksmoke16 unlabeled #12061
  • May 13 22:56
    Blacksmoke16 edited #12061
  • May 13 22:56
    Blacksmoke16 edited #12061
  • May 13 22:54
    Blacksmoke16 labeled #12061
  • May 13 22:54
    Blacksmoke16 labeled #12061
  • May 13 22:54
    Blacksmoke16 labeled #12061
  • May 13 22:54
    Blacksmoke16 opened #12061
  • May 13 20:14
    straight-shoota labeled #12060
  • May 13 20:14
    straight-shoota labeled #12060
  • May 13 20:14
    straight-shoota opened #12060
From IRC (bridge bot)
@FromIRC
<Papierkorb_> While possible, I'd prefer an "official" solution. Especially as IMHO it would be a nightmare if the stdlib would rely on such ENV checks
Ghost
@ghost~55586c4815522ed4b3e08557
@asterite what is the issue with is_a?, do you mean that multiple Crystal libs will have the issue that 2 different types may have the same type id?
From IRC (bridge bot)
@FromIRC
<Papierkorb_> @asterite, is the system configuration somehow exposed as string to the compiled program? Doing that isn't great: https://github.com/Papierkorb/bindgen/blob/next-gen/src/bindgen/config_reader/variables.cr#L20
ziprandom
@ziprandom
@sdogruyol hey is there a way to make kemal stop complaining about command line opts it doesn't know?
Ghost
@ghost~55586c4815522ed4b3e08557
For crystal-lang/crystal-book#119 he's trying to merge master to gitbook-3 is it really what should happen? (@asterite @mverzilli) What is this gitbook-3 branch for?
ziprandom
@ziprandom
@sdogruyol found it already ..
Martin Verzilli
@mverzilli
good catch! that's a pretty old branch that Brian used to update gitbook deps
I'll kill that branch
thanks @bew !
Ghost
@ghost~55586c4815522ed4b3e08557
you're welcome, I've had issues like this with people new to git(hub) lately, I saw that coming ^^
Ghost
@ghost~55586c4815522ed4b3e08557
@mverzilli you mistyped the branch name in your comment on the PR: github-3 => gitbook-3
What you guys think ;)
Stephan Langeveld
@Fanna1119
how would i get the value of items inside a 2d kind of a hash array, i honestly don't even know what terminology to use :D

content = {:id => "3kTMd",
  :lists => [{:tags => "false",
  :url => "http://localhost:8080/"}]
}

x = content[:lists]

puts x
Ghost
@ghost~55586c4815522ed4b3e08557
@eliasjpr :+1:
Elias Perez
@eliasjpr
Im ordering a set of them :)
Ghost
@ghost~55586c4815522ed4b3e08557
@eliasjpr I was thinking about one with big logo on the back (with Crystal written under) (with my pseudo at the top! ^^) on a little <logo + Crystal> on the front left, but those a great start! :p
Ary Borenszweig
@asterite
content[:lists].as(Array)
Stephan Langeveld
@Fanna1119
@asterite Awesome! Thank You!! :)
Zafar Ansari
@ansarizafar
If a method name is stored in a variable how can I run it?
Ghost
@ghost~55586c4815522ed4b3e08557
you can't
Jason Waldrip
@jwaldrip
Crystal is not as meta as ruby.
@ansarizafar can you provide an example?
Zafar Ansari
@ansarizafar
After making several unsuccessful attempts of storing a proc in a Hash without specifying return type. Now I am trying to store a class method in a Hash so that I can later run it.
Like that
store[key] = User.list
how can I run list method which is store in a hash
Ghost
@ghost~55586c4815522ed4b3e08557
do you need to pass arguments to thoses methods when calling them?
Zafar Ansari
@ansarizafar
yes
Ghost
@ghost~55586c4815522ed4b3e08557
are they known when you add the method to the hash?
Zafar Ansari
@ansarizafar
no
Ary Borenszweig
@asterite
case key; when "list" then User.list; etc.
Zafar Ansari
@ansarizafar
I want to make it generic. Is there any syntax that I can use to run the method stored in hash directly.
Jason Waldrip
@jwaldrip
Can the proc/method return any type?
Zafar Ansari
@ansarizafar
Ideally I would like to store a proc block in hash without specifying return type as return type is not known in advance, but I think its not possible.
Jason Waldrip
@jwaldrip
If you know what the possible types could be you could store them in a union
Zafar Ansari
@ansarizafar
Like that
@@store = {} of String => (Hash(String, JSON::Type) -> _)
Jason Waldrip
@jwaldrip
or, let me ask a question... do you expect your method to always return something?
Or are you just trying to invoke a method that may just invoke something, not nessicarily return something?
Ghost
@ghost~55586c4815522ed4b3e08557
@ansarizafar do you need the return value when calling it?
Zafar Ansari
@ansarizafar
yes, It could be a NameTuple or an Array Of NamedTuples
Jason Waldrip
@jwaldrip
So use a union
Zafar Ansari
@ansarizafar
Yes I need return value
Jason Waldrip
@jwaldrip
If you know the various return types, just set it up as a union
Zafar Ansari
@ansarizafar
Return types are not known in advance. Namedtuple will be generated with the fields returned from Postgre Db depending on the query.
Will
@Willamin
Hi everyone! I've got an absolutely crazy question for you. I want to reopen the Integer structs and add a macro def that throws a compile time exception based on the value of the Integer. I can't find a definitive list of macro variables such as @type and @def. Can anyone here help?
Ghost
@ghost~55586c4815522ed4b3e08557
throw a compile time error when doing what @Willamin ?
Will
@Willamin
Contrived example: I'd like to add a .is_this_a_0_at_compile_time to Integers that throws a compile time error if it's called on a non-zero integer
0.is_this_a_0_at_compile_time # should compile fine
1.is_this_a_0_at_compile_time # should throw a compile time error
Ghost
@ghost~55586c4815522ed4b3e08557
how is this supposed to be used?