Coding: Fleeting Thoughts

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Prelates, Moderators General

Re: Coding: Fleeting Thoughts

Postby RoadieRich » Mon Dec 26, 2011 4:56 am UTC

Damnit, I knew it was something simple. It's working now, after another couple of minor modifications.
roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Wed Dec 28, 2011 2:17 am UTC

I now occasionally update my rarely-updated blog.

I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.
User avatar
You, sir, name?
 
Posts: 6569
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City

Re: Coding: Fleeting Thoughts

Postby Ended » Fri Dec 30, 2011 4:50 pm UTC

Facepalm moment of the day: I suddenly found that when I tried to build my program from scratch, it would fail with multiple screenfulls of cryptic error messages. Eventually tried gradually reverting back to the (known good) repository head. Nope, still fails to build!

Spoiler:
In retrospect, some of the error messages should have given it away:
Code: Select all
./list(1): error: this declaration has no storage class or type specifier
./list(1): error: expected a ";"
A while ago I had needed a temporary file to store a list of source files. In what would prove to be an unwise choice, I called the file "list", left it in the compile path, and forgot about it. My tortuous compile process somehow managed to pick this file up instead of the standard library header (even though I only ever included it with angle brackets!).
Generally I try to make myself do things I instinctively avoid, in case they are awesome.
-dubsola
Ended
 
Posts: 1459
Joined: Fri Apr 20, 2007 3:27 pm UTC
Location: The Tower of Flints. (Also known as: England.)

Re: Coding: Fleeting Thoughts

Postby phlip » Sat Dec 31, 2011 2:10 pm UTC

So cool having another CS nerd in the family... my sister and I spent NYE coding, took a break at midnight to watch the celebrations on TV, and quickly unanimously decided that coding was more entertaining than fireworks, and went back to it.

Anyway, two of the courses she took last year at uni were Assembly, using an emulated toy RISC architecture invented by the lecturer, and Concurrency and Distributed Systems. And she'd always claimed that the two should be combined, making a concurrent version of the toy ASM system... partly because it'd be hilarious and partly because the emulator for the toy system is written in Java, and th lecturer of the concurrency class hates Java with the intensity of a million suns. So today, we did that.

So I now have a very simple, context-switching, non-preemptive, round-robin threaded concurrency system, written in this toy assembly language. And it works, and was fun to write. I'll call that a successful night.

[edit] In case you're curious...
While no one overhear you quickly tell me not cow cow.
but how about watch phone?
User avatar
phlip
Restorer of Worlds
 
Posts: 7186
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia

Re: Coding: Fleeting Thoughts

Postby Ubik » Sun Jan 01, 2012 7:04 pm UTC

Finally I have something more complex than a cube or sphere (which was actually just a subdivided and deformed cube) on screen. Here's a screenshot of my desktop. The plane isn't rendered with smoothing yet. That's the next step in implementing my .obj loader.

Edit: Also the file list of the IDE on left, overengineering much?
User avatar
Ubik
 
Posts: 939
Joined: Thu Oct 18, 2007 3:43 pm UTC

Re: Coding: Fleeting Thoughts

Postby headprogrammingczar » Sun Jan 01, 2012 7:46 pm UTC

You say it's overengineered now, but wait until you don't know how a project is organized. That tree pane is a lifesaver.
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Weeks> You're the goddamn headprogrammingspock!
<Cheese> I love you
User avatar
headprogrammingczar
 
Posts: 3024
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

Re: Coding: Fleeting Thoughts

Postby RoadieRich » Mon Jan 02, 2012 6:06 pm UTC

roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: Coding: Fleeting Thoughts

Postby Xeio » Wed Jan 04, 2012 9:24 pm UTC

Code: Select all
if (index == 0 || Other1)
{
}
else if (index == 0 && Other2)
{
}
Er, all the code that would be in that second if statement is dead code, isn't it? :?

I hate when I run into something like this and it seems so obvious that I must be missing something...

EDIT: Or more annoying, that while I know in its current form I could just delete that code, I wonder if the original author didn't intend it to be such, or if it was just something that didn't get cleaned up when the if logic was altered...
User avatar
Xeio
Friends, Faidites, Countrymen
 
Posts: 4811
Joined: Wed Jul 25, 2007 11:12 am UTC
Location: C:\Users\Xeio\

Re: Coding: Fleeting Thoughts

Postby Yakk » Wed Jan 04, 2012 9:35 pm UTC

Does the Other1 code have any side effects?

Ie, index != 0, but Other1 both changes index to 0 and returns false.

Then the second branch can execute.

---

In any case, this is why having things like Blame that gives you a per-line indication of the history of the file is very useful.
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.
User avatar
Yakk
Poster with most posts but no title.
 
Posts: 10448
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: Coding: Fleeting Thoughts

Postby Xeio » Wed Jan 04, 2012 11:00 pm UTC

Yakk wrote:In any case, this is why having things like Blame that gives you a per-line indication of the history of the file is very useful.
Well, in visual studio I can run annotate which does the same thing. It doesn't help much when all the code is over 4 years old and all by the same person.

And no, the others don't have any side effects.
User avatar
Xeio
Friends, Faidites, Countrymen
 
Posts: 4811
Joined: Wed Jul 25, 2007 11:12 am UTC
Location: C:\Users\Xeio\

Re: Coding: Fleeting Thoughts

Postby Yakk » Wed Jan 04, 2012 11:16 pm UTC

The change numbers should differ by line. So you look at that line and look at the change in question where the lines where changed. Things get annoying if reformatting passes occurred, but there are usually ways to work around that issue.
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.
User avatar
Yakk
Poster with most posts but no title.
 
Posts: 10448
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: Coding: Fleeting Thoughts

Postby RoadieRich » Thu Jan 05, 2012 7:43 am UTC

Xeio wrote:
Code: Select all
if (index == 0 || Other1)
{
}
else if (index == 0 && Other2)
{
}
Er, all the code that would be in that second if statement is dead code, isn't it? :?

I hate when I run into something like this and it seems so obvious that I must be missing something...

EDIT: Or more annoying, that while I know in its current form I could just delete that code, I wonder if the original author didn't intend it to be such, or if it was just something that didn't get cleaned up when the if logic was altered...

Because it's in an else block, it only runs if the condition for the first if statement is false and it's own condition is true, that is, if i = 'index==0', on = 'Othern', and x = 'execute the code in block 2:

x = (i ^ o2) ^ ¬(i v o1)

Apply De Morgan's law to the second half, and we get

x = (i ^ o2) ^ ¬i ^ ¬o1

The brackets fall out due to the associative law, and re-arranging for clarity:

x = i ^ ¬i ^ ¬o1 ^ o2

i^¬i=0, and p^0=0, so x=0, meaning yes, that code is dead.

edit: associative law, not commutative - I always get those two mixed up.
roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: Coding: Fleeting Thoughts

Postby Yakk » Fri Jan 06, 2012 7:24 pm UTC

Roadie, that doesn't quite hold, because we aren't coding in a functional language. :)

If Other1 is an expression like IndexShouldBeCleared(&index), or if index is a member variable, or one of myriad of other reasons, it could easily change index in the first expression to zero (after the index==0 check), and then return false.

We then fall through into the second expression. Index is zero, and it isn't dead code.

This is one of the many ways in which C++ contains some suck. :)
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.
User avatar
Yakk
Poster with most posts but no title.
 
Posts: 10448
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: Coding: Fleeting Thoughts

Postby Xeio » Fri Jan 06, 2012 8:14 pm UTC

Yakk wrote:This is one of the many ways in which C++ contains some suck. :)
And it's a pretty good argument against doing variable modification inside of an if statement. :P

Actually, I think the only time assignment is generally ok in a conditional clause is for a while loop condition. Stuff like reading in the next line while doing a check to make sure it wasn't the end of the file. Anything more complex than that though and I'd be very hesitant to do so, if only for readability.
User avatar
Xeio
Friends, Faidites, Countrymen
 
Posts: 4811
Joined: Wed Jul 25, 2007 11:12 am UTC
Location: C:\Users\Xeio\

Re: Coding: Fleeting Thoughts

Postby TNorthover » Fri Jan 06, 2012 9:30 pm UTC

Xeio wrote:Actually, I think the only time assignment is generally ok in a conditional clause is for a while loop condition. Stuff like reading in the next line while doing a check to make sure it wasn't the end of the file. Anything more complex than that though and I'd be very hesitant to do so, if only for readability.

It can work well in an if statement as well. LLVM uses it for testing whether casts work and making use of the value if so.
User avatar
TNorthover
 
Posts: 191
Joined: Wed May 06, 2009 7:11 am UTC
Location: Cambridge, UK

Re: Coding: Fleeting Thoughts

Postby RoadieRich » Sat Jan 07, 2012 12:00 am UTC

Yakk wrote:Roadie, that doesn't quite hold, because we aren't coding in a functional language. :)

If Other1 is an expression like IndexShouldBeCleared(&index), or if index is a member variable, or one of myriad of other reasons, it could easily change index in the first expression to zero (after the index==0 check), and then return false.

We then fall through into the second expression. Index is zero, and it isn't dead code.

This is one of the many ways in which C++ contains some suck. :)

Indeed. Perhaps the answer should be "it doesn't get executed, modulo evil and wrongness."
roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: Coding: Fleeting Thoughts

Postby Xanthir » Sat Jan 07, 2012 1:45 am UTC

Xeio wrote:Actually, I think the only time assignment is generally ok in a conditional clause is for a while loop condition. Stuff like reading in the next line while doing a check to make sure it wasn't the end of the file. Anything more complex than that though and I'd be very hesitant to do so, if only for readability.

While I accept that case in languages like C, I believe it shows that the language is lacking the essential feature of an extensible iteration protocol and associated loop structure.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))
User avatar
Xanthir
My HERO!!!
 
Posts: 4323
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex

Re: Coding: Fleeting Thoughts

Postby RoadieRich » Sat Jan 07, 2012 3:55 am UTC

Alternatively, you could call it too extensible.
roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: Coding: Fleeting Thoughts

Postby troyp » Mon Jan 09, 2012 8:18 pm UTC

Applications of Machine Learning in Natural Language Processing

  • optical character recognition
  • automatic summarization
  • spam detection
  • classification of sentences into appropriate and inappropriate objects for the rejoinder "That's what she said"*.

* This capability should be added to Cleverbot. That chatbot/chatbot conversation would have been even better with this.
troyp
 
Posts: 529
Joined: Thu May 22, 2008 9:20 pm UTC
Location: Lismore, NSW

Re: Coding: Fleeting Thoughts

Postby Xeio » Fri Jan 13, 2012 9:29 pm UTC

Code: Select all
/// <summary>
/// Adds a num to the list of used nums
/// </summary>
/// <param name="num"></param>
/// <param name="array"></param>
private static void AddNumToList(string num, ref ArrayList array)
{
     //adds num to appropriate list
     array.Add(num);
}
Why not call array.Add(num) directly you ask? I dunno, because it's done like that about 50/50 in the file, I assume because the newer code isn't stupid.

Also, the ref keyword does nothing in this case...

But at least it's commented...? :roll:

EDIT: Oh, by the way, those lists use in the calls aren't even needed (one is only added to/cleared and otherwise unreferenced, the other can be replaced by... arbitrarily simple logic).

I thought we used to have a coding rant thread, but I couldn't find it.

EDIT2: Ah, I feel much better doing some damage to the code in that file. It's still far from good but I refactored a lot of crap away and simplified a bunch of logic. :mrgreen:
User avatar
Xeio
Friends, Faidites, Countrymen
 
Posts: 4811
Joined: Wed Jul 25, 2007 11:12 am UTC
Location: C:\Users\Xeio\

Re: Coding: Fleeting Thoughts

Postby phlip » Sat Jan 14, 2012 1:40 pm UTC

You pointed out most of the horribleness, but still:
Xeio wrote:
Code: Select all
string num
*stab*
While no one overhear you quickly tell me not cow cow.
but how about watch phone?
User avatar
phlip
Restorer of Worlds
 
Posts: 7186
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia

Re: Coding: Fleeting Thoughts

Postby Yakk » Sat Jan 14, 2012 3:51 pm UTC

Really? If it is a string containing a number (certainly? probably?), that sounds like a near perfect name for it (maybe a bit short, given how that could confuse someone, but still)
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.
User avatar
Yakk
Poster with most posts but no title.
 
Posts: 10448
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: Coding: Fleeting Thoughts

Postby phlip » Sat Jan 14, 2012 3:53 pm UTC

Ordinarily I'd give the benefit of the doubt, and assume that they had a perfectly good reason to be storing numbers as strings... but given the circumstantial evidence...
While no one overhear you quickly tell me not cow cow.
but how about watch phone?
User avatar
phlip
Restorer of Worlds
 
Posts: 7186
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia

Re: Coding: Fleeting Thoughts

Postby Xeio » Sat Jan 14, 2012 6:22 pm UTC

Well, the "number" is parsed from a longer string by a framework call, and for some unknown reason isn't parsed into an integer there directly, but I can't guarantee the same person wrote both things so I can only hate them for the code file I was looking at directly.

I replaced the lists with a boolean, since it only used Add, Clear, and "Count > 0" operations, so it didn't really matter what the data type was.
User avatar
Xeio
Friends, Faidites, Countrymen
 
Posts: 4811
Joined: Wed Jul 25, 2007 11:12 am UTC
Location: C:\Users\Xeio\

Re: Coding: Fleeting Thoughts

Postby Dason » Sat Jan 14, 2012 11:05 pm UTC

Whyyyyyy doesn't Debian support WPA for their net install. Grrrrrrrrrrrrrrrrrrrr.
double epsilon = -.0000001;
User avatar
Dason
 
Posts: 1293
Joined: Wed Dec 02, 2009 7:06 am UTC
Location: ~/

Re: Coding: Fleeting Thoughts

Postby You, sir, name? » Sat Jan 14, 2012 11:23 pm UTC

Dason wrote:Whyyyyyy doesn't Debian support WPA for their net install. Grrrrrrrrrrrrrrrrrrrr.


Probably licensing reasons. Same reason they ship a terrible and ancient fork of Firefox, rather than something that actually can understand modern web standards.
I now occasionally update my rarely-updated blog.

I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.
User avatar
You, sir, name?
 
Posts: 6569
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City

Re: Coding: Fleeting Thoughts

Postby headprogrammingczar » Sun Jan 15, 2012 3:16 pm UTC

Debian ships with the latest FF code. It's only the name and logo that conflict with Debian's copyright policy. The reason it ships with an old version of FF is their policy on testing vs stable.
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Weeks> You're the goddamn headprogrammingspock!
<Cheese> I love you
User avatar
headprogrammingczar
 
Posts: 3024
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

Re: Coding: Fleeting Thoughts

Postby mister_m » Sun Jan 15, 2012 10:35 pm UTC

I just got finished with the first ever programming interviews that I ever had. Needless to say, I was quite nervous during the interviews and a little distracted. Both of these companies had me do phone interviews before I came in that I did (I think) fairly well on. i could list some excuses as to why I didn't do too great during the physical interviews, but I think it'd be better to just accept that I was underqualified, and try to become qualified.

I'm still losing sleep over them, as they certainly revealed some weaknesses in my abilities.
User avatar
mister_m
 
Posts: 33
Joined: Fri Feb 04, 2011 2:51 am UTC

Re: Coding: Fleeting Thoughts

Postby Steax » Fri Jan 20, 2012 6:29 pm UTC

Not code, but design, but whatever. A large demo set of various fonts from Google Web Fonts, with only the good (i.e. more-than-incomplete families) fonts presented. Much better for picking fonts than viewing GWF directly.
In Minecraft, I use the username Rirez.
User avatar
Steax
SecondTalon's Goon Squad
 
Posts: 3037
Joined: Sat Jan 12, 2008 12:18 pm UTC

Re: Coding: Fleeting Thoughts

Postby PM 2Ring » Sat Jan 21, 2012 2:09 pm UTC

headprogrammingczar wrote:Debian ships with the latest FF code. It's only the name and logo that conflict with Debian's copyright policy. The reason it ships with an old version of FF is their policy on testing vs stable.


Looks like a more recent version has finally made it into the stable repo. I've just started the download; I hope it doesn't break anything... * fingers crossed *
User avatar
PM 2Ring
 
Posts: 3297
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Mid north coast, NSW, Australia

Re: Coding: Fleeting Thoughts

Postby moiraemachy » Mon Jan 23, 2012 1:01 am UTC

So... as somewhat of a noob at coding, I'm learning Python and everything was perfect. Except I stumbled in that "variables as tags, not boxes" thing, and it seems an unnecessary complication. I get it now, but still: why not pointers? The alleged complexity of handling pointers disappears when you have dynamic typing... just make the assignment operation mean "point to this data" when used in a pointer. Am I being stupid?
moiraemachy
 
Posts: 128
Joined: Wed Jan 04, 2012 9:47 pm UTC

Re: Coding: Fleeting Thoughts

Postby joshz » Mon Jan 23, 2012 3:07 am UTC

I mean, so that's not necessarily a bad way to think of python variables. I'm not sure if that's how it's handled in practice for all types, but it does handle many types like that.

For many people, pointers are confusing, so the boxes analogy is popular (or I guess tags too, though I've never heard that before.)
You, sir, name? wrote:If you have over 26 levels of nesting, you've got bigger problems ... than variable naming.
suffer-cait wrote:it might also be interesting to note here that i don't like 5 fingers. they feel too bulky.
User avatar
joshz
 
Posts: 1466
Joined: Tue Nov 11, 2008 2:51 am UTC
Location: Pittsburgh, PA

Re: Coding: Fleeting Thoughts

Postby RoadieRich » Mon Jan 23, 2012 3:32 am UTC

joshz wrote:I mean, so that's not necessarily a bad way to think of python variables. I'm not sure if that's how it's handled in practice for all types, but it does handle many types like that.

For many people, pointers are confusing, so the boxes analogy is popular (or I guess tags too, though I've never heard that before.)

I don't know about the actual implentation details, but if you thinking of them as pointers, you won't go too far wrong.

The only time it changes is for new style classes with appropriate magic methods defined, when o.a=x can call o.__setattr__('a', x) or a.__set__(o, x), and o[i]=x, which calls o.__setitem__(i,x), all of which can do just about anything. I don't think it's possible to override the straight a=b, though. The += operator et al, on the other hand...
roband wrote:Mav is a cow.

UniJam 2012: Inter-university Games Jam hosted by Nottingham Trent University DevSoc.
nlug: Nottingham Linux User Group
DevSoc: The Nottingham Trent University Software Development Society
User avatar
RoadieRich
The Black Hand
 
Posts: 1030
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Somewhere only we know

Re: Coding: Fleeting Thoughts

Postby troyp » Mon Jan 23, 2012 10:50 am UTC

moiraemachy wrote:So... as somewhat of a noob at coding, I'm learning Python and everything was perfect. Except I stumbled in that "variables as tags, not boxes" thing, and it seems an unnecessary complication. I get it now, but still: why not pointers? The alleged complexity of handling pointers disappears when you have dynamic typing... just make the assignment operation mean "point to this data" when used in a pointer. Am I being stupid?

As others have pointed out, variables in Python do work like pointers (or rather references, ie. pointers that are taken and dereferenced automatically). And as you've noticed, these references are untyped - a particular variable can point to any type of data at all. One thing I think I should point out is that this is the essence of dynamic typing. A dynamically typed language is one whose "variables" are untyped references (or at least something similar).

I'm not sure what's confusing you about the "boxes vs tags" explanation: I haven't heard that before. It sounds about right, but "tag" seems subtly misleading to me...I tend to think of Python variables simply as "names" (and names, of course, are the original pointers).

RoadieRich wrote:The only time it changes is for new style classes with appropriate magic methods defined, when o.a=x can call o.__setattr__('a', x) or a.__set__(o, x), and o[i]=x, which calls o.__setitem__(i,x), all of which can do just about anything. I don't think it's possible to override the straight a=b, though. The += operator et al, on the other hand...

Yeah, I think it's best to regard attributes and methods as distinct from variables. Assigning a value to a variable has a simple, unambiguous meaning: that the variable name now refers to that object. Assigning a value to an attribute could mean anything.
troyp
 
Posts: 529
Joined: Thu May 22, 2008 9:20 pm UTC
Location: Lismore, NSW

Re: Coding: Fleeting Thoughts

Postby PM 2Ring » Mon Jan 23, 2012 11:46 am UTC

moiraemachy wrote:So... as somewhat of a noob at coding, I'm learning Python and everything was perfect. Except I stumbled in that "variables as tags, not boxes" thing, and it seems an unnecessary complication. I get it now, but still: why not pointers? The alleged complexity of handling pointers disappears when you have dynamic typing... just make the assignment operation mean "point to this data" when used in a pointer. Am I being stupid?

No, your not being stupid. As an old C (and assembler) programmer, I quite like pointers. But I also like the Python approach of associating names to objects.
Also see Python Question / References and such
User avatar
PM 2Ring
 
Posts: 3297
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Mid north coast, NSW, Australia

Re: Coding: Fleeting Thoughts

Postby TheChewanater » Tue Jan 24, 2012 9:47 pm UTC

Has anyone seen Rust yet?
ImageImage
http://internetometer.com/give/4279
No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.
User avatar
TheChewanater
 
Posts: 1286
Joined: Sat Aug 08, 2009 5:24 am UTC
Location: lol why am I still wearing a Santa suit?

Re: Coding: Fleeting Thoughts

Postby b.i.o » Tue Jan 24, 2012 10:46 pm UTC

Yes.
User avatar
b.i.o
Green is the loneliest number
 
Posts: 2520
Joined: Fri Jul 27, 2007 4:38 pm UTC
Location: Hong Kong

Re: Coding: Fleeting Thoughts

Postby troyp » Wed Jan 25, 2012 12:39 am UTC

I just discovered J is now GPL3!

I'm a bit surprised, I had the impression Jsoftware made a lot of their money selling the source as insurance to companies that were heavily invested in it, so this could cost them - in the short term at least. Although long-term, it's probably a good move: this could really make J the king of the APL family, and the implementation will definitely benefit.

Anyway, I don't care why. I 3> you Jsoftwaaaare.
I am so going to start playing with this again now...
troyp
 
Posts: 529
Joined: Thu May 22, 2008 9:20 pm UTC
Location: Lismore, NSW

Re: Coding: Fleeting Thoughts

Postby Jplus » Wed Jan 25, 2012 2:54 pm UTC

TheChewanater wrote:Has anyone seen Rust yet?

Now I have, thank you.

Is there an online document that explains why this language exists? Because, I don't see any strong advantages over C++.
Feel free to call me Julian. J+ is just an abbreviation.
Image coding and xkcd combined
User avatar
Jplus
 
Posts: 1558
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: classified

Re: Coding: Fleeting Thoughts

Postby b.i.o » Wed Jan 25, 2012 4:56 pm UTC

Jplus wrote:Is there an online document that explains why this language exists? Because, I don't see any strong advantages over C++.

From the GitHub Wiki:
What is this project's goal, in one sentence?
To design and implement a safe, concurrent, practical, static systems language.

I think the differences are in the first two. Rust, unlike C++, deals with memory safety for you, and also has a GC that you can use if you want to. It also has some other interesting things happening like typestates, which, as far as I understand them (not very far), are kind of like compile-time assertions. Rust also has strong built-in support for concurrency. Things are immutable by default, and there's support for message-passing concurrency. (I know there are ways to do concurrency in C++ too, but the whole of the Rust language is designed at the ground up with doing concurrency safely.)
User avatar
b.i.o
Green is the loneliest number
 
Posts: 2520
Joined: Fri Jul 27, 2007 4:38 pm UTC
Location: Hong Kong

PreviousNext

Return to Coding

Who is online

Users browsing this forum: chridd and 13 guests