<FromGitter>
<tenebrousedge> the context here is still something I'm struggling with, but it seems like there could probably be two `Hash` objects, e.g. `INCLUDES = {}; EXCLUDES = {}`
<devil_tux>
tene: yup, I thought about using two separate hashes
<bmcginty>
Is there any way to include a method module wide (so accessible inside classes) when including anotehr module? So Module A includes module B. Module A has class ClassA, that needs to access a method from module B. I've tried all sorts of things with macros and incuded and extended and finihed macros with no luck.
DmitryBochkarev has quit [Ping timeout: 246 seconds]
DmitryBochkarev has joined #crystal-lang
devil_tux has quit [Ping timeout: 268 seconds]
<bmcginty>
To be a bit clearer, it looks like when a instance method is looked up inside a class, the parent modules of that class aren't checked, and same if it's a class method.
<FromGitter>
<sam0x17> random thought: would be cool if using `?` at the end of a method name caused the compiler to require a boolean return type for that method
DmitryBochkarev has quit [Ping timeout: 244 seconds]
<FromGitter>
<anamba> @drum445 not with ECR, which inlines the file
<FromGitter>
<anamba> right into your code
<FromGitter>
<anamba> I'm trying to use liquid for dynamic templating, but the existing liquid shard was... very basic. So it's been a bit more work than I anticipated
<FromGitter>
<drum445> ah damn, going to have to make a separate route for each file I guess then :(
<FromGitter>
<drum445> cheers anyways
<FromGitter>
<drum445> yeah I was just looking at liquid
DmitryBochkarev has quit [Ping timeout: 268 seconds]
<FromGitter>
<drum445> I'm not sure how these template engines suit a strongly typed lang though
_whitelogger has joined #crystal-lang
<FromGitter>
<straight-shoota> @bew ⏎ ⏎ > @straight-shoota Wait what? How can #7377 fix #7687 ? Since he's running on WSL, the stdlib for win32 shouldn't be used (and #7377 shouldn't impact the results).. Or am I looking it wrong? ⏎ ⏎ You're right. I missed that it was running on WSL not Windows directly. But it seems to be fixed in 0.28.0 anyway... [https://gitter.im/crystal-lang/crystal?at=5cbb12d76a84d76ed8c54b54]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
ashirase has quit [Ping timeout: 246 seconds]
ashirase has joined #crystal-lang
Jenz has joined #crystal-lang
<Jenz>
IMO the C-binding example on crystal-lang.org should be a bit simpler
<Jenz>
brb
Jenz has quit [Ping timeout: 244 seconds]
Jenz has joined #crystal-lang
<Jenz>
It is a rather extensive example, and a bit complex, at least compared to the rest of crystal's syntax
<FromGitter>
<bew> I agree, always thought it was hard to understand for a beginner
lucasb has joined #crystal-lang
<Jenz>
I certainly was baffled when I saw it the first time (which was also the first time I saw Crystal), about the only thing I remember of starting out with crystal (plus reading loads of docs)
Jenz has quit [Ping timeout: 246 seconds]
DmitryBochkarev has joined #crystal-lang
DmitryBochkarev has quit [Read error: Connection reset by peer]
<FromGitter>
<Blacksmoke16> `SELECT * FROM classes spec JOIN users j ON spec.id = j.user_id WHERE (spec.id = ? AND spec.name LIKE ? AND (j.id = ? AND spec.id = ?));`
<FromGitter>
<ryanstout> @bajro17 that usually means you're doing ```array[some_number]``` where some_number is greater than the number of elements in the array
<FromGitter>
<bajro17> I do something
<FromGitter>
<bajro17> but now this error
<FromGitter>
<bajro17> undefined method 'each' for Float64 (compile-time type is (Array(Float64) | Float64))
<FromGitter>
<bajro17> but I'm sure I pass array of float
<FromGitter>
<tenebrousedge> Using `each` and/or manual array indexes is probably not taking sufficient advantage of higher-order iteration methods
<FromGitter>
<ryanstout> humm, I would have to see the code. The variable you're calling each on can be either an Array(Float64) or a Float64
<FromGitter>
<j8r> @bajro17 add more restrictions here and there, especially return types. this may help you
<FromGitter>
<ryanstout> what line is the error on?
<FromGitter>
<bajro17> Line 65
<FromGitter>
<j8r> I suggest to add type restrictions to your args
<FromGitter>
<Blacksmoke16> ^
<FromGitter>
<j8r> it'll ease your debug
<FromGitter>
<j8r> and also return types, like `dayPortion(times : T) : U`
hightower3 has quit [Read error: Connection timed out]
<FromGitter>
<tenebrousedge> and avoid using `each` or manually tracking indices
<FromGitter>
<Blacksmoke16> why avoid .each?
<FromGitter>
<ryanstout> ```times = self.computeTimes(times)``` ⏎ ⏎ returns the last non-comment line in computeTimes, which is whatever computeTime returns ⏎ I'm guessing that is changing times to a Float64 (and thus making it an ```Array(Float64) | Float64``` [https://gitter.im/crystal-lang/crystal?at=5cbb8daa990feb4518d5b927]
<FromGitter>
<ryanstout> yea, each is fine
<FromGitter>
<ryanstout> :-)
<FromGitter>
<tenebrousedge> no, `each` is not fine
<FromGitter>
<Blacksmoke16> how you figure?
<FromGitter>
<ryanstout> @bajro17 when you run into issues like this, it can be helpful to specify types around the variables you're seeing the errors on. So if you change ```times = ``` to ```times : Array(Float64) = ``` on line 3, you'll see where it gets assigned to something else
<FromGitter>
<ryanstout> (you'll get a compile time error when something tries to assign it to something else)
<FromGitter>
<bajro17> yes it help but dont understand
<FromGitter>
<tenebrousedge> it does not have a useful return value, and it's a low-level-of-abstraction iterator. The loop cannot be used to change program state unless it reaches outside the loop scope. At best, it forces you to expend two extra lines, to create the stateful object that it interacts with, and to do something useful with it afterwards. `each` should only be used when the loop is not intended to create a new value,
<FromGitter>
... i.e. metaprogramming or possibly output. You should instead use the highest level of abstraction which is practical.
<FromGitter>
<Blacksmoke16> its saying since you restricted `computeTimes` to only accept `Array(Float64)`, there is no method that accepts a `Float64` w
<FromGitter>
<Blacksmoke16> since `times` is at some point not an array
<FromGitter>
<Blacksmoke16> prob because it gets mutated from the response of `computeTimes` at some point
<FromGitter>
<bajro17> yes
<FromGitter>
<bajro17> <3
<FromGitter>
<bajro17> thank you
<FromGitter>
<bajro17> its because other is commented
<FromGitter>
<bajro17> no overload matches 'Prayer#floatToTime12' with type Array(Float64)
<FromGitter>
<bajro17> but I dont send array
<FromGitter>
<bajro17> I send only single item from array
<FromGitter>
<j8r> you maybe do
<FromGitter>
<j8r> if `floatToTime12` or `floatToTime24` returns an array
early has quit [Quit: Leaving]
<FromGitter>
<bajro17> even from this 2 functions I send only float64
<FromGitter>
<j8r> that's because inside this methods you modify the `times` reference
early has joined #crystal-lang
<FromGitter>
<j8r> I presume
<FromGitter>
<j8r> nvm
early has quit [Remote host closed the connection]
<FromGitter>
<j8r> when this lines are commented it compiles
early has joined #crystal-lang
<FromGitter>
<bajro17> it mean something is inside
<FromGitter>
<bajro17> I will try figure out
<FromGitter>
<Blacksmoke16> are we sure there isnt an easier way to accomplish what you're trying to do? seems quite complex
<FromGitter>
<Blacksmoke16> for just doing date stuff?
<FromGitter>
<Blacksmoke16> but that latest error is something similar to the last one, trying to pass an `Array(Float64)` when it only takes a `Float64`