Programming @4-ch

Programming @4-ch

Be it HTML, C++, Java or whatever language you prefer, programming is what we do best around this board.
Markup languages are also fine around here, as with all the "not so real" languages of Shell script, CSS, and other various third party scripting languages.
  • We are sick of language discrimination, more so the PHP/Java bashers. There will be little tolerance of blatant and repetitive insults. You are still welcome to bring forward a sensible, insult-free argument regarding a certain topic at the appropriate time and place for it.
  • Please use WakabaMark or the appropriate HTML tags (with HTML enabled, of course) to format your code.
Rules · 規則
基本的には英語の使用を強く希望します。ただ日本語板の場合は日本語か英語。
Board look: Blue Moon Buun Futaba Headline Mercury Pseud0ch Toothpaste

C vs C++ vs Lisp (156)

1 Name: #!/usr/bin/anonymous : 2008-06-13 12:52 ID:NJsTUwig

At first, I decided to try learning C++, then I heard C was "better", now I'm hearing Lisp is good. I'm getting annoyed with indecisiveness, so I'm going to ask this one last time... Which language would be best to learn out of these three? My intentions in programming will be small projects, game mods, network applications and other things of that sort. What would you all recommend out of those three, and why? Not looking for anything outside the above three.

Please halp.

147 Name: #!/usr/bin/anonymous : 2008-08-26 12:13 ID:y0eC44mJ

> And you have yet to offer a counter-definition. So far all you have done is misapplied the implementation of OOP concepts in specific circumstances to specific languages to incorrectly say that there is no way to define OOP and that all languages are OOP and not OOP at the same time.

You keep saying that the onus is on me to do so. You're the one making a broad claim. You seem to think it's all wrapped up in some magic definition of "identity" that you can't point to on another page; that you must describe in prose here, on 4-ch.

Why do you think no one has ever tried to define object-oriented in the way you are doing now? Why do you think you can't point to an authority (like Alan Kay) who agrees with you?

Why can you not use anyone of considerable merit's definitions on this subject? Does this suggest no real programmer does object oriented programming? Or is it simply more likely, that you have no idea what you're talking about

148 Name: #!/usr/bin/anonymous : 2008-08-26 16:43 ID:Ixw2SuFv

>Why do you think you can't point to an authority (like Alan Kay) who agrees with you?

See, there you were able to give what you feel is a definition of OOP.

Here is a neat email exchange between him and an author:
http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en

>OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things.

So there, Alan Kay says C++ isn't OOP to him because it doesn't do EXTREME late binding in all things.

I mean my whole thing was that C++ want to create new unique instances of objects when passing it to another scope unless the developer implements mechanisms to maintain an objects uniqueness and that it would be better if it was the other way around because objects are a unique instance of a class.

Post too long. Click to view the whole post or the thread page.

149 Name: #!/usr/bin/anonymous : 2008-08-26 16:47 ID:m2TJrD+R

> See, there you were able to give what you feel is a definition of OOP.

I did not.

I said I would accept Alan Kay as an authority. I chose him on purpose because his definition of OOP is incompatible with yours.

> Here is a neat email exchange between him and an author:

http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en

HTTP/1.1 403 Access Denied.

> I mean my whole thing was that C++ want to create new unique instances of objects when passing it to another scope unless the developer implements mechanisms to maintain an objects uniqueness and that it would be better if it was the other way around because objects are a unique instance of a class.
Post too long. Click to view the whole post or the thread page.

150 Name: #!/usr/bin/anonymous : 2008-08-26 21:04 ID:Ixw2SuFv

>http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en

HTTP/1.1 403 Access Denied.

Wow, that site doesn't like 4-ch

Google: alan kay object oriented programing definition
first result

>First of all, C++ programmers don't do that.

That is true, they have to implement extra features of the language to use objects properly.

Lets say I want to paint my house.

Post too long. Click to view the whole post or the thread page.

151 Name: #!/usr/bin/anonymous : 2008-08-26 23:25 ID:y0eC44mJ

> Success! My house is painted without extra steps. All I had to do was type an asterix (or I could have even done an ampersand).

You actually need an ampersand. What you wrote isn't valid C++. Person::Paint(House *foo) needs to be called as me.Paint(&myhouse);. Inside Person::Paint(House *foo), foo can be manipulated with ->

Many C++ programmers find it useful; if they're using -> it means they don't own the object and should be careful about stashing it anywhere.

> The thing is, why does the language want me to work with myhouse with value type semantics in the scope is was declared and then implement reference type semantics myself when passing to another scope.

I don't think you understand what you're saying. Inside Person::Paint(House &foo), foo is manipulated as if it were in the parent scope- using ..

Post too long. Click to view the whole post or the thread page.

152 Name: #!/usr/bin/anonymous : 2008-08-27 15:18 ID:Heaven

>>150 "(To link to this page, please use the canonical URI "http://www.purl.org/stefan_ram/pub/doc_kay_oop_en" only, because any other URI is valid only temporarily.)"

153 Name: 150 : 2008-08-28 01:17 ID:y0eC44mJ

Thanks >>152 , but I'm still getting access denied.

Any mirrors?

154 Name: #!/usr/bin/anonymous : 2008-08-28 12:37 ID:Heaven

>>153
Just copy and paste the url, or turn off your referrer header. Works fine.

155 Name: 150 : 2008-08-28 14:18 ID:Heaven

>>154

Tried that. Still doesn't work.

156 Name: 150 : 2008-08-28 14:20 ID:Heaven

>>154

Tried it using another network and was able to get it... weird.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

INSTANT REVIEWS of programming languages (284)

1 Name: !WAHa.06x36 05/01/04(Tue)01:33 ID:XYxTySqa [Del]

INSTANT REVIEW: C

You can complain all you want, it's not going anywhere anytime soon.

275 Name: #!/usr/bin/anonymous : 2008-02-12 14:20 ID:Heaven

>>274
massive fail

276 Name: #!/usr/bin/anonymous : 2008-02-13 18:42 ID:Heaven

>>274 "Don't quote tired old memes" is in itself a tired old meme.

277 Name: #!/usr/bin/anonymous : 2008-08-14 22:00 ID:74p6ockq

INSTANT REVIEW: Io

Javascript done right, but these objects are too slow :(

278 Name: #!/usr/bin/anonymous : 2008-08-21 04:30 ID:pVJ0gVPq

<b>INSTANT REVIEW: C#/Java</b>

Slower than C, more memory use than Python, less libraries than Perl. Serves no technical purpose.

279 Name: #!/usr/bin/anonymous : 2008-08-24 00:14 ID:qVp/RhSv

[b]INSTANT REVIEW: C#/Java[/b]

Popularity through marketing has one huge advantage for the programmer: thousands and thousands of employment opportunities, so you can hack on Haskell/Ruby/YourFavoriteToyLanguage in your spare time.

280 Name: #!/usr/bin/anonymous : 2008-08-24 10:38 ID:UkP80jsH

INSTANT REVIEW: PostScript
{(Why talk to people when there is printers?)=} loop

281 Name: #!/usr/bin/anonymous : 2008-08-24 14:17 ID:Heaven

>>280

close! You need a space between the = and the )

282 Name: #!/usr/bin/anonymous : 2008-08-24 15:29 ID:Heaven

>>281

Ghostscript is more forgiving then this board.

283 Name: #!/usr/bin/anonymous : 2008-08-27 16:01 ID:5+Rn0sCo

still more forgiving than DQN's elitist superstructure

284 Name: #!/usr/bin/anonymous : 2008-08-28 00:19 ID:EGX9muy3

INSTANT REVIEW: Java

When you want to create apps(shit) like Runescape.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

Preferred Editor(s) (101)

1 Name: #!/usr/bin/anonymous : 2008-05-21 13:03 ID:/y/PlSFi

What's your favorite IDE/text editor when it comes to programming? Also, what's the setup in the banner up top? http://static.4-ch.net/images/boardtitles/programming.gif, that is.

92 Name: 88 : 2008-08-07 12:03 ID:njBRasrM

> Yes, automating a task will remove incentive to do that task.

So you agree that autodocumentation decreases the quality of good literate documentation, you simply disagree when I say bad autodocumentation is worse than no documentation?

> Depending on the scope of an API that is not always reasonable.

Wrong. Making a good and solid API is always reasonable, and sacrificing code quality and robustness causes other problems that your precious autodocumentation cannot fix.

> How is one supposed to know if the argument is a fully qualified path, or a relative path to some other directory?

That's insane. How does POSIX.1 open() know? How does Common-Lisp's make-pathname know? How does Boost.Filesystem know?

Pick a different example besides relative paths. This is a solved problem; a strawman at best, and a demonstration that your whole argument is without merit at worst.

Post too long. Click to view the whole post or the thread page.

93 Name: #!/usr/bin/anonymous : 2008-08-07 17:10 ID:T285NeS2

>>1

Banner is definitely TextMate, Monaco non-anti-aliased 10px. Mac classic theme.

94 Name: #!/usr/bin/anonymous : 2008-08-25 07:02 ID:mLoeKCeT

I love Sudden View, unfortunately it's rather archaic and Windows-only.

95 Name: #!/usr/bin/anonymous : 2008-08-25 20:59 ID:UGXKGZUt

XML comment:

/// <summary>
/// Summary of LoadXMLFromFile.
/// </summary>
/// <param name="FilePath">Description of FilePath parameter.</param>
public void LoadXMLFromFile(string FilePath)

Non-XML comment
/* Summary of LoadXMLFromFile
*
* @param Filepath Description of FilePath parameter.
**/
public void LoadXMLFromFile(string FilePath)

Post too long. Click to view the whole post or the thread page.

96 Name: #!/usr/bin/anonymous : 2008-08-26 08:43 ID:m2/rYnhV

>>95
And when it's that obvious from the function and variable names what's what, adding the comment at all actually reduces readability of the source.

97 Name: #!/usr/bin/anonymous : 2008-08-26 22:41 ID:UGXKGZUt

>>96

Even a simple function like that needs documentation. Is FilePath absolute or relative? Should it be in Unicode, or the local filename encoding? What exceptions will be raised if the data cannot be loaded? Why is the return type "void" instead of the data, is it modifying private variables? If so, which ones?

When somebody says that a function's purpose is obvious, what they actually mean is "I'm too lazy/ignorant to figure out what that function does".

98 Name: #!/usr/bin/anonymous : 2008-08-26 22:52 ID:WSPjSt/9

>>97

> Even a simple function like that needs documentation.

If it's a library function, and the source isn't available, I agree completely. However, that isn't a case for xml automatic documentation.

> Is FilePath absolute or relative?

If it matters, the function is wrong.

> Should it be in Unicode, or the local filename encoding?

If it matters, the function is wrong. This is more a symptom that the Windows API is designed by brain-damaged 3 year olds.

Post too long. Click to view the whole post or the thread page.

99 Name: #!/usr/bin/anonymous : 2008-08-27 06:36 ID:OBizW2LK

> If it's a library function, and the source isn't available, I agree completely. However, that isn't a case for xml automatic documentation.

Why isn't it? Auto documentation, XML-based or not, is also used for documenting libraries.

>> Is FilePath absolute or relative?
> If it matters, the function is wrong.

In this case, document how relative paths are resolved. Common roots I've seen are the user's home directory, their desktop, the location of the application binary, filesystem root, etc.

> On unix: Doesn't fucking matter. Assume all paths are binary blobs unless you have to print them, at which point, they're utf-8.

At which point, everybody using a non-UTF8 locale can't read their files.

Post too long. Click to view the whole post or the thread page.

100 Name: #!/usr/bin/anonymous : 2008-08-27 12:08 ID:WSPjSt/9

> Why isn't it? Auto documentation, XML-based or not, is also used for documenting libraries.

That doesn't mean it's good at it. Read back in this thread, through >>80,82,83,85,86,87,88,90,91,92

Recap: Automatic documentation makes it easy to extract structured information. Unfortunately, that doesn't make it useful, and because people rely on automatic documentation, they have a tendency to let "the real" documentation slip.

As a result, sites that use autodocumentation, tend to have worse documentation than sites that don't.

> In this case, document how relative paths are resolved. Common roots I've seen are the user's home directory, their desktop, the location of the application binary, filesystem root, etc.

See POSIX.1 to see how relative paths are resolved. On UNIX, the current-directory is per-process, so this is a non-issue.

Post too long. Click to view the whole post or the thread page.

101 Name: #!/usr/bin/anonymous : 2008-08-27 19:29 ID:UGXKGZUt

autodocumentation is ok. if its good enough for python and qt its good enough for me.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

Tcl/Tk (19)

1 Name: #!/usr/bin/anonymous : 2008-08-24 01:33 ID:LD6S4lTz

Tcl is one of the most underrated computer languages today.

It has a weird syntax, but on the other hand the syntax makes it more extensible than any other language besides the Lisp family.

Tk is reputed for it's antique-looking widgets. However with the latest 8.5 releast TTk, Themeable Tk is the default which means native look on Vista, XP, OSX. (Not Linux though, but what can you call native there anyway?)

So if you don't know Tcl yet, go and learn it. It's extremely simple, has an interactive shell, and will expand your mind... much more than learning most other languages!!

Tcl/Tk rocks!

See http://www.tcl.tk/

11 Name: #!/usr/bin/anonymous : 2008-08-25 18:44 ID:Heaven

>>10

Wow.

Stallman is sensible sometimes?

12 Name: #!/usr/bin/anonymous : 2008-08-28 01:43 ID:Heaven

Python has a peculiar syntax that appeals to hackers because of its
simplicity. But Python syntax seems strange to most users. If Python does
become the "standard scripting language", users will curse it for
years--the way people curse Fortran, MSDOS, Unix shell syntax, and
other de facto standards they feel stuck with.

13 Name: #!/usr/bin/anonymous : 2008-08-28 11:48 ID:Heaven

>>12

What syntax do you think appeals to users?

14 Name: #!/usr/bin/anonymous : 2008-08-28 13:03 ID:Heaven

> But Python syntax seems strange to most users.

Who are these "most users"? C programmers? Unix sysadmins who end up writing a few lines of code every once in a while? Or the casual computer users who occasionally dabble in some sort of programming (e.g. as an extension language to some game) solely for entertainment purposes? Whether or not Python, and any language, for that matter, seems "strange" is fully dependent on the languages that person is already familiar with -- if any. For someone who hasn't ever programmed before, of course any programming language will seem a bit difficult to get the hang of, but the ones that translate easiest from English (such as BASIC, Python, Applescript, Lua, perhaps Tcl) will generally be easiest to pick up on, and those with a less immediately readable syntax (for example, C, Haskell, Lisp, or god forbid, APL) will be somewhat more difficult.

The only people I see cursing Python's syntax are those who seem to think lambdas are restricted because they can't have statements (get over it, you can do anything with lambda that you can do with a def, trust me) or who have some hangup about the indentation (because they don't indent?)
People criticize Tcl mostly because it's slow as molasses -- although I must admit it has greatly improved in the last several years -- and that it is a particularly restrictive and difficult language for creating anything with any level of complexity. Projects using Tcl quickly become unpleasant and needlessly complicated.

15 Name: #!/usr/bin/anonymous : 2008-08-28 14:26 ID:Heaven

>>14

> The only people I see cursing Python's syntax are those who seem to think lambdas are restricted because they can't have statements (get over it, you can do anything with lambda that you can do with a def, trust me)

Why should I trust you?

You think the only complaint about Python's syntax is having two different languages (one of statements and one of expressions), and having to know each one in order to write code a certain way.

Why should I trust you?

You've never seen anyone complain about connecting assignment and lexical scope. You've never seen anyone complain about extra [0] and creating extra references, making many algorithms ugly.

Post too long. Click to view the whole post or the thread page.

16 Name: dmpk2k!hinhT6kz2E : 2008-08-28 19:17 ID:Heaven

> Python has a peculiar syntax that appeals to hackers because of its simplicity.

Compared to what?

http://svn.python.org/view/*checkout*/python/trunk/Grammar/Grammar?rev=65872

That's not particularly simple.

17 Name: #!/usr/bin/anonymous : 2008-08-29 11:27 ID:Heaven

>>15
Jeez, you're bitchy. I take back my previous statement. Take some Midol.

18 Name: #!/usr/bin/anonymous : 2008-08-29 21:18 ID:Heaven

>>17

Well fuck you too.

You want to dump on my favorite language? I'll dump on yours.

Lisp is more readable than python. It has fewer parenthesis, and is easier to post/copy/paste into forums with fewer mistakes.

19 Name: #!/usr/bin/anonymous : 2008-08-30 00:08 ID:Heaven

>>18
Who the hell said it was my favorite language, and where did you ever read in my post that I didn't like lisp?

Get off the internet.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

Limited ammo in Inform (16)

1 Name: #!/usr/bin/anonymous : 2008-08-01 22:11 ID:3w7Q5nhm

I wasn't sure if this belonged on "Games" or "Programming," but I figured it would more likely belong in "Programming." Feel free to move it if you feel this is the incorrect place for this topic.

http://www.inform-fiction.org/I7/Welcome.html

I am making a text adventure, and I have a pistol. But I want the pistol to have limited ammo. Could you tell me how to do that, please?

7 Name: #!/usr/bin/anonymous : 2008-08-07 09:12 ID:Heaven

>>4
you don't need a google account to post there. it's a freaking usenet group.
Use any NNTP client to post at rec.arts.int-fiction.

8 Name: #!/usr/bin/anonymous : 2008-08-08 05:16 ID:3w7Q5nhm

>>7 Oh. That's good, except now I have another problem. I viewed some of the user's profiles, and on each of them, their e-mail address were visible. You can't hide your e-mail address? I do not want anybody, except the people I e-mail, to know my e-mail address. It's for privacy reasons.

9 Name: #!/usr/bin/anonymous : 2008-08-08 05:48 ID:Heaven

>>8
It doesn't have to be a real e-mail address.

10 Name: #!/usr/bin/anonymous : 2008-08-08 20:14 ID:LKsvKhAs

You make me sick

11 Name: #!/usr/bin/anonymous : 2008-08-12 05:36 ID:3w7Q5nhm

>>8 I'm not sure, but wouldn't that be a violation of the user agreements? Even if it isn't, I don't feel like making up an e-mail address.

>>9 Who is making you sick, and why? Is it me who's making you sick?

12 Name: #!/usr/bin/anonymous : 2008-08-18 05:59 ID:Heaven

>>11 hotmail accounts are free and disposable. I mean really.

13 Name: #!/usr/bin/anonymous : 2008-08-22 21:30 ID:Heaven

>>11

Presumably he is sick because you are using an entire suite to make a text-based game, not to mention your lack of knowledge concerning Kareha.

14 Name: #!/usr/bin/anonymous : 2008-08-24 06:55 ID:g31/KTVL

1) have 'pistolAmmo' variable or something; when player picks up the pistol set this to the number of rounds they should start with
2) every time the player shoots the pistol, check if pistolAmmo is 0; if so, print 'pistol ran out' or something, and if not, subtract 1 from it and run the code to shoot it
3) you have no fucking reason to use a suite for a text-based program, the stuff you need to make one is damned simple and practically any language out of the box is more than cut out for this

but honestly if you need to ask this then please, please tell me you are under 10 years old

15 Name: #!/usr/bin/anonymous : 2008-08-25 02:08 ID:Heaven

this thread proof that /code/ is shit and can't understand the value of dsls.

16 Name: #!/usr/bin/anonymous : 2008-08-25 06:11 ID:Heaven

BUT ITS AN ENTIRE SUITE. C IS JUST ONE LETTER. USE C.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

Structs in C (22)

1 Name: #!/usr/bin/anonymous : 2008-08-17 13:59 ID:zgDebgn6

I was just wondering if structs in C is the something like objects in OOP, just with less functionality (no methods, privates etc), and if so, are they used the same way?

If not, how would you describe structs, and what would be a good example of how to use them

thanks =)

13 Name: #!/usr/bin/anonymous : 2008-08-20 00:39 ID:Heaven

I'm >>5 and >>7.
Everyone is clueless. When you write object X you are guaranteed to read back object X from a file stream in C and C++ (IO errors can happend, but they are not relevant)

The isssues addressed by >>12 are not even relevant! You've all missed the point!

Are there really that few people that know C or C++ well here?

>>8
fread takes 2 integers, size of individual member and number of members.
That way it can handle 'different word lengths'. (or any object length actually)

As for endianness, it's not even mentioned in the C standard (nor in the C++ standard)
What C (and C++) guarantees is about a particular implementation writing and reading back representations.

Post too long. Click to view the whole post or the thread page.

14 Name: #!/usr/bin/anonymous : 2008-08-21 04:20 ID:dogyim57

>>4

Anybody who actually follows this idiotic advice is going to be surprised as hell when they try to port it and 0x000001 turns into 0x1000000

15 Name: 4 : 2008-08-21 14:27 ID:GBKCJlpT

>>13

When you write a C++ object, and read it back in, the classtype/vtables/method pointers could be overwritten. The C++ standard doesn't guarantee that they won't be, and for some kinds of objects and some compilers, they actually will be.

That's the point.

>>14

Someone better tell Oracle, Sun, Microsoft, and GNU. All of these groups produce applications with non-portable data files. Supporting portable data files is exceptionally difficult, and it's usually easier (if the data is necessary) to simply write a convertion tool.

16 Name: dmpk2k!hinhT6kz2E : 2008-08-21 18:00 ID:Heaven

> That way it can handle 'different word lengths'.

I meant reading a file that was written on a 32-bit machine with a 64-bit one. Or vice versa. Or 16-bit. Nowadays we have computers that have modes with any of those three word lengths.

> As for endianness, it's not even mentioned in the C standard (nor in the C++ standard)

If it isn't mentioned in a standard it doesn't exist?

I don't have a problem dumping structs like that to disk or a socket (done it myself for local apps), but that attitude is plain retarded.

17 Name: #!/usr/bin/anonymous : 2008-08-21 18:25 ID:Heaven

>>16

Generally for those types of apps, I recommend a ASN.1 compiler, or similar. They can write C code to portably convert a data structure into a byte-stream (and back again), and in some cases the C code is very efficient- relying on compile-time knowledge of word sizes and endian that human-written "portable" C code wouldn't bother with.

18 Name: dmpk2k!hinhT6kz2E : 2008-08-21 18:47 ID:Heaven

Interesting. Thanks.

19 Name: #!/usr/bin/anonymous : 2008-08-21 18:56 ID:NLHLsI0U

>>15

> Someone better tell Oracle, Sun, Microsoft, and GNU. All of these groups produce applications with non-portable data files. Supporting portable data files is exceptionally difficult, and it's usually easier (if the data is necessary) to simply write a convertion tool.

Got a source for which Sun/GNU applications in particular use non-portable data files? Considering both organizations provide applications that must work on a variety of platforms, I don't think you're correct.

Supporting portable data files is easy as falling over. In case you haven't noticed, there's no such thing as a PC-only .jpg or Mac-only .zip

20 Name: #!/usr/bin/anonymous : 2008-08-21 20:34 ID:GBKCJlpT

>>19

> Got a source for which Sun/GNU applications in particular use non-portable data files? Considering both organizations provide applications that must work on a variety of platforms, I don't think you're correct.

Off the top of my head:

  1. GNU Emacs's dump files aren't binary-portable.
  2. SUN's MySQL data files (InnoDB and MyISAM) aren't binary-portable if they contain FLOAT or DOUBLE fields

In fact, most cache file formats aren't binary portable simply because it isn't worth it- the files can be regenerated easily enough.

Databases are infrequently binary-portable (PostgreSQL isn't binary-portable at all) because it's a huge performance loss. They usually detect the problem (because that's cheap), and include a conversion tool, so this really is a smaller deal than you might otherwise think.

Post too long. Click to view the whole post or the thread page.

21 Name: #!/usr/bin/anonymous : 2008-08-22 13:08 ID:55EZaZjr

> fread takes 2 integers, size of individual member and number of members.
> That way it can handle 'different word lengths'. (or any object length actually)

Did I miss something here? What does taking two parameters and multiplying them together have to do with, well, anything except argument inflation?

22 Name: #!/usr/bin/anonymous : 2008-08-28 11:36 ID:Heaven

>>21

Nothing. Why do you ask?

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

Python users are dumb (or not) (47)

1 Name: #!/usr/bin/anonymous : 2007-12-12 04:03 ID:NjnPqTOr

Hello /code/. Why don't we argue about Python's significant whitespace in this thread instead of derailing other threads over the matter?

Personally, I like it. I don't find it any more difficult or annoying using an extra tab rather than curly braces to delimit blocks, and the resulting code looks nicer and easier to follow for me. Mismatched spaces/tabs in Python and unclosed braces in other languages have bitten me in the ass equally often, and a good text editor with syntax highlighting will minimize both issues.

Does it really take expert programmers - which I'll freely admit I'm not - three times as long having to indent their blocks instead of surround them with braces?

38 Name: #!/usr/bin/anonymous : 2008-04-07 19:05 ID:Heaven

>>37

Not that he's listening, but no, no I don't.

I use improperly indented code all the time as a visual cue to mark lines of code that are temporary - debugging lines that I'll remove soon, quick kludges, tests, that kind of thing. Making those stand out and look ugly really helps.

39 Name: #!/usr/bin/anonymous : 2008-04-07 20:56 ID:Heaven

>>37

He also said:

"one of my reasons against adding Scheme-style continuations to the language is that it can't be implemented in a JVM. I find the existence of Jython very useful because it reminds me to think in terms of more abstract language semantics, not just implementation details."

You can't appeal to him as an authority because he's wrong twice as often as he's right.

40 Name: #!/usr/bin/anonymous : 2008-04-07 23:31 ID:Heaven

> "one of my reasons against adding Scheme-style continuations to the language is that it can't be implemented in a JVM"

Someone best let the Scala developers know they're violating the laws of computation, then.

Or are Responders not Scheme-style?

41 Name: #!/usr/bin/anonymous : 2008-04-10 12:20 ID:LhPV/rOF

Don't even need to go that far. SISC supports the entire R5RS and runs on Java.

42 Name: #!/usr/bin/anonymous : 2008-08-21 04:48 ID:+XwgTHd1

>>34

> becomes homoiconic

In other words, "becomes Lisp"

> gets conditions

Conditions are just syntactic sugar for continuations.

> doesn't conflate variable definition with assignment

In Python, there is no such thing as variable definition.

> gets real lambdas
Post too long. Click to view the whole post or the thread page.

43 Name: dmpk2k!hinhT6kz2E : 2008-08-21 07:23 ID:Heaven

> In other words, "becomes Lisp"

Lisp isn't the only homoiconic language.

> Conditions are just syntactic sugar for continuations.

Let me know when I can resume from an exception in Python. Let me know when CPython has continuations for that matter; right now the closest it comes is one-shot with generators (aka coroutines). Stackless has them, but nobody except CCP Games uses it.

> In Python, there is no such thing as variable definition.

They just appear out of thin air then? poof! No, the act of assigning to a variable creates it. That's a problem.

> Explain how lambda is lacking compared to Lisp's?
Post too long. Click to view the whole post or the thread page.

44 Name: #!/usr/bin/anonymous : 2008-08-21 14:20 ID:rZf/6roK

> Conditions are just syntactic sugar for continuations.

CL has conditions, but no continuations. Python doesn't have callable continuations or conditions. Conditions work something like this:

handle Foo:
do stuff when Foo is signalled
restart Baz
do:
do stuff
r = signal Foo (Baz)
if r is Baz:
do stuff here
else:
never reached

but it's admittedly ugly in this pseudo-python. I don't know if that can be improved; usually the problems with conditions are resolved by special-purpose macros for certain kinds of conditions (out of memory, file exists, etc), instead of using the primitive elements each time.

Post too long. Click to view the whole post or the thread page.

45 Name: #!/usr/bin/anonymous : 2008-08-21 18:51 ID:S9YglUSi

> Stackless has them, but nobody except CCP Games uses it.

I use it every day. Maybe it's not big for hobbyists, but it's used often when a company needs heavy concurrency but can't use Erlang for whatever reason. PyPy also has support for continuations.

> They just appear out of thin air then? poof! No, the act of assigning to a variable creates it. That's a problem.

That's not a problem, that's a fundamental part of the language. All scopes are simple key:value mappings. If you had to declare variables, you'd also have to declare which values are allowed in a dictionary.

Variable allocation and declaration are separate issues.

> Well, for one, Lisp doesn't distinguish between statements and expressions. Python does. Python's lambdas cannot contain statements, so trivial things like assignment don't work (or if, or while, or...).
Post too long. Click to view the whole post or the thread page.

46 Name: dmpk2k!hinhT6kz2E : 2008-08-21 21:22 ID:Heaven

> Maybe it's not big for hobbyists

Seriously now, it's not big for anyone outside of a few users. The vast majority of the Python-using population uses CPython. If I make my own fork of CPython that has pattern matching, can you rightfully say Python supports it?

> that's a fundamental part of the language.

Which is a problem. If you want to write to a variable in an outer scope you have to use something like the list hack. What if you assign to a mis-typed variable? Why does Python not have a block scope?

> All scopes are simple key:value mappings.

It is easy and inexpensive for the interpreter to check the existence of a hash key before assigning to it.

> Variable allocation and declaration are separate issues.
Post too long. Click to view the whole post or the thread page.

47 Name: #!/usr/bin/anonymous : 2008-08-21 22:17 ID:Heaven

> Simple three-minute example: duplicate file scanner
>
> http://slickorslack.com/codes/73

That looks hideously unpythonic. You ought to be ashamed of yourself.

The "correct" answer to questions regarding Python's lack of power is that "There's one Right way to do it, and your way is hard to read"

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

CSS (15)

1 Name: #!/usr/bin/anonymous : 2008-07-18 23:31 ID:23cd/noT

i dunno, i've been doing some web shit recently. and is it just me or is CSS a bit of a pain? there's the occasional thing that should be incredibly simple to do but really is either impossible or requires a mountain of fucking code to get around it

6 Name: #!/usr/bin/anonymous : 2008-07-19 20:35 ID:Heaven

For anyone who's mucking with css based stuff, I highly recommend The Zen of CSS Design. It's by the folks that did the CSS Zen Garden and shows how a lot of the stylesheets work, various tricks, how to get a design from concept phase to implementation without a lot of clumsy coding, etc. Worth the money.

7 Name: #!/usr/bin/anonymous : 2008-07-23 15:50 ID:Heaven

Firebug

8 Name: #!/usr/bin/anonymous : 2008-08-01 00:18 ID:XHjZEbdC

>>6

I totally agree, it made the scales fall from my eyes.

9 Name: #!/usr/bin/anonymous : 2008-08-01 00:19 ID:XHjZEbdC

And CSS might seem like a hassle at first, but if you're having to make site-wide changes, or want people to be able to switch styles and stuff, it's a wonderful thing.

10 Name: #!/usr/bin/anonymous : 2008-08-01 00:28 ID:DsC21of3

>it's a lot better than what it replaced.

This is true.

Still think that CSS can be a chore to work with depending on what one is trying to achieve. It can require fighting, frustration, and hacks. It's not always straightforward even if you know what you're doing. Also throw in trying to get the layout to look OK in different browsers and it can definitely lead to some headaches. This isn't really the fault of CSS though, but it's a problem nonetheless.

11 Name: #!/usr/bin/anonymous : 2008-08-19 09:41 ID:gM4vckk9

CSS is pointless beyond site-wide text rendering, which is easy. The web is a bad format for actual design like you see in magazines - it degrades painfully and often makes websites impossible to view in earlier or text-only browsers. Not to mention most "designers" don't understand it from a usability standpoint and use bad color combinations that make reading text difficult for the colorblind.

12 Name: #!/usr/bin/anonymous : 2008-08-19 11:45 ID:jLsumX7p

>impossible to view in earlier or text-only browsers.

People who still use text-only browsers should have there computers taken away.

13 Name: #!/usr/bin/anonymous : 2008-08-19 12:25 ID:Heaven

>>12

I agree.

Let's shoot the blind people who use the text-only browsers while we're at it.

14 Name: #!/usr/bin/anonymous : 2008-08-19 13:06 ID:Heaven

>>11

I completely agree with you on the quality of most web design you see these days, but I don't see exactly how that ties into CSS. It sucks that many people use bad color combinations, but that's not a fault of CSS as a technology. There is nothing about CSS preventing people from creating usable, flexible designs.

15 Name: #!/usr/bin/anonymous : 2008-08-19 14:42 ID:0uXtHFYw

>The web is a bad format for actual design like you see in magazines - it degrades painfully

yes, because static magazine designs in print degrade so wonderfully.

>and often makes websites impossible to view in earlier or text-only browsers.

Since txt only browsers don't render CSS, CSS has nothing to do with how text browsers display a sites HTML. The sites HTML is what determines how text browsers display webpages. CSS does not have a bearing on the HTML. If for some reason it does they are doing it wrong and that is not CSSes fault.

>Not to mention most "designers" don't understand it from a usability standpoint and use bad color combinations that make reading text difficult for the colorblind.

CSS has notthing to do with a designers choice of colors to use. CSS can use any color and does not in any waydictate which colors are chosen for anything.

Post too long. Click to view the whole post or the thread page.
Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

[HELP] Single questions & Help Thread [n00b] (54)

1 Name: chester copperpot : 2008-04-30 00:02 ID:Heaven

Why do we need a method to determine if a stack is empty?

45 Name: #!/usr/bin/anonymous : 2008-08-10 18:04 ID:Heaven

>>44
I second that motion. Go back to school.

46 Name: #!/usr/bin/anonymous : 2008-08-10 23:57 ID:cA4bH4MK

>>42

Seriously, you should consider taking a few classes, and get a proper teacher. If you can't afford it- even the continuing education courses at many community colleges will help.

That said, those numbers in >>41 aren't magic. They're powers of two which means they each represent a single on (1) bit, just in a different position in binary.

1     = 00000001
2 = 00000010
4 = 00000100
8 = 00001000

16 = 00010000

This was done so that they can be added (binary-or) and tested (binary-and) independently, and very quickly. Look for yourself what the binary result is of the sum of all those flags, and what happens if you binary-and (&) each of them in turn.

47 Name: #!/usr/bin/anonymous : 2008-08-15 12:11 ID:t1gpNPSR

I'm searching for a simple code editor, that works well with ASP (VBScript and JScript), C#, (X)HTML (even when it's broken), JavaScript and CSS. Notepad++ apparently doesn't, I know that VIM does, but forcing people to learn it probably would just be counterproductive.

I need a straight answer, no BS, no religion wars, please.

48 Name: #!/usr/bin/anonymous : 2008-08-15 13:07 ID:Heaven

>>47

When you learn how to code, you'll realize that whatever editor you're using is a code editor.

If you're looking for an editor that will help you learn how to code, then you should ask for that. Visual Studio and Eclipse seem to be enjoyed by beginners.

49 Name: #!/usr/bin/anonymous : 2008-08-15 14:29 ID:Heaven

>>48
There you go.. can't you simply answer a question, especially when I ask for no bullshit? Did you even read my question? I asked for a "simple code editor", not a full blown IDE, not to even mention that neither Visual Studio nor Eclipse satisfy my basic requirements. STFU if you have nothing worthwhile to say.

BTW, seeing as you don't know what a code editor is: http://en.wikipedia.org/wiki/Source_code_editor

50 Name: #!/usr/bin/anonymous : 2008-08-15 14:51 ID:Heaven

>>49

http://www.crimsoneditor.com/

I don't know exactly what you mean by "works well with," but the editor has syntax-highlighting support for the languages you listed. Has some basic tools for things like compiling, but isn't very fancy.

51 Name: #!/usr/bin/anonymous : 2008-08-15 17:11 ID:Heaven

>>49

Programmer's Notepad is pretty lightweight and has syntax support for those languages.

http://www.pnotepad.org

52 Name: 48 : 2008-08-15 17:15 ID:8LZSGSWU

>>49

You out of hand rejected a large class of editors; the kind that are "hard to use". I couldn't possibly recommend "ex" because at best you would whine about how "ex" isn't anything like a "source code editor" because it lacks syntax hilighting, bracket matching and autocompletion. Or maybe you would just say it is hard to use.

Your editor is just a crutch. emacs may be less of a crutch when used by an expert, but emacs can also be just as much of a crutch as anything else if you use it like notepad. The things that can make emacs a good source code editor are obscured by it's menu bar and graphics.

If you keep crying about how people keep calling you inexperienced, you're never going to get any better. Learn "ex" and you'll become a better programmer simply because you bothered to learn something new. Learn "ex" and you'll become a better programmer because you'll have learned a new way to edit programs.

But stop crying like such a girl.

53 Name: #!/usr/bin/anonymous : 2008-08-15 21:14 ID:Heaven

Same goes for vim

54 Name: #!/usr/bin/anonymous : 2008-08-18 13:39 ID:Heaven

>>50
Thanks, that works good enough.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

Please help with a simple xhtml css question noob here (9)