ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Crystal 0.23.1 | Fund Crystal's development: | GH: | Docs: | API: | Gitter:
<Groogy> Papierkorb you know how crystal is with static libraries? should work right?
<crystal-gh> [crystal] MakeNowJust opened pull request #4837: Implement exhaustiveness check (master...feature/crystal/exhaustiveness-check)
FromGitter has quit [Ping timeout: 246 seconds]
oprypin has quit [Read error: Connection reset by peer]
BlaXpirit has joined #crystal-lang
BlaXpirit is now known as oprypin
FromGitter has joined #crystal-lang
FromGitter has quit [Ping timeout: 246 seconds]
<Papierkorb> Groogy: Works great
FromGitter has joined #crystal-lang
ragmaanir has quit [Quit: Leaving]
<crystal-gh> [crystal] jwaldrip opened pull request #4838: YAML fixes (master...yaml-spec)
<FromGitter> <codenoid> ^ silly mistake, miss `require modest`
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
sz0 has quit []
tatey has quit [K-Lined]
swav has quit [K-Lined]
tilpner has quit [K-Lined]
yopp has quit [K-Lined]
cyberarm has quit [K-Lined]
dom96 has quit [K-Lined]
stnly has quit [K-Lined]
DTZUZO has quit [K-Lined]
pabs has quit [K-Lined]
vifino has quit [K-Lined]
baweaver has quit [K-Lined]
daemonwrangler has quit [K-Lined]
alibby has quit [K-Lined]
ephemera_ has quit [K-Lined]
justinmcp has quit [K-Lined]
go|dfish has quit [K-Lined]
Papierkorb has quit [K-Lined]
ChickeNES has quit [K-Lined]
badeball has quit [K-Lined]
shelvacu has quit [K-Lined]
literal has quit [K-Lined]
txdv has quit [K-Lined]
early has quit [K-Lined]
mjblack has quit [K-Lined]
bmcginty has quit [K-Lined]
bazaar has quit [K-Lined]
kali___ has quit [K-Lined]
oz has quit [K-Lined]
jfontan has quit [K-Lined]
wmoxam has quit [K-Lined]
Poeticode has quit [K-Lined]
dzv has quit [K-Lined]
p0p0pr37 has quit [K-Lined]
gewo has quit [K-Lined]
RX14 has quit [K-Lined]
salvor has quit [K-Lined]
g3funk has quit [K-Lined]
adam12 has quit [K-Lined]
lhz has quit [K-Lined]
tliff has quit [K-Lined]
Yxhuvud has quit [K-Lined]
dostoyevsky has quit [K-Lined]
kubaxvx__ has quit [K-Lined]
thews has quit [K-Lined]
oprypin has quit [K-Lined]
Groogy has quit [K-Lined]
hightower3 has quit [K-Lined]
Philpax_ has quit [K-Lined]
havenwood has quit [K-Lined]
foca has quit [K-Lined]
pleiosaur has quit [K-Lined]
minus has quit [K-Lined]
binBASH has quit [K-Lined]
mrus has quit [K-Lined]
fiete has quit [K-Lined]
oz` has joined #crystal-lang
hightower2 has joined #crystal-lang
Philpax has joined #crystal-lang
binBASH has joined #crystal-lang
Papierkorb has joined #crystal-lang
early has joined #crystal-lang
fiete has joined #crystal-lang
mjblack has joined #crystal-lang
ephemera_ has joined #crystal-lang
foca has joined #crystal-lang
Yxhuvud has joined #crystal-lang
yopp has joined #crystal-lang
alibby has joined #crystal-lang
oz` is now known as 59NAAXCXJ
swav has joined #crystal-lang
RX14 has joined #crystal-lang
gewo has joined #crystal-lang
dzv has joined #crystal-lang
g3funk has joined #crystal-lang
salvor has joined #crystal-lang
watzon has quit [Ping timeout: 240 seconds]
ChickeNES has joined #crystal-lang
dzv is now known as Guest34371
oprypin has joined #crystal-lang
jfontan has joined #crystal-lang
thelonelyghost has quit [Ping timeout: 240 seconds]
adam has joined #crystal-lang
dom96 has joined #crystal-lang
byteflame has quit [Ping timeout: 264 seconds]
kubaxvx__ has joined #crystal-lang
lhz has joined #crystal-lang
jplatte has quit [Ping timeout: 246 seconds]
baweaver has joined #crystal-lang
braidn[m] has quit [Ping timeout: 240 seconds]
DTZUZO_ has joined #crystal-lang
sija[m] has quit [Ping timeout: 246 seconds]
vegai has quit [Ping timeout: 255 seconds]
TheGillies has quit [Ping timeout: 246 seconds]
adam is now known as Guest70824
Renich[m] has quit [Ping timeout: 255 seconds]
rizo[m] has quit [Read error: Connection reset by peer]
olbat[m] has quit [Read error: Connection reset by peer]
thews has joined #crystal-lang
tliff has joined #crystal-lang
baweaver is now known as Guest10646
daemonwrangler has joined #crystal-lang
Poeticode has joined #crystal-lang
thews has quit [Changing host]
thews has joined #crystal-lang
toxedvirus has joined #crystal-lang
mrus has joined #crystal-lang
minus has joined #crystal-lang
vifino has joined #crystal-lang
go|dfish1 has joined #crystal-lang
minus is now known as Guest61384
shelvacu has joined #crystal-lang
tatey has joined #crystal-lang
olbat[m] has joined #crystal-lang
tilpner has joined #crystal-lang
cyberarm has joined #crystal-lang
havenwood has joined #crystal-lang
havenwood has joined #crystal-lang
justinmcp has joined #crystal-lang
Groogy has joined #crystal-lang
bmcginty has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<bmcginty> Has anyone here gotten the docker image mentioned in #3582 working? I can't get lbguilherme/crystal or txe/crystal-win to compile (either a note on dbg segments for llvm 3.9, or an error on gc not being installed).
vegai has joined #crystal-lang
byteflame has joined #crystal-lang
braidn[m] has joined #crystal-lang
thelonelyghost has joined #crystal-lang
jplatte has joined #crystal-lang
TheGillies has joined #crystal-lang
rizo[m] has joined #crystal-lang
Renich[m] has joined #crystal-lang
watzon has joined #crystal-lang
sija[m] has joined #crystal-lang
thews has quit [Ping timeout: 248 seconds]
thews has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
kochev has joined #crystal-lang
thews has quit [Ping timeout: 255 seconds]
stnly has joined #crystal-lang
thews has joined #crystal-lang
thews has joined #crystal-lang
thews has quit [Changing host]
thews has quit [Ping timeout: 240 seconds]
thews has joined #crystal-lang
<FromGitter> <r3bo0t> ⏎ This shows we already started building integrations for different AWS services. I have a question here. What is the best way of implementing the same, creating it from scratch or using JNI or C-binding for existing java/c library for the same.
<FromGitter> <r3bo0t> Given those libraries are already matured enough
kochev has quit [Ping timeout: 240 seconds]
<oprypin> ragmaanir, no mistake there
toxedvirus is now known as txdv
oprypin has quit [Quit: Bye]
oprypin has joined #crystal-lang
oprypin has quit [Remote host closed the connection]
<FromGitter> <oprypin> and it seems like this zero? method is not used anywhere
<FromGitter> <oprypin> the mistake could be there if it doesn't detect that 0.0e0 is zero
flaviodesousa has joined #crystal-lang
mark_66 has joined #crystal-lang
Guest61384 is now known as minus
<FromGitter> <bew> @oprypin what does it do when using a symbol as the case expression?
Guest10646 has quit [Ping timeout: 260 seconds]
baweaver has joined #crystal-lang
baweaver is now known as Guest43531
kochev has joined #crystal-lang
<FromGitter> <bew> @oprypin I think it's a mistake, using `case :kind` will never match something else then `:kind`..
kochev has quit [Ping timeout: 240 seconds]
<FromGitter> <bararchy> I really need .`find_all` :(
<FromGitter> <bararchy> as in `Array#find_all`
<FromGitter> <bew> as in `Array#select` ?
<FromGitter> <bararchy> Oh
<FromGitter> <bararchy> Yeha
<FromGitter> <bararchy> lol thanks :)
<FromGitter> <bew> ;)
pabs has joined #crystal-lang
kochev has joined #crystal-lang
bazaar has joined #crystal-lang
dostoyevsky has joined #crystal-lang
bmcginty has quit [Ping timeout: 260 seconds]
bmcginty has joined #crystal-lang
olbat[m] has quit [Ping timeout: 255 seconds]
jokke has quit [Ping timeout: 255 seconds]
olbat[m] has joined #crystal-lang
jokke has joined #crystal-lang
DTZUZO_ has quit [Ping timeout: 264 seconds]
<FromGitter> <faustinoaq> > The most important thing in the programming language is the ⏎ > name. A language will not succeed without a good name. I ⏎ > have recently invented a very good name and now I am ⏎ > looking for a suitable language. ⏎ > -- D. E. Knuth ... []
<FromGitter> <krypton97> Well, something shorter was better I guess. Take a look at c, rust, go, ruby, most 4 letters
<FromGitter> <krypton97> Don't forget node as well
<FromGitter> <bararchy> Crys
<FromGitter> <bararchy> XD
<FromGitter> <faustinoaq> Also I think the name and logo must have a meaning, not just "because it's looks nice", but because a meaning. ⏎ ⏎ I propose a community meaning for Crystal logo and name: ⏎ ⏎ *Crystal logo:* icosahedron (polyhedron with 20 faces) represent the body of a strong black and precious crystal. ... []
<FromGitter> <Qwerp-Derp> This is getting to "fan-fic" territory :P I'm personally not sure if we should extrapolate meanings from possibly meaningless choices
<FromGitter> <Qwerp-Derp> Keyword being "possibly"
<FromGitter> <faustinoaq> 😅 just saying
w-p has joined #crystal-lang
DTZUZO_ has joined #crystal-lang
<FromGitter> <Qwerp-Derp> Yeah
<FromGitter> <Qwerp-Derp> Still can't figure out libgen...
<Groogy> sometimes I just hate myself
<FromGitter> <bararchy> ?
<Groogy> somehow using GLEW to reload the opengl functions isn't needed? At least not on Linux and I have no idea why
<Groogy> I was sure that was the problem I had before I went on vacation. But it appears an int that had to be transformed to a Void* for the OpenGL interface was a literal reference to a local variable and was what fucked everything up....
<Groogy> I've spent way too much time on this ;_;
<Groogy> but there we go, 4.5 OpenGL running in Crystal
<FromGitter> <bew> beautiful :)
<Groogy> TLDR; I made the graphics card read random memory when trying to tell the shader to render the vertices and that made it output no error for me and put me on sooo many detours to find out what was wrong
<FromGitter> <Qwerp-Derp> Groogy: Repo?
<Groogy> but if you mean the framework for working with so you don't need to handle opengl by yourself
<Groogy> Vertex array objects and shader code is going to come up soon but here's an example of usage
<FromGitter> <akzhan> What is the best way to distinquish between Key absence and null value in JSON.mapping?
<FromGitter> <akzhan> Now I did it with:
olbat has joined #crystal-lang
Groogy has quit [Ping timeout: 260 seconds]
<crystal-gh> [crystal] MakeNowJust opened pull request #4841: Prevent parsing block follow '---' or '===' as setext headers (master...fix/markdown/down-setext-header-priority)
w-p has quit [Ping timeout: 240 seconds]
<FromGitter> <akzhan> just opened #4840 isuue to siscuss about.
Groogy has joined #crystal-lang
kochev has quit [Remote host closed the connection]
hightower2 has quit [Ping timeout: 260 seconds]
office_boy has joined #crystal-lang
<office_boy> Where can I find a list of all reserved words?
<RX14> i don't think there's a list
<RX14> plus it probably depends on context
<Groogy> what would replicate a "replace" method on a String? i.e replace a range in a string with another string (not nessecairly same size) without having to split and put together manually?
<RX14> Groogy, String#sub
<RX14> takes a range and a replacement
<Groogy> thx
rohitpaulk has joined #crystal-lang
office_boy has quit [Read error: Connection timed out]
office_boy has joined #crystal-lang
office_boy has quit [Remote host closed the connection]
wmoxam has joined #crystal-lang
wmoxam has quit [Client Quit]
wmoxam has joined #crystal-lang
alibby has left #crystal-lang [#crystal-lang]
rohitpaulk has quit [Ping timeout: 255 seconds]
rohitpaulk has joined #crystal-lang
Guest70824 is now known as adam12
snsei has joined #crystal-lang
<FromGitter> <alex-lairan> Hello, there is a way to bind C++ lib to crystal? I see many way to do with C, but not with C++
<Groogy> No you would have to create an intermediary lib with a C interface I think, like CSFML is to SFML
59NAAXCXJ is now known as oz
<Papierkorb> I'm working on a generator for something similar alex-lairan. Though binding C++ completely is impossible, but many things can be bound with enough creativity.
mark_66 has quit [Remote host closed the connection]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <alex-lairan> Okay, so I need to bind with a C lib before, exemple for I need to create a CNazara?
Guest43531 is now known as baweaver
baweaver is now known as Guest8576
bastelfreak has quit [Ping timeout: 246 seconds]
rohitpaulk has quit [Ping timeout: 255 seconds]
vegai has left #crystal-lang ["User left"]
Guest8576 is now known as lemur
lemur has quit [Changing host]
lemur has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<Groogy> no idea what Nazara is but yeah you would need to if it is written in C++
lemur is now known as baweaver_
<Papierkorb> > error instantiating ->self.height_for_width
rohitpaulk has quit [Ping timeout: 240 seconds]
<Papierkorb> Looks like I'm benchmarking the compiler again. Can't reproduce it outside the environment it fails yet though >_>
vegai_ has joined #crystal-lang
<crystal-gh> [crystal] RX14 closed pull request #4841: Prevent parsing block follow '---' or '===' as setext headers (master...fix/markdown/down-setext-header-priority)
vegai_ is now known as vegai
<Groogy> "instance variable '@shader' of GameState must be Boleite::Shader+:Class, not Boleite::Private::GLFWOpenGLShader"
<Groogy> wat? but GLFWOpenGLShader is inheriting from Shader?
<Papierkorb> Groogy: looks like an issue on the line defining `@shader`
<Groogy> oh I'm dumb, I accidentally wrote @shader = Boleite::Shader instead of :
<Groogy> so it got the type of the class
<FromGitter> <faustinoaq> > just opened #4840 isuue to siscuss about. ⏎ ⏎ @akzhan I think you should open a stackoverflow question instead ⏎ ⏎ Maybe you need something like this: ... []
rohitpaulk has joined #crystal-lang
go|dfish1 is now known as go|dfish
<travis-ci> crystal-lang/crystal#d0edce0 (master - Prevent parsing block follow '---' or '===' as setext headers (#4841)): The build passed.
<watzon> Something that I havent thought about until now. Does Crystal have any way of doing interfaces? For instance I'd like to be able to accept as an argument anything which has the method `to_s` which I'd normally do by making a `IStringable` interface or something
<RX14> not in the way you want
<watzon> What would be the Crystal way of doing that?
<RX14> you can use modules as interfaces by making every member abstract
<RX14> but obviously you have to include those
<RX14> well every object has to_s defined first of all
<RX14> so you don't need a type restriction
<watzon> I guess that's true, but it makes strongly typing something like that difficult
<RX14> and even if it didn't you'd just leave the type restriction off and call to_s
<RX14> there's no need to put a type restriction on everything
<watzon> I like including types sometimes for readablilty purposes
<watzon> I guess `to_s` was a bad example
<RX14> yes for readability
<RX14> but here it's not readable really
<FromGitter> <akzhan> @faustinoaq no, I need presence marker. my actions will depend on its truth. it’s ok to have no key.-value pair
<RX14> watzon, besides you'd need to include Stringable in every thing you wanted to pass in
<RX14> this isn't go
<RX14> our interfaces don't automatically apply
<Yxhuvud> I'd just don't bother and duck type the whole problem.
<RX14> that's what i said
<watzon> I guess that's what I'll do
<RX14> i just wanted to cover some other points like to_s belongs on everything and interfaces don't apply automatically
<RX14> the latter being obviated by buck typing
<RX14> also modules with abstract methods can approximate java interfaces
<FromGitter> <faustinoaq> *Offtopic:* <RX14> What IRC client do you use? 😅
<FromGitter> <faustinoaq> > no, I need presence marker. my actions will depend on its truth. it’s ok to have no key.-value pair ⏎ ⏎ @akzhan ok 👍
<RX14> @faustinoaq hexchat
<FromGitter> <faustinoaq> Thanks you! 👍
<Groogy> and now shaders work as well
<Papierkorb> Groogy: Wasn't it possible to use GLEW with Qt in C++ land?
<Groogy> yeah got it to work without the glew magic
<Groogy> what I did wrong was that I by accident gave a pointer to a local variable to the offset on vertex attributes
<Groogy> which for legacy reasons wants a void*
<FromGitter> <faustinoaq> (( ⏎ ⏎ *Groogy* Can you draw something like Crystal logo in libGL? would be amazing 😄 ⏎ ⏎ []
<Papierkorb> Groogy: Well, besides the undefined behaviour according to C, you can use a more sensible pointer type in your fun bindings if you want
<Groogy> as I stepped through each line of code and verifying the input when I was doing the GLEW magic I realized that number when passed to OpenGL was way wrong
<Groogy> @faustinoaq I can draw whatever I want ^^
<FromGitter> <faustinoaq> 😆 👍
<Papierkorb> But can it run Crysis?
<Groogy> lol
<Groogy> but yeah korb the interface is a Void* but what it really wants is just an int which tells you how many elements to jump
<Groogy> to find the next entry in the vertex stream
<Papierkorb> The Void* is actually an Int32 without a pointer?
<Groogy> yeah
<Papierkorb> .. who came up with that
<Groogy> It originally was a pointer to where in memory the next entry was I think
<Groogy> and just like C++ standards, changing stuff is scaaaaary
<Papierkorb> it was probably meant to be a ptrdiff_t or similar
<Groogy> probably
<FromGitter> <faustinoaq> > But can it run Crysis? ⏎ ⏎ Lol, as `I can draw whatever I want` I just think it require a LOT of work ⏎ ⏎ better and simple would be a Crystal logo made in Crystal language using libGL ... []
<FromGitter> <faustinoaq> 😅 just saying
<Groogy> Well yeah of course it's work but the Crystal logo is pretty simple and I could hardcode the vertices manually
<Groogy> also of course it is all done in Crystal
<Groogy> or well not the shading language of course since the graphics drivers have no idea how to interpret crystal
<FromGitter> <faustinoaq> yeah, I tried to draw crystal animation unsuccessfully using
<Groogy> what did you get stuck on?
<Papierkorb> By the way, what's the license of the Crystal logo? Can it be re-used in a "mashup" logo?
<FromGitter> <LuckyChicken91_twitter>
<Groogy> I would guess it is the same license like the rest of the repo?
<FromGitter> <LuckyChicken91_twitter> heres some info about this
<Papierkorb> > Do NOT Change their colors, dimensions or add your own text.
<Papierkorb> >_>
<Groogy> also under do not "Integrate your own logo with Crystal logos."
<FromGitter> <faustinoaq> 😟
<Groogy> but I mean if you do a professional project you can probably ask for permission
<Papierkorb> lul professional. Will ask either way though when I got around drawing something in GIMP
<Groogy> since the devs probably want more visibility
<Groogy> well I added "professional" as in not "hey my random stuff here"
<FromGitter> <faustinoaq> yeah, I think so ⏎ ⏎ > what did you get stuck on? ⏎ ⏎ I just need to learn more about OpenGL []
<FromGitter> <LuckyChicken91_twitter> is the address from manas tech, right?
<travis-ci> crystal-lang/crystal#d0edce0 (master - Prevent parsing block follow '---' or '===' as setext headers (#4841)): The build passed.
<FromGitter> <faustinoaq> yes, for professional consulting or
<FromGitter> <fridgerator> there is also
<FromGitter> <faustinoaq> 👍
<FromGitter> <G4BB3R> How you folks make input validations?
<FromGitter> <G4BB3R> Lot of ifs seems not the ideal way xD
<FromGitter> <fridgerator> using kemal with no ORM ?
<FromGitter> <fridgerator> you'll have to write your own if thats the case
<travis-ci> crystal-lang/crystal#d0edce0 (master - Prevent parsing block follow '---' or '===' as setext headers (#4841)): The build passed.
<FromGitter> <G4BB3R> Yes. Kemal + Mysql driver only
<FromGitter> <G4BB3R> Is it ok to write my own or too much waste of time? Do you recommend any ORM?
<FromGitter> <fridgerator> Its up to you really, you could write a separate module and implement some basic rules
<FromGitter> <fridgerator> Or you could use an ORM like crecto or
<FromGitter> <G4BB3R> I had some problems using Crecto, it would freeze when trying to insert/read data ⏎ But I will try to build some basic rules by my own.. thanks :D
<FromGitter> <fridgerator> do you have any examples of crecto freezing?
<FromGitter> <LuckyChicken91_twitter> anybody here
<FromGitter> <fridgerator> yeah
bitmapper has joined #crystal-lang
<FromGitter> <bitmappergit> hi
bitmapper has quit [Client Quit]
<FromGitter> <fridgerator> hi
<FromGitter> <bitmappergit> i'm new to crystal and i was wondering if i could have some help
<FromGitter> <fridgerator> sure, I can try
<FromGitter> <johnjansen> so can i
<FromGitter> <johnjansen> but @fridgerator is better ;-)
<FromGitter> <bitmappergit> i am writing a program and i need to have 3 lists of numbers that can change size to match the amount on numbers
<FromGitter> <johnjansen> Arrays?
<FromGitter> <bitmappergit> i thought arrays were a fixed size
<FromGitter> <johnjansen> that would be a StaticArray
baweaver_ is now known as baweaver
sz0 has joined #crystal-lang
alex`` has joined #crystal-lang
<alex``> Hi
<FromGitter> <bitmappergit> the docs don't really tell you much of anything
<FromGitter> <bitmappergit> just some basic stuff
<alex``> How about creating fresh new project (app, lib) in docs/ ?
<FromGitter> <johnjansen> huh? dont think i agree with that … what do you need to know
<Papierkorb> > An Array is implemented using an internal buffer of some capacity and is reallocated when elements are pushed to it when more capacity is needed. This is normally known as a dynamic array.
<FromGitter> <bitmappergit> it's not that
<alex``> Language is well documented but I have the feel it miss some intro for project creation
<alex``> linking with yards
<FromGitter> <johnjansen> `crystal init [app|lib] your_project_name`
<alex``> and a fromRubytoCrystal
<crystal-gh> [crystal] akzhan opened pull request #4843: YAML | JSON.mapping presence: true option. (master...json-yaml-key-presence-option)
<FromGitter> <elorest> Is there a way to pass a combination of named arguments and named tuple merged into another method.
<Papierkorb> elorest, tried putting the **opt in front?
<RX14> that works
<RX14> i just tried it
<FromGitter> <elorest> Yep. Thanks.
rohitpaulk has quit [Ping timeout: 255 seconds]
<FromGitter> <bitmappergit> haha i crashed crystal trying to figure out how everything works
<FromGitter> <elorest> You crashed crystal or your code won’t compile? @bitmappergit
<FromGitter> <bitmappergit> i got this
<FromGitter> <oprypin> ok you didn't overstate then
<FromGitter> <elorest> interesting. Is that the top of the error?
<FromGitter> <bitmappergit> that's the whole error
<FromGitter> <elorest> Could be an infinite loop or something?
<FromGitter> <elorest> or too much recursion?
<Papierkorb> Version, Platform, Source code used please.
<FromGitter> <bitmappergit> just wanna warn this is really bad code probably
<FromGitter> <bitmappergit> here's a pic of all of that
<Papierkorb> Please post a proper paste, e.g. over at
<FromGitter> <bitmappergit> k
<Papierkorb> It shouldn't crash, but also, your code doesn't make any sense
<FromGitter> <bitmappergit> i know
<FromGitter> <bitmappergit> i know
<FromGitter> <fridgerator> `def` needs a name to give the method
<FromGitter> <bitmappergit> how would i do that
<FromGitter> <fridgerator> ```code paste, see link``` []
<FromGitter> <johnjansen> @bitmappergit what language are you coming from?
<FromGitter> <bitmappergit> python
snsei has quit [Remote host closed the connection]
<FromGitter> <johnjansen> ok so, would you do ⏎ ⏎ ```def array(i): ⏎ pass``` ⏎ ⏎ in python? probably not right ... []
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
<FromGitter> <bitmappergit> i learned python a long time ago and don't remember most of it
snsei has quit [Ping timeout: 240 seconds]
oprypin has joined #crystal-lang
<FromGitter> <johnjansen> ahh ok, so you are rusty … thats fine! you should probably do a little ruby tutorial first (since there are plenty of those) then you will need to check each method and class you intend to use, since they vary a little in some places between ruby and crystal … once you have a handle on it, its pretty intuitive and very satisfying to use
<FromGitter> <johnjansen> others are welcome to contradict me BTW :-)
<Papierkorb> ^
<Groogy> anyone know if there is a FreeImage port for crystal?
<Groogy> I can't seem to find one
<FromGitter> <bitmappergit> how would i push a number to that array
<FromGitter> <johnjansen> ```a = [] of String ⏎ a << “A String to add"``` []
<FromGitter> <johnjansen>
<FromGitter> <bitmappergit> would i use NameOfArray.last to get the last item in an array
<FromGitter> <johnjansen> thats one way, yes … that doesnt pop it though
<FromGitter> <bitmappergit> so how would i print the last item in an array
<Papierkorb> `puts array.last`
<FromGitter> <bew> you can use the method `puts`, followed by what you want to print (like Papierkorb just demonstrated)
<FromGitter> <bitmappergit> it crashes it
<FromGitter> <bew> what's the error?
<FromGitter> <bitmappergit> Index out of bounds (IndexError) ⏎ 0x445d4b: *CallStack::unwind:Array(Pointer(Void)) at ?? ⏎ 0x456a18: last at /usr/lib/crystal/ 319:12 ⏎ 0x434ada: __crystal_main at /home/bitmapper/vscode/ 10:10 ⏎ 0x444009: main at /usr/lib/crystal/ 12:15 ... []
<FromGitter> <bew> do you have something in the array?
<Papierkorb> Works as expected.
<Papierkorb> bitmappergit, Crystal values type-safety. If you have an empty array of Strings (or any type), and you want the last element of it .. while there is still none in existence .. it will raise an exception. If you want to say "give me the last one, if any", use `#last?` (note the question mark), which is what you may be more familiar with from other scripting languages
<FromGitter> <oprypin> Papierkorb, no, Python is even stricter
<Papierkorb> No idea about python
<FromGitter> <oprypin> doesn't even have any equivalent of those question mark methods
<FromGitter> <oprypin> expression? just catch it
<FromGitter> <oprypin> meant exception not expression
<FromGitter> <bew> really good Papierkorb!
<Papierkorb> Using classes that are multiple-inheritance in C++ works too, including `#as_X` converters
<FromGitter> <bew> I'm wondering how you did the `QT::Application.exec`, I guess qt has it's own main loop, how did you made Crystal work with that?
snsei has joined #crystal-lang
<Papierkorb> Right now, that call completely blocks. Any crystal code that is to be run, right now, is only run when it's somehow called from the Qt world - Which is exactly how it works in C++/Qt.
<Papierkorb> That'll change next.
<Papierkorb> Well, that call will still block, but only a single Fiber.
<Papierkorb> bew, ^
<FromGitter> <bew> ok I think I see what you mean
<FromGitter> <bew> I've been looking at Wayland recently, and discovered that Wayland server has its own main loop too, so I'm quite stuck right now (I dunno how crystal main loop works ATM)
snsei has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> (well more about the scheduler of Crystal, and how it could be (maybe?) "inserted" in a C main loop)
<Papierkorb> bew, usually, such loops actually rely on a file descriptor. If so, it's quite easy to integrate
<Papierkorb> For more complex systems, not so easy, but usually doable by implementing an interface provided by the library
<FromGitter> <bew> so it's possible, cool ;) I've seen some methods to add some FD watchers, it's probably that
literal has joined #crystal-lang
<oprypin> Papierkorb, why won't you publish it omg
<Papierkorb> Dude I was waiting for that remark, what took you so long?
<oprypin> was afk
<oprypin> Papierkorb, you dont need QMainWindow, just show QWidget - no Qt noise then
<Papierkorb> oprypin: main window offers menu's and stuff, also takes care of proper system integration later on
<oprypin> no, just menus and stuff
<Papierkorb> It should also set a hint that it's the main window
<Papierkorb> As QDialog's do that they're (maybe modal) dialogs
<oprypin> .: Cry.../Qt :. - yeah I cry because you dont publish it
<Papierkorb> Oh that's just KWin being nice and shortening the title at an surprisingly sensible location
<Papierkorb> Mh the shard will be named `qt5`, but the module is `Qt`. Ah well. Typing Qt5 is too tedious, and not having the '5' suffix will be a bad idea once Qt6 arrives
<oprypin> Papierkorb, nah that's perfectly fine. well maybe not just qt5 because it's not qt
<FromGitter> <bew> `QtFive` ? *i'm already out*
<oprypin> regarding "has_height_for_width" in my lib i ended up turning these into "height_for_width?" or generally use question mark and remove prefix for methods starting with "get, is, has" accepting no arguments
<Papierkorb> oprypin: many bindings for qt just have the name qt. I mean I could ask in #Qt or via mail, but I really don't see the issue with using that name. If someone doesn't like it, and is in the position of forcing me to do so too, one can change it.
<Papierkorb> oprypin: Oh yeah, that's already in, just not for `has_`
<oprypin> yeah you have other things like that in the example, im just generalizing
<oprypin> re naming: that's not even my main concern, i'm just saying it's not clear what your repository is about. is it a fork of qt?
<Papierkorb> That becomes clear once you see the headline of the README
<oprypin> oh well, don't let this stop you from publishing :p
alex`` has quit [Ping timeout: 255 seconds]
<FromGitter> <faustinoaq> @bitmappergit What crystal extension are you using in VSCode? this extension ( checks your code on save `ctrl+s`, so you can learn while you're coding.
<FromGitter> <faustinoaq> *Papierkorb:* your Qt experiment looks amazing, I can't wait to use it in my KDE desktop. 👍
<FromGitter> <bitmappergit> i'm using that one
<FromGitter> <faustinoaq> And Can you see errors? ⏎ ⏎ ((
<FromGitter> <bitmappergit> no
<FromGitter> <faustinoaq> mmm... are you using the latest version of the extension?
<FromGitter> <faustinoaq> or do you have other crystal extension installed?
<Papierkorb> faustinoaq, also a KDE user - on the long run, maybe add KDE libs/plasma stuff, for integration in the only truly usable DE ;P
<FromGitter> <bitmappergit> it's the only one
<FromGitter> <faustinoaq> 👍 I agree.
<FromGitter> <bitmappergit> i use heavily customized openbox
<Papierkorb> Hmpf. Ah that sucks, but I think I'll let the idea of the logo mashup slide. Don't feel like messing with Digia >_> They'd probably hunt me if I were to make even a homage to the Qt logo. Meh.
<FromGitter> <faustinoaq> @bitmappergit I used to use OpenBox on Crunch-bang #!, but now I'm happy with KDE. ⏎ ⏎ *Papierkorb:* well, Qt is cross platform,
<FromGitter> <bitmappergit> what distro do you guys use
<FromGitter> <faustinoaq> I use Manjaro (main), CentOS (server) and Alpine (vm).
<FromGitter> <bitmappergit> i used manjaro
<FromGitter> <bitmappergit> but i just switched to plain arch
<FromGitter> <faustinoaq> 👍 I tried ArchLinux but updates are too frequent 😅
<FromGitter> <bew> Arch for me!
<FromGitter> <bew> How would can I do a binding to: `extern const struct wl_interface wl_compositor_interface;`
<oprypin> at least you realize that manjaro messes with the updates
<oprypin> bew, that would probably be $wl_compositor_interface : Wl_interface
<FromGitter> <bitmappergit> i update once a month rip
<FromGitter> <bew> and how do you define Wl_interface (it's an opaque structure)
<oprypin> bew, if it's opaque it can only be used by pointer. that does not make sense
<oprypin> give context (link to source?)
<oprypin> well actually at least on windows extern stuff is explicitly used by pointer, so maybe on linux it's implicitly used by pointer
<FromGitter> <bew> yeah I'm not sure about the opaque-ness, I'm trying to find it right now.. (too much headers)
w-p has joined #crystal-lang
<oprypin> i dunno, try type Wl_interface = Void lol
<FromGitter> <bew> oprypin I did that first, but then I need to get a pointer to this variable, and crystal doesn't let me do that
<oprypin> could easily be a limitation in crystal, because this is not a well understood topic
<oprypin> because now that i think about it, of course the extern stuff has to use a pointer behind the scenes
<oprypin> and everything hides that detail from you, and crystal forgot to give you the ability to access the pointer
<FromGitter> <bew> hum, it kinda makes sense I think
<oprypin> bew, what makes sense
<FromGitter> <bew> that it could be a limitation of crystal, and your explaination of why you think I should be able to get a pointer
<oprypin> this is worth bringing up in an issue, but dont expect it to get attention any time soon
<FromGitter> <bew> I'll do! It won't block me as I've finally found the struct implementation, but I'll still open an issue on that.
<FromGitter> <bew> looks like the problem is a little bigger:
<FromGitter> <bew> seems that I can't take the address of any extern value
<FromGitter> <oprypin> well sure, i didn't expect it to be any different
<FromGitter> <bew> oh ok, then I didn't properly understood what you meant before
<Papierkorb> bew, 1) Missing feature 2) Build a small C wrapper which simply returns the pointer to that structure
<FromGitter> <oprypin> if it's const, can't u just copy it and use a pointer of that
<FromGitter> <bitmappergit> i updated vscode
<FromGitter> <bitmappergit> still no error checking
<FromGitter> <oprypin> @bew what do you think
<FromGitter> <bew> @oprypin it did the trick
<FromGitter> <oprypin> oh cool
<FromGitter> <bew> I used a constant for that
<FromGitter> <faustinoaq> @bitmappergit Can you show me your development tools output?
<FromGitter> <faustinoaq> I just receive some twitter ads today and they remember me crystal 😆
<FromGitter> <bew> that headline would be best if their solution was written in crystall :)
<FromGitter> <faustinoaq> Maybe twitter developers don't know Crystal yet 😅
<crystal-gh> [crystal] bew opened pull request #4846: Remove dead line of code (master...pointer-useless-loc)
<FromGitter> <bitmappergit> yay
<FromGitter> <bitmappergit> i finally got it working
<FromGitter> <bitmappergit> made a program that does the collatz conjecture equasion