These are chat archives for rust-lang/rust

5th
May 2018
Maciej Gorywoda
@makingthematrix
May 05 2018 09:17
well, it worked :) although if the values are not i32, but some generic T, I have to clone them. It's also the first time I used unsafe to avoid using clone twice. Ahh, progress.
Maciej Gorywoda
@makingthematrix
May 05 2018 09:32
wow. thank you. nice.
Maciej Gorywoda
@makingthematrix
May 05 2018 09:39
@wafflespeanut I went back to the original idea of writing my own iterator from scratch and ended up with something a bit more complicated: https://play.rust-lang.org/?gist=87b6a57131900a2ac157707b63cb58a2&version=stable&mode=debug
Ravi Shankar
@wafflespeanut
May 05 2018 09:39
woah
@makingthematrix You can achieve that with safe code btw
Maciej Gorywoda
@makingthematrix
May 05 2018 09:45
right, if let. I have read about it, but didn't use yet.
Ravi Shankar
@wafflespeanut
May 05 2018 09:46
Pattern matching is awesome! You should try it!
Maciej Gorywoda
@makingthematrix
May 05 2018 09:46
so, what do you think? is there any reason to implement an iterator from scratch like this?
yeah, I come from the Scala background, so it's not a problem for me. We've got a lot of pattern matching in Scala :)
Ravi Shankar
@wafflespeanut
May 05 2018 09:46
Depends on the use case
For example, you can implement IntoIterator for your struct and make it an iterable
Then, you can use it directly in for loop
Maciej Gorywoda
@makingthematrix
May 05 2018 09:51
ok, will do
this struct is for a small game AI library. I decided that in order to learn Rust I'll try to write a small project and learn along the way. There will be a lot of operations on sets of identifiers, and maps where the identifiers are the keys. And the identifiers are all small usizes, so I thought I could implement my own simple sets and maps which will take advantage of that and will be faster than the standard ones.
Not very practical at this point, but I learn a lot :)
Ravi Shankar
@wafflespeanut
May 05 2018 09:54
Nice!
Manuel Holtgrewe
@holtgrewe
May 05 2018 16:27
Hi, In my tests, I need to compare the (text) output to a file of my code with a gold standard. Is there a good utility that also displays a nice diff in case of differences?
Liyakhath A. Syed
@smarlewy
May 05 2018 17:01
why use gitter when there is irc
Restioson
@Restioson
May 05 2018 17:01
Gitter is nice
Liyakhath A. Syed
@smarlewy
May 05 2018 17:01
im new to gitter.
any differences
Hans W. Uhlig
@huhlig
May 05 2018 17:01
code quoting
Restioson
@Restioson
May 05 2018 17:02
  1. Markdown
  2. Embedding of links
  3. Custom embeds for github links
  4. Mentioning people by github name (e.g @Restioson)
  5. Multiline messages
Liyakhath A. Syed
@smarlewy
May 05 2018 17:02
you can use something like pastebin dpaste right
ohh
is there a gitter client
Hans W. Uhlig
@huhlig
May 05 2018 17:02
gitter.im
Restioson
@Restioson
May 05 2018 17:02

Headers

for instance
Liyakhath A. Syed
@smarlewy
May 05 2018 17:02
no native app
Andrey Lesnikov
@ozkriff
May 05 2018 17:02
integrated offline history?
Hans W. Uhlig
@huhlig
May 05 2018 17:02
uhh native app on all mjor platforms
available at gitter.im
Liyakhath A. Syed
@smarlewy
May 05 2018 17:03
okay.. i got it...
gitter is go
good*
is there a tui for gitter
like irssi
Hans W. Uhlig
@huhlig
May 05 2018 17:03
also unline IRC you can actually look at a channel history you wern't connected for
Restioson
@Restioson
May 05 2018 17:03
No, iirc
No reason to use tui and gitter
markdown, etc won't render
Liyakhath A. Syed
@smarlewy
May 05 2018 17:03
yea
im dumb lol
Restioson
@Restioson
May 05 2018 17:04
Then you may as well use irc
Liyakhath A. Syed
@smarlewy
May 05 2018 17:04
ill give gitter a try
Liyakhath A. Syed
@smarlewy
May 05 2018 17:04
but there are a lot of rust people on irc
Hans W. Uhlig
@huhlig
May 05 2018 17:04
there is an unofficial one
Liyakhath A. Syed
@smarlewy
May 05 2018 17:04
i guess more than 1200
Hans W. Uhlig
@huhlig
May 05 2018 17:04
There is a rust discord, slack, irc and gitter
take your pick
Liyakhath A. Syed
@smarlewy
May 05 2018 17:05
which one is active
Hans W. Uhlig
@huhlig
May 05 2018 17:05
all of them
Liyakhath A. Syed
@smarlewy
May 05 2018 17:05
heavily
Liyakhath A. Syed
@smarlewy
May 05 2018 17:13
well.. just compiled the gfx-rs quad and it got me a 53mb!!! binary??
Hans W. Uhlig
@huhlig
May 05 2018 17:13
did you do debug or release
Liyakhath A. Syed
@smarlewy
May 05 2018 17:14
debug ... its obvious
but how much can i compress it to.. if i use release
Hans W. Uhlig
@huhlig
May 05 2018 17:17
read the article
there are lots of options to compress your program
Andrey Lesnikov
@ozkriff
May 05 2018 17:17
$ du -hs target/debug/zemeroth                
54M     target/debug/zemeroth                 
$ strip -s target/debug/zemeroth              
$ du -hs target/debug/zemeroth                
9,1M    target/debug/zemeroth
^ even debug builds can be stripped significantly
Liyakhath A. Syed
@smarlewy
May 05 2018 17:19
so.. what does a release come down to
2mb?
i wish it would
Andrey Lesnikov
@ozkriff
May 05 2018 17:20
$ du -hs target/release/zemeroth
9,6M    target/release/zemeroth
$ strip -s target/release/zemeroth 
$ du -hs target/release/zemeroth  
3,9M    target/release/zemeroth
2-4mb in my case (I'm also using gfx-rs)
Liyakhath A. Syed
@smarlewy
May 05 2018 17:21
cool..
how far should i learn the rust book to be able to use gfx
i currently completed enums
thats like 1/3 of the whole book
Andrey Lesnikov
@ozkriff
May 05 2018 17:22
all of it? gfx-rs is a pretty complicated beast
Hans W. Uhlig
@huhlig
May 05 2018 17:22
which rust book but honestly you should read through the entire thing and experiment as you go
if you havent hit lifetimes or generics you need to keep going
Liyakhath A. Syed
@smarlewy
May 05 2018 17:22
the second edition listed in the docs
Hans W. Uhlig
@huhlig
May 05 2018 17:22
ahh ok
Liyakhath A. Syed
@smarlewy
May 05 2018 17:22
oh.. then i will
Hans W. Uhlig
@huhlig
May 05 2018 17:23
you need to both read and actually program
Liyakhath A. Syed
@smarlewy
May 05 2018 17:23
yea.. doing that
just found vulkano in the khronos's site
getting started page
Andrey Lesnikov
@ozkriff
May 05 2018 17:25
I'd advice to play around with http://ggez.rs or something of similar complexity while you're learning the language itself
Liyakhath A. Syed
@smarlewy
May 05 2018 17:25
did you type ggez.rs or https://ggez.rs
Hans W. Uhlig
@huhlig
May 05 2018 17:25
yeah, jumping straight into the deep end of gpu daughterboard programming when you don't know the language isn't going to go very far
Liyakhath A. Syed
@smarlewy
May 05 2018 17:26
oh.. ggez is for?
gui?
Andrey Lesnikov
@ozkriff
May 05 2018 17:26
http://ggez.rs/ is the correct link, sorry) it's a simple 2d game engine on top of SDL2
Hans W. Uhlig
@huhlig
May 05 2018 17:26
https kind of works
it just whines about bad certificiate
Liyakhath A. Syed
@smarlewy
May 05 2018 17:27
sdl2 kinda breaks on my pc
Hans W. Uhlig
@huhlig
May 05 2018 17:27
how?
sdl runs on just about everything
Liyakhath A. Syed
@smarlewy
May 05 2018 17:27
my window manager goes away when i run any sdl2 program
Hans W. Uhlig
@huhlig
May 05 2018 17:27
os?
Liyakhath A. Syed
@smarlewy
May 05 2018 17:27
kubuntu
Hans W. Uhlig
@huhlig
May 05 2018 17:28
running in a window or full screen
Liyakhath A. Syed
@smarlewy
May 05 2018 17:28
window
Hans W. Uhlig
@huhlig
May 05 2018 17:28
hmm... no idea
Liyakhath A. Syed
@smarlewy
May 05 2018 17:28
tried every possible sdl2 program out there
Andrey Lesnikov
@ozkriff
May 05 2018 17:28
it's strange. works fine for me on kubuntu 17.10 out of the box
Liyakhath A. Syed
@smarlewy
May 05 2018 17:28
maybe i should try with other window manager
Hans W. Uhlig
@huhlig
May 05 2018 17:28
sounds like your kde setup is messed up
Liyakhath A. Syed
@smarlewy
May 05 2018 17:28
nah.. i used a livecd
Hans W. Uhlig
@huhlig
May 05 2018 17:29
oh, your graphics weren't properly setup then most likely
depending on your graphics card lots of things can work as long as you don't touch certain pain spots
Liyakhath A. Syed
@smarlewy
May 05 2018 17:29
but the graphics did get drawn
just the wm was gone
Hans W. Uhlig
@huhlig
May 05 2018 17:29
yeah, you likely crashed it
Liyakhath A. Syed
@smarlewy
May 05 2018 17:29
meaning..
Hans W. Uhlig
@huhlig
May 05 2018 17:30
kubuntu live cd doesn't have nvidia/amd drivers properly setup
Andrey Lesnikov
@ozkriff
May 05 2018 17:30
(btw, there's https://gitter.im/rust-gamedev/Lobby room for rust/gamedev questions)
Hans W. Uhlig
@huhlig
May 05 2018 17:30
it has a set of basic cross MVP drivers
Liyakhath A. Syed
@smarlewy
May 05 2018 17:30
ohh
Hans W. Uhlig
@huhlig
May 05 2018 17:30
irc and discord have one as well
Liyakhath A. Syed
@smarlewy
May 05 2018 17:31
yea.. not quite active recently
Andrey Lesnikov
@ozkriff
May 05 2018 17:31
yep, https://botbot.me/mozilla/rust-gamedev/ is a pretty active one
Liyakhath A. Syed
@smarlewy
May 05 2018 17:31
but the #rust on irc.. is always on heat
super active
Hans W. Uhlig
@huhlig
May 05 2018 17:31
so is the dircord one
Liyakhath A. Syed
@smarlewy
May 05 2018 17:31
i hate the discord electron app
better off using the browser one
gitter does use electron right
Hans W. Uhlig
@huhlig
May 05 2018 17:32
eh, it's basically the same thing as this or slack
Liyakhath A. Syed
@smarlewy
May 05 2018 17:32
yea
so tell me..
gitter client uses electron?
Hans W. Uhlig
@huhlig
May 05 2018 17:32
yep
Liyakhath A. Syed
@smarlewy
May 05 2018 17:32
damn
ill give it a try tho
Hans W. Uhlig
@huhlig
May 05 2018 17:32
same as discord, slack, vscode, and a bunch of other software
love it or hate it electron is in vogue
Liyakhath A. Syed
@smarlewy
May 05 2018 17:33
vscode is the only electron app that is fast
and i like it
Hans W. Uhlig
@huhlig
May 05 2018 17:33
eh, I would debate vscode is fast
it slows to a crawl frequently
Liyakhath A. Syed
@smarlewy
May 05 2018 17:33
vscode is fast.. being an electron app
not the fast text editor tho
i forever love sublime text be it a simple 2 line program or a heavy project
oops im offtopic
sorry
Andrey Lesnikov
@ozkriff
May 05 2018 17:37
@smarlewy so what do you want to build with gfx-rs eventually? :)
Liyakhath A. Syed
@smarlewy
May 05 2018 17:38
a dashboard to my iot project
Hans W. Uhlig
@huhlig
May 05 2018 17:39
what 3d rendering are you doing in the dashboard?
Andrey Lesnikov
@ozkriff
May 05 2018 17:39
hmmm, why do you want to use raw gfx-rs for that? I'd say that http://gtk-rs.org/ or some other mature gui framework is a better option
Liyakhath A. Syed
@smarlewy
May 05 2018 17:40
well.. its like rendering my entire room
and color coding them based on their current state
like if an appliance is powered on .. how much power it is consuming..bla bla
a heat map is what it is called i guess
Andrey Lesnikov
@ozkriff
May 05 2018 17:42
oh, cool. ok, then gfx is good way :)
Hans W. Uhlig
@huhlig
May 05 2018 17:42
you might be better off with something using a framebuffer and a top down view
3d heatmaps while cool to look at tend to be more investment than return
Liyakhath A. Syed
@smarlewy
May 05 2018 17:43
top down view?
Liyakhath A. Syed
@smarlewy
May 05 2018 17:43
its something llike heatmap...that was just an analogy
oh
Hans W. Uhlig
@huhlig
May 05 2018 17:44
a heatmap is just an overlay
Liyakhath A. Syed
@smarlewy
May 05 2018 17:44
yea.
that top down view.. approach seems cool
example
this is from a fps game but the concept is the same
Liyakhath A. Syed
@smarlewy
May 05 2018 17:47
thats what i had in mind
but the previous picture looks more good
you just shot a good idea for me...
Hans W. Uhlig
@huhlig
May 05 2018 17:47
if that's what you're wanting. just 3d render an image of your room in something like blender
take a properly perspective shot and save as a png
Liyakhath A. Syed
@smarlewy
May 05 2018 17:48
but how do you make them glow then?
Hans W. Uhlig
@huhlig
May 05 2018 17:48
then dynamically draw a heatmap at 30% opacity
Liyakhath A. Syed
@smarlewy
May 05 2018 17:48
ohh
sounds good
Hans W. Uhlig
@huhlig
May 05 2018 17:48
you could use painters algorithm if you wanted
then all you actually need is a framebuffer
Liyakhath A. Syed
@smarlewy
May 05 2018 17:48
but yea.. i also wanted to learn gfx
Hans W. Uhlig
@huhlig
May 05 2018 17:49
however there are several gui tookits to help you out
well if learning gfx-rs is your goal then that changes things
Liyakhath A. Syed
@smarlewy
May 05 2018 17:49
what exactly do you mean by a framebuffer
Hans W. Uhlig
@huhlig
May 05 2018 17:49
I would start off with triangle and move up to teapot and go from there
Liyakhath A. Syed
@smarlewy
May 05 2018 17:49
im using good old electron for gui
Hans W. Uhlig
@huhlig
May 05 2018 17:49
err... you might want to study up on graphics pipelines and rasterization
Liyakhath A. Syed
@smarlewy
May 05 2018 17:50
have a little knowledge ..
i know what a framebuffer is.
Hans W. Uhlig
@huhlig
May 05 2018 17:50
if you're using gfx-rs you kind of need to know how a graphics pipeline works
ok. then im not understanding your confusion
Liyakhath A. Syed
@smarlewy
May 05 2018 17:50
but how does it fit in what you were saying about the 30% opacity stuff
you basically want me to make frames and push them to buffer?
Hans W. Uhlig
@huhlig
May 05 2018 17:51
are you familier with painters algorithm and blending?
Liyakhath A. Syed
@smarlewy
May 05 2018 17:51
nope
Hans W. Uhlig
@huhlig
May 05 2018 17:51
ahh
Liyakhath A. Syed
@smarlewy
May 05 2018 17:51
never heard that
something important?
Hans W. Uhlig
@huhlig
May 05 2018 17:52
so painters algorithm was how graphics were put on screen prior to the creation of 3d gpu processing
painters algorithm basically requires you paint from back to front pixel by pixel
Liyakhath A. Syed
@smarlewy
May 05 2018 17:52
oh
Hans W. Uhlig
@huhlig
May 05 2018 17:52
also sometimes known as blitting
so you would blit a black background
blit your bmp image to screen
then blit an overlay
however you don't want your overlay to completely cover the background image, you want it mostly transparent
so you blend the lower color and the upper color together
and that becomes your pixel
Liyakhath A. Syed
@smarlewy
May 05 2018 17:53
oh. that blending..
i know.. it .. but i never heard of painters algorithm
Hans W. Uhlig
@huhlig
May 05 2018 17:54
you do this in a back buffer, then atomically swap
it's the same "algorithm" used by literal painters
Liyakhath A. Syed
@smarlewy
May 05 2018 17:54
but i dont just want to take a picture of my home.. tho.. that would make the project only useful for me
ohh
Hans W. Uhlig
@huhlig
May 05 2018 17:54
since you cant sort paint levels when applied to canvas
you must paint from back to front
@smarlewy you kind of have to
unless you're going to provide a home editor in your product
Liyakhath A. Syed
@smarlewy
May 05 2018 17:55
well.. i need the stuff to be able to be moved around...
suppose i give that project to you.. and your house structure isnt the same as mine
Hans W. Uhlig
@huhlig
May 05 2018 17:55
well painters algorithm can still help
Liyakhath A. Syed
@smarlewy
May 05 2018 17:56
yea.. ill check it out
Hans W. Uhlig
@huhlig
May 05 2018 17:56
then you're going to need a structure and furnature editor
which now means you need home geometry and a way to edit it easily
plus you need appliances and editors for those
which also means lots of potential assets
Liyakhath A. Syed
@smarlewy
May 05 2018 17:56
a simple idea is i already make assets in blender..
and gfx should be able to allow me to move them..
Hans W. Uhlig
@huhlig
May 05 2018 17:57
if you're planning on this being fully dynamic then creating a 3d engine that dynamically renders a house isn't a bad idea
Liyakhath A. Syed
@smarlewy
May 05 2018 17:57
3d engine is far beyond my skills
Hans W. Uhlig
@huhlig
May 05 2018 17:57
you just have to now take into account 3d heat mapping, providing editors for building a house in your model and ways to place entities within the world
Liyakhath A. Syed
@smarlewy
May 05 2018 17:57
not that dynamic tho
Hans W. Uhlig
@huhlig
May 05 2018 17:57
you see why I was suggesting more simple
Liyakhath A. Syed
@smarlewy
May 05 2018 17:57
yea..
Hans W. Uhlig
@huhlig
May 05 2018 17:58
I build enterprise architectures all day long and decompose projects into what is actually needed to build them. Lots of people underestimate the complexity of what they want to do. Don't feel bad
Liyakhath A. Syed
@smarlewy
May 05 2018 17:58
haha..
but yea.. its still a personal project
Hans W. Uhlig
@huhlig
May 05 2018 17:59
what you're describing would probobly take a team of people half a year to build
Liyakhath A. Syed
@smarlewy
May 05 2018 17:59
confined to only my needs.. so not that complex
Hans W. Uhlig
@huhlig
May 05 2018 17:59
then I would look at your first version simply being a static 3d render of your house. potentially with overlay appliance sprites you can move around
and a heatmap for whatever information you're wanting to display
Liyakhath A. Syed
@smarlewy
May 05 2018 17:59
yea.. basically
Hans W. Uhlig
@huhlig
May 05 2018 18:00
you might not want a heat map after you see it, you might want dual color graphs
or small indicator dots
or any number of alternate methods of showing data
Liyakhath A. Syed
@smarlewy
May 05 2018 18:00
nah.. first of all heat maps are cool
and they have a nature of expressing
like red being heavy power usage
green being saving power etc.,
Hans W. Uhlig
@huhlig
May 05 2018 18:01
true, but heat maps are designed to show non descrete gradient information
like where you move within your apartment
if you're tracking power use
that's descrete information
Liyakhath A. Syed
@smarlewy
May 05 2018 18:02
no! its the instantaneous power
Hans W. Uhlig
@huhlig
May 05 2018 18:02
it's individual locations
Liyakhath A. Syed
@smarlewy
May 05 2018 18:02
the average power is show in graphs
Hans W. Uhlig
@huhlig
May 05 2018 18:02
you don't magically have power flowing across your apartment in all places
Diggory Blake
@Diggsey
May 05 2018 18:02
heat maps are for things which continuously vary in space
not time
Hans W. Uhlig
@huhlig
May 05 2018 18:02
@Diggsey thanks. I was botching that explaination
hmm... 4 dimensional heat graphs
;)
Liyakhath A. Syed
@smarlewy
May 05 2018 18:07
eh
4d?
ohh @Diggsey got it
i am struggling to change my name here..
Hans W. Uhlig
@huhlig
May 05 2018 18:09
what problem are you having
Liyakhath A. Syed
@smarlewy
May 05 2018 18:09
cant change name in gitter
i thought discord is popular among games..
Hans W. Uhlig
@huhlig
May 05 2018 18:10
never tried, it used my github name and handle
Liyakhath A. Syed
@smarlewy
May 05 2018 18:10
how do you see me?
Hans W. Uhlig
@huhlig
May 05 2018 18:10
discord is popular among a lot of people
Liyakhath A. Syed
@smarlewy
May 05 2018 18:10
smarlewy or Liyakhath A. Syed
Hans W. Uhlig
@huhlig
May 05 2018 18:10
im on several game dev domains, several programming domains, one or two for actual games
Liyakhath A. Syed
@smarlewy
May 05 2018 18:11
among devs.. gitter or discord?
Hans W. Uhlig
@huhlig
May 05 2018 18:11
did you sign in through twitter or github
those are all on discord
gitter is 100% developers
@smarlewy did you sign into gitter through github or twitter
Diggory Blake
@Diggsey
May 05 2018 18:13
@smarlewy btw you might try a bubble map chart for showing power consumption
Liyakhath A. Syed
@smarlewy
May 05 2018 18:15
github
ill check it out
Hans W. Uhlig
@huhlig
May 05 2018 18:15
so if you log out of gitter, change your name on github and log back in it will change your name
Liyakhath A. Syed
@smarlewy
May 05 2018 18:15
well.. lemme check my github name
haha yea..
wrong name
Hans W. Uhlig
@huhlig
May 05 2018 18:16
its taking your handle, name and picture from github
Liyakhath A. Syed
@smarlewy
May 05 2018 18:20
wish there was a native app
Hans W. Uhlig
@huhlig
May 05 2018 18:20
for what?
Liyakhath A. Syed
@smarlewy
May 05 2018 18:20
gitter
i think git means.. the guys who use git..haha
gitter*
Liyakhath A. Syed
@smarlewy
May 05 2018 18:21
nah.. its still a clone of browser .. electron app as you said
maybe i should check out android app
atleast there i could avoid electron
Hans W. Uhlig
@huhlig
May 05 2018 18:25
you could always write one in rust
Liyakhath A. Syed
@smarlewy
May 05 2018 18:26
@huhlig would you use c++ or rust if you wanna use vulkan
Hans W. Uhlig
@huhlig
May 05 2018 18:26
oh... that's tricky
Liyakhath A. Syed
@smarlewy
May 05 2018 18:26
because everyone here at my univ are promoting me to use vulkan. and im going with rust.. cuz its fun to program in rust
to use c++&
Hans W. Uhlig
@huhlig
May 05 2018 18:26
probobly rust, there is some friction involved
Liyakhath A. Syed
@smarlewy
May 05 2018 18:26
**
Hans W. Uhlig
@huhlig
May 05 2018 18:26
but you will end up with a better product
Liyakhath A. Syed
@smarlewy
May 05 2018 18:27
how?
Hans W. Uhlig
@huhlig
May 05 2018 18:27
safer
less likely to crash
less likely to have wierd thread issues
Liyakhath A. Syed
@smarlewy
May 05 2018 18:27
rust's safety is really zero cost?
Hans W. Uhlig
@huhlig
May 05 2018 18:27
not entirely
but the safety that costs is the same safety that costs in C++
Liyakhath A. Syed
@smarlewy
May 05 2018 18:28
you used rust for unsafe code before?
was it worth it
many poeple said it isnt..
Hans W. Uhlig
@huhlig
May 05 2018 18:29
was it worth what?
I've used C code which is in heirently unsafe and spent a week or more trying to track down wierd segfaults
Liyakhath A. Syed
@smarlewy
May 05 2018 18:29
well.. you wanted to try some code using unsafe stuff and it ended out with same performance as comapared to safe one
Hans W. Uhlig
@huhlig
May 05 2018 18:29
oh yes I have
Liyakhath A. Syed
@smarlewy
May 05 2018 18:30
and?
Hans W. Uhlig
@huhlig
May 05 2018 18:30
it ended up working perfectly and just as performant
Liyakhath A. Syed
@smarlewy
May 05 2018 18:30
oh..
Liyakhath A. Syed
@smarlewy
May 05 2018 18:30
segfalts are annoying but you can easily. if not that easily avoid them..
Hans W. Uhlig
@huhlig
May 05 2018 18:30
here is the thing.. 99% of the time you don't need unsafe
Liyakhath A. Syed
@smarlewy
May 05 2018 18:30
oh...
Hans W. Uhlig
@huhlig
May 05 2018 18:31
oh you can always avoid various kinds of faults
the problem is they are easy to create accidentally
Liyakhath A. Syed
@smarlewy
May 05 2018 18:32
i've seen many arguing that we should learn to get over with segfaults.. than just switching to safer environments
Hans W. Uhlig
@huhlig
May 05 2018 18:32
get over segfaults?
Liyakhath A. Syed
@smarlewy
May 05 2018 18:32
learn how to deal with them
Hans W. Uhlig
@huhlig
May 05 2018 18:32
yes, and the way we currently do that is through extensive static analysis
rust just builds in rules to do the analysis in companion with preventing you from doing stupid shit
Liyakhath A. Syed
@smarlewy
May 05 2018 18:33
yea..
Diggory Blake
@Diggsey
May 05 2018 18:33
@smarlewy the issue is not even segfaults - the issue is undefined behaviour - segfaults are the best possible outcome, there are far worse ways your C/C++ program can break
Liyakhath A. Syed
@smarlewy
May 05 2018 18:34
yea
was just discussing one of them..
what is a bubblemap by the way
Andrzej J. Skalski
@njskalski
May 05 2018 18:35
hi, do you know some example usages of cursive crate?
if you have a room/building with power consumption of different outlets
you can show bubbles for each outlet on a map
Liyakhath A. Syed
@smarlewy
May 05 2018 18:36
ah! my internet is too slow today
so the radius is the value?
Diggory Blake
@Diggsey
May 05 2018 18:38
well, the area
Liyakhath A. Syed
@smarlewy
May 05 2018 18:38
both are proportional lol
Diggory Blake
@Diggsey
May 05 2018 18:38
if you have positive & negative you can colour code the bubbles too
uh.. no they're not
Liyakhath A. Syed
@smarlewy
May 05 2018 18:38
pi*r^2 ?
Diggory Blake
@Diggsey
May 05 2018 18:39
yes, note the "^2"
Liyakhath A. Syed
@smarlewy
May 05 2018 18:39
yea.. i dont say linear
i said proportional
Diggory Blake
@Diggsey
May 05 2018 18:39
proportional means linear
Liyakhath A. Syed
@smarlewy
May 05 2018 18:39
nope.
Diggory Blake
@Diggsey
May 05 2018 18:39
yes
Liyakhath A. Syed
@smarlewy
May 05 2018 18:39
lol
In mathematics, two variables are proportional if there is always a constant ratio between them.
Liyakhath A. Syed
@smarlewy
May 05 2018 18:40
oh.. right..
bends my head
but both can denote values right
either one can be true.. if you keep that proportionality/linearity thing away
Diggory Blake
@Diggsey
May 05 2018 18:42
yeah, but your graph will look different depending on which you use
and bubble maps typically use area
Liyakhath A. Syed
@smarlewy
May 05 2018 18:43
oh..
but the idea was to be expressive.. because i already use graphs for showing exact data
its just about using colors to warn/give a notice
like the thing you said.. changing color over time
Diggory Blake
@Diggsey
May 05 2018 18:46
I can't comment on what your exact use-case, if you want to vary colour too, that works, but as far as "area vs radius" goes, using area to represent values will look better than using "radius" because a circle with twice the radius looks much more than twice as large
Liyakhath A. Syed
@smarlewy
May 05 2018 18:46
oh.. thats why the area is used
i got it..
phew! gitter has a small footprint atleast on android
@Diggsey what do you like python or lua
Diggory Blake
@Diggsey
May 05 2018 18:48
neither particularly
Liyakhath A. Syed
@smarlewy
May 05 2018 18:48
if you had to choose one
Diggory Blake
@Diggsey
May 05 2018 18:48
depends what it was for...
Liyakhath A. Syed
@smarlewy
May 05 2018 18:48
general purpose?
Diggory Blake
@Diggsey
May 05 2018 18:48
there's no such thing as general purpose
Hans W. Uhlig
@huhlig
May 05 2018 18:49
python for general purpose
lua is more limited in capabilities and available libraries
however it's still not good at it
Liyakhath A. Syed
@smarlewy
May 05 2018 18:49
but lua is fast ?
Hans W. Uhlig
@huhlig
May 05 2018 18:49
not really
both are scripting languages
Liyakhath A. Syed
@smarlewy
May 05 2018 18:50
no?
Hans W. Uhlig
@huhlig
May 05 2018 18:50
python is good at being glue
lua is good at being a high level logic language for embedding
Liyakhath A. Syed
@smarlewy
May 05 2018 18:50
^^ i dont think so
lua is good for embedding and being a glue
Hans W. Uhlig
@huhlig
May 05 2018 18:50
not really
Liyakhath A. Syed
@smarlewy
May 05 2018 18:50
wow
Hans W. Uhlig
@huhlig
May 05 2018 18:51
there is a reason python is used for gluing C statistics libraries together and lua is used a game scripting language
Dylan DPC
@Dylan-DPC
May 05 2018 18:51
why would you ask a person to pick a language without providing a use-case? :P
Liyakhath A. Syed
@smarlewy
May 05 2018 18:51
a major part of being a glue is small footprint right
Hans W. Uhlig
@huhlig
May 05 2018 18:51
and not the other way around
Liyakhath A. Syed
@smarlewy
May 05 2018 18:51
@Dylan-DPC a big dilema for me
Dylan DPC
@Dylan-DPC
May 05 2018 18:51
to choose one of those?
Liyakhath A. Syed
@smarlewy
May 05 2018 18:52
yea
what would you say
Dylan DPC
@Dylan-DPC
May 05 2018 18:52
then pick it based on the use case
languages are tools, you gotta pick the right one for your job
Liyakhath A. Syed
@smarlewy
May 05 2018 18:53
this is where. i get stuck.. python gets you a job fast at my place.. but i hate its syntax
with lua its vice versa
Dylan DPC
@Dylan-DPC
May 05 2018 18:53
also pick what suits you
Diggory Blake
@Diggsey
May 05 2018 18:53
@smarlewy are you asking which language to learn
Dylan DPC
@Dylan-DPC
May 05 2018 18:53
if you are not comfortable in a language no point using it
yes he is @Diggsey
Liyakhath A. Syed
@smarlewy
May 05 2018 18:53
yea
Diggory Blake
@Diggsey
May 05 2018 18:53
that's very different from which language to use
Liyakhath A. Syed
@smarlewy
May 05 2018 18:53
i dont like python syntax
yea
Hans W. Uhlig
@huhlig
May 05 2018 18:54
I don't either however it has a very large and lucritive niche
Liyakhath A. Syed
@smarlewy
May 05 2018 18:54
exactly
which one
Douglas Campos
@qmx
May 05 2018 18:54
I don't like it either and do it on my dayjob - at the end of the day it's all about your priorities in life, sometimes is paying the bills, sometimes is having fun
Hans W. Uhlig
@huhlig
May 05 2018 18:54
python
Dylan DPC
@Dylan-DPC
May 05 2018 18:54
or just stick to rust :joy:
Liyakhath A. Syed
@smarlewy
May 05 2018 18:54
i think rust is going well with python
in the community
Hans W. Uhlig
@huhlig
May 05 2018 18:54
@Dylan-DPC as soon as rust can write webapps, games, and data science idiomatically and performantly sure
right now it's a complicated mess
Liyakhath A. Syed
@smarlewy
May 05 2018 18:55
true
Dylan DPC
@Dylan-DPC
May 05 2018 18:55
well those parts are not the focus of the language
which is good
no point building a swiss army knife
Liyakhath A. Syed
@smarlewy
May 05 2018 18:55
isnt there an offtopic channel?
Dylan DPC
@Dylan-DPC
May 05 2018 18:55
nope
Liyakhath A. Syed
@smarlewy
May 05 2018 18:55
cuz nothing we are talking is related to rust
Dylan DPC
@Dylan-DPC
May 05 2018 18:55
it is okay :D
Liyakhath A. Syed
@smarlewy
May 05 2018 18:56
well.. i come from irc and then have rules.. haha
Hans W. Uhlig
@huhlig
May 05 2018 18:56
we stop and talk about rust if someone needs help
Dylan DPC
@Dylan-DPC
May 05 2018 18:56
irc might have an off topic channel
Liyakhath A. Syed
@smarlewy
May 05 2018 18:56
yope
Diggory Blake
@Diggsey
May 05 2018 18:56
it does
Dylan DPC
@Dylan-DPC
May 05 2018 18:56
yope? :joy:
Liyakhath A. Syed
@smarlewy
May 05 2018 18:56
that is where. .general talks goes one
on*
Hans W. Uhlig
@huhlig
May 05 2018 18:56
neah!
Dylan DPC
@Dylan-DPC
May 05 2018 18:56
you mean #rust? that isn't off topic
Diggory Blake
@Diggsey
May 05 2018 18:56
if you want to get a job, then learn whatever language will help you do that, if you just want to learn for its own sake, then use whatever you enjoy using
Dylan DPC
@Dylan-DPC
May 05 2018 18:57
^
Liyakhath A. Syed
@smarlewy
May 05 2018 18:57
for job: python.. but i like lua
and yea. thats where i get stuck
also..with python you can be more productive
Diggory Blake
@Diggsey
May 05 2018 18:57
we can't help you decide which goal is more important to you (learning vs getting a job)...
Liyakhath A. Syed
@smarlewy
May 05 2018 18:57
true haah
Dylan DPC
@Dylan-DPC
May 05 2018 18:57
also
what are you going to achieve by learning lua?
Liyakhath A. Syed
@smarlewy
May 05 2018 18:58
nothnig..
actually
Dylan DPC
@Dylan-DPC
May 05 2018 18:58
then i'd suggest stick to python
Liyakhath A. Syed
@smarlewy
May 05 2018 18:58
maybe use it with cryengine i gues..
or since i am a hardware engineer.. embedded uses.. yea
Hans W. Uhlig
@huhlig
May 05 2018 18:59
does lua have a good embedded story?
Liyakhath A. Syed
@smarlewy
May 05 2018 18:59
well.. ill just go with python .. cuz sublime text uses it
looks so.. but not sure
Hans W. Uhlig
@huhlig
May 05 2018 18:59
python does I know
well micropython
Liyakhath A. Syed
@smarlewy
May 05 2018 18:59
all i know.. is.. lua is great at being a glue
thats for sure
Aah.. ggez doesn't have tutorials
Just rusty docs
Sjoerd
@Sjoerrdd
May 05 2018 20:19
Hello guys
Judson Lester
@nyarly
May 05 2018 22:35
Does anyone have a good idiom for cutting down on dead code warnings? I'm working on some bottom up TDD, and the weeds of "all your private functions aren't used" is a hassle. I've been marking things as public temporarily, but I worry about accidentally shipping with more made public than I intended.
Denis
@mexus
May 05 2018 22:43
@nyarly what about this one? https://stackoverflow.com/a/25877389/1449426
Judson Lester
@nyarly
May 05 2018 22:44
Yeah... I mean, I guess what I want is to ignore those warnings on the commandline? Or make the allow() conditional?
Denis
@mexus
May 05 2018 22:44
well, that answer contains an option of RUSTFLAGS="$RUSTFLAGS -A dead_code" cargo build
Manuel Holtgrewe
@holtgrewe
May 05 2018 22:45
I would like to compare two text files in my test code, ideally with nice diff output. Is something like this available somewhere already?
Denis
@mexus
May 05 2018 23:19
@nyarly and if you want to produce warnings for the normal builds but avoid them for the test builds, you could try #![cfg_attr(test, allow(dead_code))]
although cargo test builds the code first, then runs the tests, so it won't really work xD
Judson Lester
@nyarly
May 05 2018 23:20
@mexus I think that's exactly what I want.
Hrm.
Denis
@mexus
May 05 2018 23:21
so I'd go with RUSTFLAGS="$RUSTFLAGS -A dead_code" cargo test
or just RUSTFLAGS="-A dead_code" cargo test if you don't use any other custom flags
Judson Lester
@nyarly
May 05 2018 23:24
I really want the cfg_attr solution to work ;)
Denis
@mexus
May 05 2018 23:26
well it won't since cargo test will run a normal build first, i.e. without any test attributes being set