• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

r1chard

Member
So I need to learn some Python. I've ended up in a job with a fair amount of programming involved despite having no formal qualifications or work experience.

Is Learn Python The Hard Way a good place to start?
Could be. Do you have any programming experience?
 

Exuro

Member
I need some help with the glut/opengl 2.1 api. It's for an intro class and I'm having trouble determining what needs changed.

The issue I'm having is that I'm trying to display a model using perspective viewing, but I can't get the model to display correctly. When I use glOrtho() I get a very nice view of it.
KqeopM5.png


When I change Ortho to Frustum(), keeping the same parameters I get this.
oiFLNXf.png

i've tried adjusting the near and far clipping planes but it doesn't seem to help. If the near is positive it clips part of the cube and if its negative it looks like the above image.

I've tried using gluperspective as well but its either a blank screen or I can barely see parts of the cube. I'm trying to learn how to use it from the projections program here http://user.xmission.com/~nate/tutors.html, but none of my changes seem to make any sense in comparison with their program. Anyone have any ideas?

Here's the display sample code I'm messing with.

Code:
void myReshape(int w, int h)
{
	glViewport(0, 0, w, h);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	if (w <= h)
	 glOrtho(-2.0, 2.0, -2.0 * (GLfloat) h / (GLfloat) w,
	 2.0 * (GLfloat) h / (GLfloat) w, -10, 10.0);
	else
	glOrtho(-2.0 * (GLfloat) w / (GLfloat) h,
	 2.0 * (GLfloat) w / (GLfloat) h, -2.0, 2.0, -10, 10);

	glMatrixMode(GL_MODELVIEW);
}

edit: I think I found the issue. One thing I was trying to do was use gluLookAt to move the camera back, but any changes to it didnt seem to do anything. Then I realized that I called loadIdentity, so my gluLookAt gets overwritten. I've commented out the sections where it's called but feel it's not exactly a good thing to do. My model is displaying properly now at least, but I need to figure out where I would want to put changing the perspective/camera movement.

edit2: alright after some googling I figured out how to place everything. Working well now. Now to add normals and lighting to make it not look awful.
eGSBctZ.png
 
anyone know of good textbooks for learning data structures and algorithms specifically in C++?

Is there a reason you want something C++ based specifically? The two best general algorithm books out there right now in my opion are Algorithms by Robert Sedgewick, which uses Java and Introduction to Algorithms by Cormen et. al. which uses a python like psuedo code which is very easy to translate into your choice of imperative language. There are C/C++ specific books but I don't know of any that match the above for quality and breadth of coverage and I never found it all that helpful personally to learn algorithms through specific languages, usually a clean psuedocode works best for me.

If you want C++ stuff to help improve your own C++ I would recommend you read one of the above and also take a look at any or all of Scott Meyer's Effective series, Effective C++, More Effective C++ and Effective STL
 

ominator

Neo Member
Right now i'm programming with unity and C# and i have a problem which i can't resolve or find anything in the internet.

So, first I have a class called StandardRoom which will load a room-prefab (it's just an empty gamobject with enemies). in there, it will create a floor and doors, playe them an put them as a child. so far so good, it is all displayed correctly in the inspector when i start it.

Then I have the class LevelCreator, which will randomly use StandardRoom to create rooms for the level. creating this room will work, but i can't use room.transform.find() to get the child I'm looking floor.

here is the code:

Code:
class StandardRoom{
	void setupDoors ()
	{
		GameObject floorPrefab = (GameObject)Resources.Load("Level1/Floor");
		GameObject floorInst = Instantiate(floorPrefab, transform.position, Quaternion.identity)as GameObject;
		floorInst.name = "Floor";

		Transform floor = floorInst.transform;
		floor.parent = this.transform;
	}
}

and levelcreator:

Code:
public GameObject createLevel(int numberOfRooms)
{
	Object[] standardrooms = Resources.LoadAll("Level1/StandardRooms");
	GameObject prefabRoom = (GameObject)standardrooms[Random.Range(0, standardrooms.Length)];
	GameObject room = Instantiate (prefabRoom, transform.position, Quaternion.identity) as GameObject;

	Transform floor = room.transform.Find("Floor");
	Debug.Log("bounds: " + floor);
}


Solution: I called setupDoors in the Start()-funktion. After calling it manually it worked.
 

Onyar

Member
I have been asked to join a side project that will be written in Erlang, and I don't know almost anything of this language neither the functional ones.

What do you guys think about Erlang?
Erlang has future?
Is Erlang a good language to enter in this funcional world?

Thanks.
 

BreakyBoy

o_O @_@ O_o
You can try some government sources. (I spent way to much time looking at such things when I was contemplating switching majors).

In America there's the Beureau of Labour Statistics: http://www.bls.gov/ooh/computer-and-information-technology/home.htm

Canada has something similar that's also really good in that it breaks down salaries and data by region (which is something I'm not sure the BLS does), but I'm guessing you're in the US. Perhaps whatever agency does the census in your country would also have such information?

Thanks, that's a great link. I ended up finding some info on Reddit of all places too. It's for graduates specifically, but it's still at least as good a data point as Glassdoor.

I have been asked to join a side project that will be written in Erlang, and I don't know almost anything of this language neither the functional ones.

What do you guys think about Erlang?
Erlang has future?
Is Erlang a good language to enter in this funcional world?

Thanks.

I don't have much experience with it, but it seems that a lot of tools that I use are written in Erlang. Chef, RabbitMQ, CouchDB... seems like something I should learn eventually. Maybe someone else can comment on how marketable a skill it is.
 

Mr.Mike

Member
Is there any easy and clean looking syntax for comparing multiple values against each other in Java? Right now I have something like this.

Code:
if( T != O && T != G && T != D && O != G && O != D && G != D)

//I'd like to apologize to the programming gods for using O as a varaible

But I feel like that's a lot more complicated and "ugly" than it needs to be. I'm imaging something like the below, where each variable on the left would be compared with each variable on the right except for itself.

Code:
if( T,O,G,D != T,O,G,D)
 

mltplkxr

Member
Is there any easy and clean looking syntax for comparing multiple values against each other in Java? Right now I have something like this.

Code:
if( T != O && T != G && T != D && O != G && O != D && G != D)

//I'd like to apologize to the programming gods for using O as a varaible

But I feel like that's a lot more complicated and "ugly" than it needs to be. I'm imaging something like the below, where each variable on the left would be compared with each variable on the right except for itself.

Code:
if( T,O,G,D != T,O,G,D)

I don't think there is. The clean way to do it is to encapsulate that comparison in an appropriately named method (ie. not named O ;). However, this might have changed with 8.
 

Granadier

Is currently on Stage 1: Denial regarding the service game future
Right now i'm programming with unity and C# and i have a problem which i can't resolve or find anything in the internet.

So, first I have a class called StandardRoom which will load a room-prefab (it's just an empty gamobject with enemies). in there, it will create a floor and doors, playe them an put them as a child. so far so good, it is all displayed correctly in the inspector when i start it.

Then I have the class LevelCreator, which will randomly use StandardRoom to create rooms for the level. creating this room will work, but i can't use room.transform.find() to get the child I'm looking floor.

What are you getting when calling room.transform.find("Floor");?

Also, is Floor a direct child of Room?
 

Marcus

Member
Is there a reason you want something C++ based specifically? The two best general algorithm books out there right now in my opion are Algorithms by Robert Sedgewick, which uses Java and Introduction to Algorithms by Cormen et. al. which uses a python like psuedo code which is very easy to translate into your choice of imperative language. There are C/C++ specific books but I don't know of any that match the above for quality and breadth of coverage and I never found it all that helpful personally to learn algorithms through specific languages, usually a clean psuedocode works best for me.

If you want C++ stuff to help improve your own C++ I would recommend you read one of the above and also take a look at any or all of Scott Meyer's Effective series, Effective C++, More Effective C++ and Effective STL

thanks for the suggestions. i may look into the effective c++ books later, but i have decided to go with this book instead http://www.amazon.com/Data-Structures-Using-D-Malik/dp/0324782012/ref=sr_1_3?s=books&ie=UTF8&qid=1410844776&sr=1-3&keywords=malik+c%2B%2B+data
 
Is there any easy and clean looking syntax for comparing multiple values against each other in Java? Right now I have something like this.

Code:
if( T != O && T != G && T != D && O != G && O != D && G != D)

//I'd like to apologize to the programming gods for using O as a varaible

But I feel like that's a lot more complicated and "ugly" than it needs to be. I'm imaging something like the below, where each variable on the left would be compared with each variable on the right except for itself.

Code:
if( T,O,G,D != T,O,G,D)

This is something that's very easy to do in a language with clean literal syntax for common collections. You're out of luck here really, the closest thing to this I can think of is to throw all the variables in a Set and then check the size.

Code:
if (new HashSet<>(Arrays.asList(T, O, G, D)).size() == 4) {
    // no values are equal to each other yay 
}
 

ominator

Neo Member
What are you getting when calling room.transform.find("Floor");?

Also, is Floor a direct child of Room?

Outside of the class it returns nothing, not even null. Inside the class it returns Floor.

In the standardroom class i create floor and set standardroom as a parent. When I run it, it shows Floor as a child of this class in the class hirarchy.

I also tried to save Floor.renderer.bounds.size in a variable, but when I call get(), it just returns 0.
 

mackattk

Member
Working in bash, and this is the first time I have ever used linux.... Don't know what is wrong because the error messages are so damn cryptic that I don't know where to look to fix this. Just keep getting

syntax error near unexpected token 'in
' case "$choice" in"

I am supposed to eventually make this into a loop, but right now I am trying to get the program to even run.

Code:
#!/bin/bash
        echo "1. Add a contact"
        echo "2. Remove a contact"
        echo "3. Find a contact"
        echo "4. List all contacts"
        echo "5. Exit the program"
        read -p "Please enter selection: " choice
	case "$choice" in
                1)
                        read -p "Enter a name: " firstname lastname
                        read -p "Enter an email address: " email
                        if grep -fxq "$firstname $lastname" contacts.dat
                        then
                                echo "$firstname $lastname, $email" >> contacts.dat
                                continue
                        else
                                echo "There is already an entry for $firstname $lastname"
                        fi
                        ;;
                2)
                        cat contacts.dat
                        read -p "Enter a name: " firstname lastname
                        sed -e s/$firstname $lastname//g -i *
                        ;;
                3)
                        cat contacts.dat
                        read -p "Enter a name: " firstname lastname
                        results=$(grep "$firstname $lastname" contacts.dat)
                        echo results
                        ;;
                4)
                        sort --k2=2 contacts.dat
                        ;;
                5)
                       exit
                        ;;
                *)
                        echo "Please enter a valid choice"
                        ;;

        esac
 
has anyone used or gone through the book, "C++ for beginners" what did you guys think of it?

I am mostly going through the book to learn C++, it is very math based. Is it a good idea to learn multiple languages?? what languages are in demand at the moment? I need a proper structure
 

poweld

Member

Tried copy pasting your code and it works fine for me:
Code:
> ./test.sh
1. Add a contact
2. Remove a contact
3. Find a contact
4. List all contacts
5. Exit the program
Please enter selection:

...or at least executed, didn't go much further than that.

Code:
> bash --version
GNU bash, version 4.1.10(4)-release (i686-pc-cygwin)

Which version of bash are you using? And are you sure it's not a symlink to another shell, like sh?
 

mackattk

Member
Tried copy pasting your code and it works fine for me:
Code:
> ./test.sh
1. Add a contact
2. Remove a contact
3. Find a contact
4. List all contacts
5. Exit the program
Please enter selection:

...or at least executed, didn't go much further than that.

Code:
> bash --version
GNU bash, version 4.1.10(4)-release (i686-pc-cygwin)

Which version of bash are you using? And are you sure it's not a symlink to another shell, like sh?

my trouble is when I try to do an option I keep getting the same error, no matter which option I try.

no idea what version I am using. I am pretty new to linux and am remoted into the schools linux system.
 

Tamanon

Banned
Working in bash, and this is the first time I have ever used linux.... Don't know what is wrong because the error messages are so damn cryptic that I don't know where to look to fix this. Just keep getting

syntax error near unexpected token 'in
' case "$choice" in"

I am supposed to eventually make this into a loop, but right now I am trying to get the program to even run.

Code:
#!/bin/bash
        echo "1. Add a contact"
        echo "2. Remove a contact"
        echo "3. Find a contact"
        echo "4. List all contacts"
        echo "5. Exit the program"
        read -p "Please enter selection: " choice
	case "$choice" in
                1)
                        read -p "Enter a name: " firstname lastname
                        read -p "Enter an email address: " email
                        if grep -fxq "$firstname $lastname" contacts.dat
                        then
                                echo "$firstname $lastname, $email" >> contacts.dat
                                continue
                        else
                                echo "There is already an entry for $firstname $lastname"
                        fi
                        ;;
                2)
                        cat contacts.dat
                        read -p "Enter a name: " firstname lastname
                        sed -e s/$firstname $lastname//g -i *
                        ;;
                3)
                        cat contacts.dat
                        read -p "Enter a name: " firstname lastname
                        results=$(grep "$firstname $lastname" contacts.dat)
                        echo results
                        ;;
                4)
                        sort --k2=2 contacts.dat
                        ;;
                5)
                       exit
                        ;;
                *)
                        echo "Please enter a valid choice"
                        ;;

        esac

Really strange. I just copied the script and it worked perfectly, catching the case. Just erroring out at the choice since the files didn't exist. Can you screenshot what happens when you run it?
 

Tamanon

Banned
Everything I've seen for that error is that it's not supported by the shell. You're sure you're using bash and not sh?

Can you run "cat /etc/shells" and make sure /bin/bash shows up there? It might be a slightly different shell to run.

oh yeah, or run it with bash instead of sh, lol. Should've noticed that.

Or just ./step_prog1.sh should run too.
 

BreakyBoy

o_O @_@ O_o
The above replies are correct, you're using sh instead of bash there.

Considering you're using a #!/bin/bash shebang there, you should be able to call the file directly if you make it executable.

Run:
Code:
sudo chmod +x prog1.sh

and you should be able to run it by calling it directly:
Code:
./prog1.sh

I also recommend changing your shebang from #!/bin/bash to #!/usr/bin/env bash

Relevant information:
- Difference between sh and bash
- Preferred bash shebang?
 

Granadier

Is currently on Stage 1: Denial regarding the service game future
Outside of the class it returns nothing, not even null. Inside the class it returns Floor.

In the standardroom class i create floor and set standardroom as a parent. When I run it, it shows Floor as a child of this class in the class hirarchy.

I also tried to save Floor.renderer.bounds.size in a variable, but when I call get(), it just returns 0.

I'm stumped on this. My only guess would be related to scope, and that your trying to access floor from somewhere that it isn't defined.

If you figure it out, please be sure to update with your solution.
 
The above replies are correct, you're using sh instead of bash there.

Considering you're using a #!/bin/bash shebang there, you should be able to call the file directly if you make it executable.

Run:
Code:
sudo chmod +x prog1.sh

and you should be able to run it by calling it directly:
Code:
./prog1.sh

I also recommend changing your shebang from #!/bin/bash to #!/usr/bin/env bash

Relevant information:
- Difference between sh and bash
- Preferred bash shebang?
What platforms does /bin/bash not work on?
 

mackattk

Member
Retyped everything in vim and have it working now....previously I typed it in notepad++ and apparently that isn't the way to go. I couldn't figure anything out because I guess there were hidden carriage returns I wasn't seeing and what not. Either way thanks for all your help.

I was just getting extremely frustrated not being able to get anything running. The teacher said we could use whatever text editor we would like, didn't specify it had to be a Linux text editor...
 

Slavik81

Member
Retyped everything in vim and have it working now....previously I typed it in notepad++ and apparently that isn't the way to go. I couldn't figure anything out because I guess there were hidden carriage returns I wasn't seeing and what not. Either way thanks for all your help.

I was just getting extremely frustrated not being able to get anything running. The teacher said we could use whatever text editor we would like, didn't specify it had to be a Linux text editor...
You can see newlines in notepad++ with View > Show Symbol > Show All Characters. [1]

To choose the newline format of a new document, choose Settings -> Preferences -> New Document/Default Directory -> New Document -> Format -> Windows/Mac/Unix

For an already-open document choose Edit -> EOL Conversion [2]

1. http://stackoverflow.com/q/14682329
2. http://stackoverflow.com/q/8195839
 

BreakyBoy

o_O @_@ O_o
What platforms does /bin/bash not work on?

Non-Linux Unix (e.g. BSD) systems often don't even have bash installed by default. The last OpenBSD box I was on did have it installed, but since it was user-installed it was on /usr/local/bin.

Granted, there is the possibility of env not being there either, or not being in /usr/bin, but that's less common in my experience.

In any case, there's good arguments for/against #!/bin/bash and #!/usr/bin/env bash, so that's why I said I recommended it instead of saying it was necessary. If you're being security conscious, #!/bin/bash is probably better. Then again, if you're that concerned over security, you probably aren't worried about portability and could do with just removing the shebang entirely.

One thing we should all agree on is not to use #!/bin/sh even if yours is symlinked to bash.
 

poweld

Member
Retyped everything in vim and have it working now....previously I typed it in notepad++ and apparently that isn't the way to go. I couldn't figure anything out because I guess there were hidden carriage returns I wasn't seeing and what not. Either way thanks for all your help.

I was just getting extremely frustrated not being able to get anything running. The teacher said we could use whatever text editor we would like, didn't specify it had to be a Linux text editor...

Also, for future reference, if you want to check for invisible characters in vim, use
Code:
:set list

Glad you solved the issue!
 
Any recommended books or tutorials i can follow to get up to speed with ASP.net MVC?

Just graduated and a lot of local jobs have C# and ASP.net in their needed skillset.
 

Apoc29

Member
Right now i'm programming with unity and C# and i have a problem which i can't resolve or find anything in the internet.

So, first I have a class called StandardRoom which will load a room-prefab (it's just an empty gamobject with enemies). in there, it will create a floor and doors, playe them an put them as a child. so far so good, it is all displayed correctly in the inspector when i start it.

Then I have the class LevelCreator, which will randomly use StandardRoom to create rooms for the level. creating this room will work, but i can't use room.transform.find() to get the child I'm looking floor.

here is the code:

Code:
class StandardRoom{
	void setupDoors ()
	{
		GameObject floorPrefab = (GameObject)Resources.Load("Level1/Floor");
		GameObject floorInst = Instantiate(floorPrefab, transform.position, Quaternion.identity)as GameObject;
		floorInst.name = "Floor";

		Transform floor = floorInst.transform;
		floor.parent = this.transform;
	}
}

and levelcreator:

Code:
public GameObject createLevel(int numberOfRooms)
{
	Object[] standardrooms = Resources.LoadAll("Level1/StandardRooms");
	GameObject prefabRoom = (GameObject)standardrooms[Random.Range(0, standardrooms.Length)];
	GameObject room = Instantiate (prefabRoom, transform.position, Quaternion.identity) as GameObject;

	Transform floor = room.transform.Find("Floor");
	Debug.Log("bounds: " + floor);
}

When is setupDoors() being called? You will have to call that explicitly before you attempt to find the floor. If you call it in the Awake() method of StandardRoom, that might be called as soon as you Instantiate it, but to be absolutely sure you should just call it directly before you need it.
 

Cptkrush

Member
Hopefully one of you guys can help me out here, I'm taking an intro to python programming class this semester and the assignment I'm currently working on requires me to loop until a form a table of radii, circumferences, and areas from radius 1 to 10. I have the loop working perfectly, it's just the display is wonky. Here's my code
Code:
import math
def main():
    rad=0
    pi = float(math.pi) 
    print('Radius \t \t Area\t \t Circumference')
    for radius in range (1,11):
        rad+=1
        cir = float(2*pi*rad)
        area = float(pi*rad**2) 
        print(format(rad,'.3f'), '\t', '\t',format(area,'.3f'),'\t','\t', format(cir,'.3f'))

main()

When I run it I get this:
bNSn9Mr.png


I'm sure I made a super simple goof, it would just help to have a fresh pair of eyes take a look.
 

Tamanon

Banned
It looks like you're running into the tab boundaries, so when a number gets too many digits, it pushes it to the next tab. I moved the area down to .2f and it put half the list in line, but once it got too many digits, it moved it again.

Might need to mess with the formatting a bit more.

I messed around and got a proper looking format by inserting and removing some spaces.

Code:
import math
def main():
    rad = 0
    pi = float(math.pi)
    print('Radius \t\t Area \t\t Circumference')
    for radius in range (1,11):
        rad+=1
        cir = float(2*pi*rad)
        area = float(pi*rad**2)
        print(rad, '\t','\t',format(area,'.3f'),' \t', format(cir,'.3f'))


main()

Can throw that format(rad,'.3f') back in there, but I personally think it's superfluous since they're all integers. Either way, the format still works.
 
I'm sure I made a super simple goof, it would just help to have a fresh pair of eyes take a look.

This is happening because you are using tabs to space out the table. You can see that the two lines that are indenting too far left are the lines that have less than 6 characters in the area column. I think the cleanest way to sort this out is to just use spaces for indentation and use the fill specifier for format.

Code:
def main():
    rad = 0
    pi = float(math.pi)
    print('{: <13}{: <13}{: <13}'.format('Radius', 'Area', 'Circumference'))
    for radius in range(1, 11):
        rad += 1
        cir = float(2*pi*rad)
        area = float(pi*rad**2)
        print('{: <13.3f}{: <13.3f}{: <13.3f}'.format(rad, area, cir))

These examples use the format string syntax, indent left and space to a minimum of 13 spaces.
 

Cptkrush

Member
It looks like you're running into the tab boundaries, so when a number gets too many digits, it pushes it to the next tab. I moved the area down to .2f and it put half the list in line, but once it got too many digits, it moved it again.

Might need to mess with the formatting a bit more.

I messed around and got a proper looking format by inserting and removing some spaces.

Can throw that format(rad,'.3f') back in there, but I personally think it's superfluous since they're all integers. Either way, the format still works.
Thank you, I knew it was an easy fix I'm just sick as hell right now so my brain don't work too good. My professor wants all the numbers formatted to 3 decimal spaces for some reason, that's the only reason I had the radii formatted like that.

This is happening because you are using tabs to space out the table. You can see that the two lines that are indenting too far left are the lines that have less than 6 characters in the area column. I think the cleanest way to sort this out is to just use spaces for indentation and use the fill specifier for format.

Code:
def main():
    rad = 0
    pi = float(math.pi)
    print('{: <13}{: <13}{: <13}'.format('Radius', 'Area', 'Circumference'))
    for radius in range(1, 11):
        rad += 1
        cir = float(2*pi*rad)
        area = float(pi*rad**2)
        print('{: <13.3f}{: <13.3f}{: <13.3f}'.format(rad, area, cir))

These examples use the format string syntax, indent left and space to a minimum of 13 spaces.
Thank you for this, I will definitely look into learning more about this concept.
 

ominator

Neo Member
When is setupDoors() being called? You will have to call that explicitly before you attempt to find the floor. If you call it in the Awake() method of StandardRoom, that might be called as soon as you Instantiate it, but to be absolutely sure you should just call it directly before you need it.

Oh wow. I had it in the Start()-funktion. I just called it manually and it worked. Thank you very much!
 
Retyped everything in vim and have it working now....previously I typed it in notepad++ and apparently that isn't the way to go. I couldn't figure anything out because I guess there were hidden carriage returns I wasn't seeing and what not. Either way thanks for all your help.

I was just getting extremely frustrated not being able to get anything running. The teacher said we could use whatever text editor we would like, didn't specify it had to be a Linux text editor...

You can see newlines in notepad++ with View > Show Symbol > Show All Characters. [1]

To choose the newline format of a new document, choose Settings -> Preferences -> New Document/Default Directory -> New Document -> Format -> Windows/Mac/Unix

For an already-open document choose Edit -> EOL Conversion [2]

1. http://stackoverflow.com/q/14682329
2. http://stackoverflow.com/q/8195839

You can also use the dos2unix tool. It should resolve newline issues if you're copying files written on Windows to Unix or Linux.
 
Any ios developers here? Where their any changes to ARC in ios 8? My references aren't being kept in my popover and I can't find out out what changes were made from 7.1 where it works perfectly.
 

injurai

Banned
So Rust looks pretty cool, I've heard talk that it's meant to replace C/C++ in the long run. 15-20 years out. It sounds really cool, still seems a bit underbaked.

Thoughts on it?
 

Sharp

Member
So Rust looks pretty cool, I've heard talk that it's meant to replace C/C++ in the long run. 15-20 years out. It sounds really cool, still seems a bit underbaked.

Thoughts on it?
Rust is great. It's a "best of" collection of features from contemporary programming languages with C++'s attitude towards zero-cost abstractions and Haskell's devotion to memory safety as overriding concerns. Its most distinctive feature is its lifetime system, which has previously only appeared in a research language called Cyclone. It operates through a combination of linear types and region-based memory management to guarantee memory safety and data-race safety without garbage collection. Rust also makes a number of other choices to eliminate undefined behavior. Because it's starting from scratch, it is also able to correct some C++ misfeatures: it replaces the Turing-complete template parser with type-safe generics and hygienic macros, has proper type inference (not quite Hindley-Milner but nearly the same in practice), has a real module system, abandons the malloc / free API by using RAII to guarantee sized deallocations, and has aliasing semantics that basically make every pointer "restrict." It has lots of other features, too, but those are the big ones that I think make it a clear win over C++.

While it won't hit 1.0 until the end of this year, the core language is stable enough that you shouldn't be afraid of starting personal projects in it. I'd be happy to answer any specific questions you or anyone else on GAF has about the language, but failing that the IRC channel and subreddit are both very good resources.
 

Mr.Mike

Member
What's the newest language that's managed to become popular and widely used? Certainly it seems like there would be a lot of momentum keeping currently popular languages from being replaced, even if newer languages were better.

Anyway, Rust looks interesting to me as well, especially since it's "multi-paradigm". I'm not really a fan of this whole "object-oriented" thing so far.
 

injurai

Banned
Rust is great. It's a "best of" collection of features from contemporary programming languages with C++'s attitude towards zero-cost abstractions and Haskell's devotion to memory safety as overriding concerns. Its most distinctive feature is its lifetime system, which has previously only appeared in a research language called Cyclone. It operates through a combination of linear types and region-based memory management to guarantee memory safety and data-race safety without garbage collection. Rust also makes a number of other choices to eliminate undefined behavior. Because it's starting from scratch, it is also able to correct some C++ misfeatures: it replaces the Turing-complete template parser with type-safe generics and hygienic macros, has a real module system, abandons the malloc / free API by using RAII to guarantee sized deallocations, and has aliasing semantics that basically make every pointer "restrict." It has lots of other features, too, but those are the big ones that I think make it a clear win over C++.

While it won't hit 1.0 until the end of this year, the core language is stable enough that you shouldn't be afraid of starting personal projects in it. I'd be happy to answer any specific questions you or anyone else on GAF has about the language, but failing that the IRC channel and subreddit are both very good resources.

Wow! Thanks for the write up. In my limited exposure to programming as a whole, C is easily my favorite language. Mostly I like the level at which it sites in abstraction, still very close to the hardware and OS. But it really shows it's age, and it's frusterating despite it also being super rewarding.

I never found C++ to my liking, nor Java, or C#. Just too bulky of languages and so often you get constrained under the weight of IDEs, and dependency resolution. I have NEVER successfully deployed C++ or Java, and only once did I have a deployable C# project.

But I love C and I'm frusterated by interpretated scripting languages and I ESPECIALLY HATE dynamic typing so Python was never as appealing in reality as when people pitched it to me.

Haskell and Go immediatly jumped out to me amongst the bunch, and recently I've taken to teaching myself Haskell. It's really challenging my views of what a language should be, and what a language can be. Super enjoyable and refreshing. GHCI is also a great side option.

But yeah I'll have to look into Rust, it sounds like everything I want in a language. I'm so tired of writing things in C89. Too much trouble to work with C99 or C++11.
 

Husker86

Member
Udacity's nanodegrees are starting. Got an email to apply for the front-end web dev one.

I hope these turn out to be good in both curriculum and job seeking opportunity.

The last year and a half I have learned a lot, but I keep jumping around subjects, everything from Android development to Ruby. I'm hoping these structured outlines in the nanodegrees will help me focus my learning better.
 
Top Bottom