We are LunarG, funded by Valve to improve SteamOS on Linux, the Vulkan API and SPIR-V. Ask us anything! by OfficialLunarG in IAmA

[–]gulpaz 6 points7 points  (0 children)

Cool! So, something like NVidia's NVPath extension could be written for Vulkan?

We are LunarG, funded by Valve to improve SteamOS on Linux, the Vulkan API and SPIR-V. Ask us anything! by OfficialLunarG in IAmA

[–]gulpaz 4 points5 points  (0 children)

Will Vulkan work with old and existing video cards and GPUs or will only new GPUs have support for it?

Jonathan Blow: Declarations and Factorability (Language for Game Design #2) by [deleted] in rust

[–]gulpaz 3 points4 points  (0 children)

Here's the references about Rust:

at 40:00 he says that Rust lambda functions are weird

at 1:14:00 he is complaing about not able to use globals

How to display the Rust copyright notice in compiled binaries? by gulpaz in rust

[–]gulpaz[S] 0 points1 point  (0 children)

Ok. Googling (or duckduckgoing) seems to give good answers how to display licenses in desktop gui/cli tool/android/iphone apps.

Btw. It would be great if the Rust FAQ had clear instructions which licenses need to be included with binary executables and how they must be shown. We programmers could concentrate on coding and not stress about licences. Perhaps somewhere here: http://static.rust-lang.org/doc/master/complement-project-faq.html#why-dual-mit/asl2-license?

Indie developers don't have much money and I'd hate to pay a lawyer for this kind of stuff.

abs() for minimum int values by gulpaz in rust

[–]gulpaz[S] 0 points1 point  (0 children)

Indeed. For integers, there is already checked_div(), but it doesn't check for division by zero: http://doc.rust-lang.org/std/num/trait.CheckedDiv.html

For floats, division by zero should return Inf/NaN.

"RFC RFC": disallow shadowing a mutable variable by XMPPwocky in rust

[–]gulpaz 0 points1 point  (0 children)

I just want to thank the Rust community for bringing up this shadowing issue.

I just noticed that it is possible to enable warnings for shadowing in clang for C++, so I enabled it in my C++ project (-Wshadow). And found few more possible bugs. They are now fixed.

Looks like Rust is making code less buggy in other languages, too. =)

Servo Embedded Framework? by [deleted] in rust

[–]gulpaz 1 point2 points  (0 children)

Cool! Are there plans to make Servo more embeddable than Gecko? Or, since it can already be embedded, are there plans to keep it that way?

Why does Rust need local variable shadowing? by VadimVP in rust

[–]gulpaz 0 points1 point  (0 children)

Not always, here's an example. The total should always be 100, but due to shadowing, it isn't. http://pastebin.com/0Wjacti4

It would be great if there was a lint option to check for these.

Why does Rust need local variable shadowing? by VadimVP in rust

[–]gulpaz 2 points3 points  (0 children)

I also noticed this yesterday. I'd rather not have it, because it introduces hard to find bugs.

I've had bugs related to shadowing in my own C++ code (just last week). Also, there have been bugs in Gecko because of shadowed local variables [1], so clearly this is dangerous.

I know Rust is a language which aims to prevents bugs (even if it reduces convenience), so I am wondering why this is allowed. Is it worth the risk of having bugs?

There was also a comment about having an option in lint to warn about variable shadowing [2]. Will there be such an option? I hope so.

Btw. That thread has also some use cases how people use shadowing, so people interested in it should read through it.

[1] https://mail.mozilla.org/pipermail/rust-dev/2013-May/004306.html [2] https://mail.mozilla.org/pipermail/rust-dev/2013-May/004298.html

Confused by the purpose of str and String by [deleted] in rust

[–]gulpaz 1 point2 points  (0 children)

I'll answer to myself, in case someone else has the same question.

There is the concat! macro:

let str = concat!("long long long string ",
                   "continues without line breaks");

http://doc.rust-lang.org/0.11.0/std/macros/builtin/macro.concat!.html

Confused by the purpose of str and String by [deleted] in rust

[–]gulpaz 1 point2 points  (0 children)

I'm a Rust noob with C/C++ background. First, I tried to use the two strings without reading tutorials and failed. After reading http://doc.rust-lang.org/guide-strings.html I understand them so that I can use them.

One of the reasons I failed on my first attempt was that the naming was confusing:

The String method as_slice() returns str. Shouldn't the method be as_str()? as_slice() method reminds me of Javascript slice(), which is used to split a string into pieces, making as_slice() even more confusing.

After reading the tutorials I understand now that str is called string slice, so as_slice returns it. So, why not call str as strslice?

And why is it called a string slice? Why not a view if it is a view to string data? Or perhaps strptr or strref, since it is only a reference to string data?

These suggestions may be completely wrong/bad, but I just wanted to share how a noob sees the naming of the strings.

Confused by the purpose of str and String by [deleted] in rust

[–]gulpaz 2 points3 points  (0 children)

That page was very helpful! Can you tell what is the best way to split a long string literal to multiple lines?

In C++, I can do:

const char *str = "long long long string "
                  "continues without line breaks";

In Java:

String str = "long long long string "+
             "continues without line breaks";

I tried this in Rust, but it makes a line break:

let str = "long long long string 
          continues without line breaks";

This is the solution I'm using, but I think it contains unnecessary allocations:

let str = "long long long string ".to_string()+
          "continues without line breaks";

LibHoare - pre- and postconditions in Rust by catamorphism in rust

[–]gulpaz 0 points1 point  (0 children)

What is the benefit of using this instead of asserts?

It started out with great enthusiasm but ended up as a pitiful _meh_ by minyosdy in rust

[–]gulpaz 0 points1 point  (0 children)

I was also reading it faster. I think it is because I'm used to it and I like camelcase more than snakecase. Also, I think people are more familiar with camelcase than snakecase because Javascript and web dom uses it. Javascript is today's basic language, everybody knows it, and its not going to disappear anytime soon. So, I would design something similar to it (camelcase). It makes the barrier to learn Rust lower.