<FromGitter>
<Aaron-JM> Hey everyone, running into the following problem: Error: 'ldflags' link argument must be a String. Any help would be appreciated.
<FromGitter>
<Blacksmoke16> What produces that error?
<FromGitter>
<Blacksmoke16> what happens if you just hardcode one of those values
<FromGitter>
<Blacksmoke16> so its more like `@[Link(ldflags: "#{__DIR__}/ext/llvm_ext.obj")]`
<FromGitter>
<Blacksmoke16> i.e. without the macro call
<FromGitter>
<Aaron-JM> it works successfully
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<Aaron-JM> its just whenever im trying to use the marco
<FromGitter>
<Blacksmoke16> wild guess, the macro causes the type of string to be something else
<FromGitter>
<Blacksmoke16> since link annotation is processed before macros are expanded, thats my guess
<FromGitter>
<Aaron-JM> yeah that's probably the issue
<FromGitter>
<Aaron-JM> Im wondering if there is someway i can cast the value it returns
<FromGitter>
<Blacksmoke16> just use a method?
<FromGitter>
<Blacksmoke16> or hae the macro add different link headers
<FromGitter>
<Aaron-JM> yeah might be best just to make it a method
<FromGitter>
<Aaron-JM> thanks for your help
chachasmooth has quit [Ping timeout: 272 seconds]
chachasmooth has joined #crystal-lang
zorp has joined #crystal-lang
_whitelogger has joined #crystal-lang
<postmodern>
getting an `Error: can't declare variable with NumberLiteral` but --error-trace gives me literally nothing
<postmodern>
no clue where its coming from, just somewhere in the code i changed
<postmodern>
ah nm, was a @type = TYPE where TYPE was a geneeric that i used to pass in an enum value
<postmodern>
hmm how does one upcast from a base class? .as() isn't working
<postmodern>
weird scenari where i'm passing in an enum to this ioctl, so i know it will give me back a certain type of struct, which maps to a sub-class of Format that provides access into the correct union within the struct
<postmodern>
is there a difference between specifying the type signature of BaseClass vs. SubClass1 | SubClass2 | ...
<postmodern>
i know specifying all of the sub-classes causes crystal to denoate the type as BaseClass+
<postmodern>
oddly that syntax isn't valid crystal
Nekka has quit [Ping timeout: 240 seconds]
Nekka has joined #crystal-lang
Nekka has quit [Quit: zzz]
Nekka has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter>
<Aaron-JM> Hey everyone, whenever i place ```{% debug %}``` in a macro it outputs ```# -- Handle System: Linux -- # ⏎ linking_extension = (".so").as(String)```.
deavmi has quit [Ping timeout: 240 seconds]
deavmi has joined #crystal-lang
<FromGitter>
<Aaron-JM> Hello everyone, I am currently developing in the crystal programming language and am consistently running into the following error: ``` Error: 'ldflags' link argument must be a String ``` The line producing this error is: ``` @[Link(ldflags:"#{__DIR__}/libAppCore#{extension_concatenate}")] ``` The extension_concatenate variable is a simple string: ⏎ ⏎ ```code paste, see link```
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
deavmi has quit [Client Quit]
deavmi has joined #crystal-lang
<postmodern>
nm, found the culprit that was returning a base class instance instead of one of the sub-class instances
<postmodern>
Blacksmoke16, when passing an enum value as a generic, why does the enum type information get lost and the enum value get reduced to a primitive int type?
<FromGitter>
<Blacksmoke16> because enum members are not types, their constants
<FromGitter>
<Blacksmoke16> they're*
<FromGitter>
<Blacksmoke16> by default starting at `0`
<FromGitter>
<Blacksmoke16> so you cant restrict an ivar to a specific enum member, only the enum itself
<FromGitter>
<Blacksmoke16> can prevent change it at runtime and raise an exception, but nothing via compile time afaik
<postmodern>
ah. i thought that the compiler somehow passed the enum type information along with the value. but i guess generics are kind of un-typed to begin with.
<FromGitter>
<Blacksmoke16> you might be able to do like `@type = MyEnum.from_value EnumValue`
<FromGitter>
<Blacksmoke16> but prob easier to just not use generics in that context
deavmi has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
<FromGitter>
<guglielmocg_gitlab> Hello everyone, I'm experiencing issues in turning a Time.utc value into a float64 like I can easily achieve in Ruby with Time.now.to_f=> 1597330432.3254602 ⏎ I'm looking into the doc API, nothing seems to help
<FromGitter>
<guglielmocg_gitlab> Yeah this is pretty close!
<FromGitter>
<guglielmocg_gitlab> Yeah that's it, thank you! I was trying epoch_ms and unix_ms with no success
<FromGitter>
<naqvis> 👍
zorp has quit [Ping timeout: 246 seconds]
<postmodern>
https://github.com/postmodern/v4l2.cr well here's my completed v4l2 crystal bindings. See examples/. Can at least dump out JPEGs from the camera. Next step is to get YUYV 422 support.
<FromGitter>
<dscottboggs_gitlab> postmodern, your link to libv4l2 site is broken
<postmodern>
fixed... figures they moved the documentation to kernel.org as i was working on the bindings
<FromGitter>
<dscottboggs_gitlab> haha
<FromGitter>
<dscottboggs_gitlab> nice! good to see some work focused on non-server linux stuff :D
<postmodern>
pretty cool when it first dumped out the JPEG from the camera. Crazy that it wasn't that hard to get metadata about the camera settings via v4l2 and crystal pretty printed the structs and all.
<FromGitter>
<naqvis> postmodern: nice work. Just a little suggestion, wouldn't it be good to implicitly call `stream_off!` once the `open` block is retruned?
<postmodern>
naqvis, that's a good question. other people's bindings embed the stream_on and stream_off under the hood
<FromGitter>
<naqvis> because its norm to have the resource manager take care of closing the contexts
<FromGitter>
<naqvis> like `File.open` etc
<postmodern>
i'll probably combine start_capturing! with stream_on!, and have a block version that calls stream_off! at the end
<postmodern>
i tried to leave things decomposed as much because i don't know all of the weird ways you can use the V4L2 API...
<FromGitter>
<naqvis> totally agree, but convention is when yielding block which opens some devices, it will take the responsibility to close that as well
<FromGitter>
<dscottboggs_gitlab> I agree with @naqvis. IMHO if the block can't clean up after itself, don't have a block overload.
<postmodern>
naqvis, yeah that's what .open does, but yeah there should be a .capture { |frame| ... } that abstract away some of the setup bits
<FromGitter>
<naqvis> 👍 ⏎ awsome job btw
duane has quit [Read error: No route to host]
<postmodern>
hmm also should extract start_capturing! into a Capturing module, doesn't make sense to have available in the Output streams
<FromGitter>
<dscottboggs_gitlab> yeah one of the tough things about bindings is figuring out how to namespace the stuff that was just given a really long name in C
<xyhuvud>
I need to do require "crystal-v4l2/v4l2" to require it btw, and even then it fails, trying to find a fract file.
<postmodern>
xyhuvud, ah yes i need to add that to make it easier to create/set V4L2Fract fields
<FromGitter>
<asterite> in the example, I think `device.video_capture.malloc_buffers!(4_u32, format.size_image)` can be replaced with `device.video_capture.malloc_buffers!(4, format.size_image)` because of autocasting
<FromGitter>
<asterite> nice work by the way!
<postmodern>
asterite, hmm never implemented Int32, UInt32 version of that method
<postmodern>
asterite, i did have to resort to using IO::Evented#wait_readable to detect when data was available, but read it from the buffers instead of from the fd. Apparently wait_readable is a semi-private API?
<FromGitter>
<asterite> postmodern: try passing 4. The compiler will automatically convert that to uint because it fits
<FromGitter>
<asterite> it's not documented anywhere though (I think)
<xyhuvud>
asterite: no, but someone *cough* pointed out that it did what was needed.
<FromGitter>
<asterite> sorry, what do you mean?
<xyhuvud>
or hmm, I guess that sentence fits the autocasting context too.
<postmodern>
xyhuvud spilled the beans on the secret API
<FromGitter>
<dscottboggs_gitlab> so the auto-casting thing is merged? we can declare `@value : Int` and it will be the propert signed int for that platform?
<FromGitter>
<dscottboggs_gitlab> What does this mean for `size_t`? Is it still going to be `Int32` at 1.0? 😦
<xyhuvud>
I'd guess that is a totally unrelated question.
<FromGitter>
<dscottboggs_gitlab> yeah probably i just asked because the issues reference each other
<FromGitter>
<dscottboggs_gitlab> I'm just very anti-signed-`size_t` haha
<FromGitter>
<asterite> that's not autocasting, that's a unified int
<FromGitter>
<dscottboggs_gitlab> oh i see
<FromGitter>
<asterite> and it's never going to happen
<FromGitter>
<dscottboggs_gitlab> Oh? I guess I should've read the issues in more detail
<FromGitter>
<asterite> or, well, at least not for 1.0
<FromGitter>
<dscottboggs_gitlab> yeah of course
<FromGitter>
<antonkatz> Hello! I've been contemplating jumping into Crystal for some time now. Can I ask a question without being banned? One of the things that keeps me from jumping in is that the development doesn't seem to be active. Like last commit was 7 days ago. How come? Is the project so mature that it doesn't need much active development? I totally understand that people are developing Crystal on their spare time, I really
<FromGitter>
... don't want to come off demanding. Sorry if I did.
<FromGitter>
<dscottboggs_gitlab> what branch are you looking at?
<FromGitter>
<Blacksmoke16> he's not wrong, last to master was a week ago
<FromGitter>
<Blacksmoke16> idk if thats fully indicative of active development tho
<FromGitter>
<dscottboggs_gitlab> that's what I was thinking...just because there aren't frequent merges to master doesn't mean there's nothing going on on feature branches. ⏎ ⏎ Idk though, he's got me curious now haha
<deimos_>
it's also holiday time in most of the world, despite covid restrictions
<FromGitter>
<Blacksmoke16> prob is a lot going on behind the scenes at manas
<FromGitter>
<Blacksmoke16> 1) 0.0 release prep/planning and such
<FromGitter>
<asterite> I think Crystal development requires donations, and donations translate into workable hours. Workable hours for this month might have ended, or work is being done in other feature branches, or maybe they don't have time for Crystal right now
<FromGitter>
<dscottboggs_gitlab> 👍
<FromGitter>
<dscottboggs_gitlab> so Crystal is only really actively developed by the core team for a few days a month?
<FromGitter>
<Blacksmoke16> but im curious as to why thats a big deal for jumping in? I would think you'd be better off looking if the current features meet your needs
<FromGitter>
<Blacksmoke16> and/or whats missing
<FromGitter>
<antonkatz> @Blacksmoke16 Just don't want to start to learn a project that might be dead, or full of bugs that will never be fixed. I've got a project in mind to build in an experimental language as a means of support it (I know that's kinda lame and not much), so I'm trying to pick a language that isn't going to leave me hanging. I look at commit frequency as a means of seeing how involved the community is in its
<FromGitter>
... development.
<FromGitter>
<antonkatz> I'm going to check out feature branches right now.
<FromGitter>
<asterite> these are all just guesses, it's best to ask in the forums
<FromGitter>
<dscottboggs_gitlab> I know it's only anecdotal but anytime I've run into an issue it's either been quickly fixed, something I did wrong, or something that I was trying to do that just inherently won't work
* FromGitter
* Blacksmoke16 hopes for an iteration on annotations after 1.0.0
<FromGitter>
<asterite> I think since new features aren't going to be added for 1.0, the only things that can happen are bugfixes and improvements
<FromGitter>
<Blacksmoke16> i have my list for ones i'd like fixed as well 😉
<FromGitter>
<dscottboggs_gitlab> I've got no money to donate so I'm not bitching 😛
<FromGitter>
<antonkatz> Thank you folks! And I'm with @dscottboggs_gitlab no money from me either, and no bitchin'
<FromGitter>
<dscottboggs_gitlab> 😂
<FromGitter>
<antonkatz> Here's another question: how suited is Crystal for functional programming?
<FromGitter>
<antonkatz> From the docs, it seems not at all, but I figure there's probably styles that people use with Crystal that are functional
<FromGitter>
<Blacksmoke16> considering its fully OOP prob not as good as one that is intended to be used like that?
<FromGitter>
<Blacksmoke16> granted im not familiar with functional programming so ill defer to someone else
f1reflyylmao has quit [Quit: bye fags]
f1refly has joined #crystal-lang
<FromGitter>
<asterite> Anton: what aspects of functional programming are you looking for?
f1refly has quit [Client Quit]
f1refly has joined #crystal-lang
<FromGitter>
<antonkatz> I like passing functions into other functions. I like piping. I like functions being a first class citizen. It's a good question. I guess my favorite is to have an immutable object go down a pipe of functions and emerge as something else on the other end. Curried functions are nice too. And functions that take other functions as arguments are really nice to create reusable code.
<FromGitter>
<asterite> Oh, none of that is comfortable to do in Crystal. Better look at Haskell
<FromGitter>
<asterite> piping is not possible, passing functions is possible but awkward and verbose, and immutability is possible
<FromGitter>
<antonkatz> Nah, I don't like Haskell. Too much brainmasturbation :)
<FromGitter>
<asterite> Then maybe Elixir? Rust? Ocaml?
postmodern has quit [Quit: Leaving]
<FromGitter>
<antonkatz> I just want to get my hands on a low-level language (at least in terms of speed). Rust seems to be suffering from one of the deadly sins: pride. Ocaml with Reason were sort of an option, but I'd rather Crystal than Reason.
<FromGitter>
<antonkatz> Elixir is not typed right? That's an issue for me
<deimos_>
i have a much more basic question, "String".match(/ring/) returns a Regex::MatchData("ring"). in theory result = "String".match(/ring/).string, so results is "ring", i can't get the string method to work
<FromGitter>
<Blacksmoke16> whats the end goal? You want to extract the match from a string?
<FromGitter>
<Blacksmoke16> thats essentially what `"string"[Regex]` does
<FromGitter>
<naqvis> deimos_ `String.match` returns Optional `Regex::MatchData`, so you would have to handle the cases when it returns nil. so to your provided sample you have to either go with `if var` or use `try` like ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f3586372aa0fd6b0ab03a32]
<FromGitter>
<Blacksmoke16> in that case, the latter would raise if it doesnt match
<FromGitter>
<Blacksmoke16> but can use `[]?` overload for similar functionality
<FromGitter>
<dscottboggs_gitlab> 👍
<deimos_>
i need to re-read handling Nil, because in the playground "String".match(/ring/).string generates a compiler error for "no method string for Nil"
<oprypin>
yes
<deimos_>
sorry, "undefined method"
<deimos_>
i learned crystal last week, so, i'm still learning
<FromGitter>
<Blacksmoke16> since `.match` can return a `Regex::MatchData` or `Nil`
<FromGitter>
<Blacksmoke16> `string` method only exists on the former, so the error is preventing an error that would happen at runtime in ruby or js
<FromGitter>
<Blacksmoke16> i.e. that is detected at compile time
<FromGitter>
<Blacksmoke16> saying "hey you need to handle the case where a match isn't found"
<deimos_>
got it, thanks
<deimos_>
so i could also do: if res = "String".match(/ring/)
<deimos_>
res.string
<oprypin>
ye
<FromGitter>
<Blacksmoke16> yes
sorcus has quit [Ping timeout: 240 seconds]
sorcus has joined #crystal-lang
Rounin has quit [Remote host closed the connection]
<FromGitter>
<j8r> @antonkatz the best is likely try a little project yourself. The language is not dead, sometimes there are slow downs, and sometimes a lot of activity
<FromGitter>
<j8r> You can see in the Pulse tab on GitHub
<FromGitter>
<j8r> Also, I guess some guys are taking vacations, cannot help
<oprypin>
crystal formatter is so bad omg
<FromGitter>
<Blacksmoke16> oh?
<oprypin>
how can you just change whitespace for no reason
<oprypin>
i change 1 Hash item
<oprypin>
**diff of 20 lines**
<FromGitter>
<dscottboggs_gitlab> yeah it could be better IMO ⏎ ⏎ I wish there was hanging indent for method args without parens
<FromGitter>
<juozasg> are crystal programmers succesfully using vscode crystal-id with scry?