LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-18-2008, 09:26 PM   #46
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 735

Rep: Reputation: 76
Regarding style, but not just in C


Hi.

From the horse's mouth ... cheers, makyo
Quote:
Title: The Practice of Programming
Author: Brian W. Kernighan, Rob Pike
Date: February 14, 1999
Publisher: Addison-Wesley Professional
ISBN: 0-201-61586-X
Pages: 288
Categories: programming, language, software engineering
Comments: 4 stars ( 49 reviews Amazon 2008.02 )

Chapter 1, Style, about 25 pages
 
Old 02-19-2008, 10:06 AM   #47
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 55
Quote:
Originally Posted by H_TeXMeX_H View Post
Thanks again for the answers.

Actually, I've been looking into Ada recently, and it's very readable. But, why is it frustrating to use in *nix ? I'd like not to have to spend too much money, especially on a toolkit.
Ada is frustrating on *NIX unless you pay big money because *NIX is a C-based OS. All the system interface (header files) is in C. Anything else has to either create a new equivalent header file in the source language you're using or call a C program to get anything done.

Ada is great and powerful and clean for such a huge language, but many common services you need to do anything worthwhile don't have bindings (interfaces) in Ada or if they do they might not be available in a free license (GTKAda, for example) so you have a LOT more work than a C or C++ programmer to get the same job done. If you spend 5 or ten thousand dollars for an Ada toolchain you may be happy on X86.

Rand

Last edited by Randux; 02-19-2008 at 10:19 AM.
 
Old 02-19-2008, 10:09 AM   #48
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 55
Quote:
Originally Posted by PTrenholme View Post
On the other hand, I think I could have coded the same application in APL in a few hours, so maybe you'd like APL. The A+ implementation is available as an RPM in the Fedora repositories, and probably available for other distributions.
APL is NOT a good general purpose language and it's almost useless without an APL keyboard. If you spend your day inverting matrices (or even know what that is) and compressing vectors APL is interesting and fun but otherwise...
 
Old 02-19-2008, 10:18 AM   #49
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 55
Quote:
Originally Posted by jailbait View Post
In my experience the language that comes closest to your set of requirements is COBOL.

http://tiny-cobol.sourceforge.net/index.php

http://www.adtools.com/products/unix/linux.htm

http://www.acucorp.com/markets/linux/

------------------
Steve Stites
COBOL is good for making reports and moving money around but for anything else, almost anything else is better except Java
 
Old 02-19-2008, 12:12 PM   #50
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
With regards to ta0kira's earlier response, I heavily recommend [Common] Lisp. The language itself is full-featured, and amazingly well documented (while at the same time, not taking up much hard drive space).

It took me a while to get around the excessive amount of parentheses, but I realized the reason for it: Lisp = List Processing. Everything is essentially expressed as a list, which further led me to discover that you can be hellishly impulsive with Lisp code, but the language still works you into writing readable, sensical code.

As an example:
Code:
/* In C: Declaring a variable and increasing its value by some condition */

int x = 1;
int y = 2;
int z = 0, sum = 0;

for (z = (x + y); z > 1000000;)
{
  if (z % 2 = 0)
    sum += z;

  x = y;
  y = z;
}

;; The same thing in Common Lisp
;;
(let* ((x 1) (y 2) (z 0) (sum 0))          ; declare some vars
  (loop                                    ; start an infinite loop
    (if (> (+ x y) 1000000)                ; if the limit is reached
        (return sum)                       ; then break out and return SUM
        (setq z (+ x y)))                  ; else lexically set Z
    (when (= (mod z 2) 0) (incf sum z))))  ; increase SUM by Z if Z is an even number
Granted, the language has some incredibly foreign (if you use ALGOL-based syntax as a reference point) concepts about code structure, and syntax, but once you realize how simple everything is, it really just boils down to "proppuh" (pron. with a British accent) structure - the syntax takes care of itself.

With Common Lisp, if you use the ECL REPL (Read-Eval-Print-Loop; the Lisp shell), it has a built-in Lisp-to-C translator, so you can write Lisp strength code, just to have some of it lost in translation and then compiled to native code.

Lisp does have a COMPILE function in the language standard. What it does is compile your source to a FASL (Fast Load) file where it doesn't have to worry about "macro-expansion time" and all symbols get pre-declared. I realize this makes NO sense right now, but given time and study, it'll be quite clear.

Although Lisp's ANSI library is quite dense (read. Common Lisp HyperSpec), if you want to mess around with similar syntax but a "purer" form, check out Scheme.

Scheme is to Common Lisp, as Assembly is to C. It's a bad analogy, yes, but in theory, Scheme sticks to the building blocks of the language.

PS. Lisp and Scheme are also as high-level, or low-level as you want them to be.

Last edited by indienick; 02-19-2008 at 12:32 PM.
 
Old 02-19-2008, 12:55 PM   #51
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928

Original Poster
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by rupertwh View Post
Always a good read: Linus' comments on coding style.
Yes, I've read that too. It helps, but I need more.

Quote:
Originally Posted by makyo
Title: The Practice of Programming
Author: Brian W. Kernighan, Rob Pike

Chapter 1, Style, about 25 pages
Looks pretty good, maybe I'll go look around for it. In the place I'm in now it's kinda hard to find good programming books, but I'll get somehow.

Quote:
Originally Posted by RanduxII View Post
Ada is frustrating on *NIX unless you pay big money because *NIX is a C-based OS. All the system interface (header files) is in C. Anything else has to either create a new equivalent header file in the source language you're using or call a C program to get anything done.

Ada is great and powerful and clean for such a huge language, but many common services you need to do anything worthwhile don't have bindings (interfaces) in Ada or if they do they might not be available in a free license (GTKAda, for example) so you have a LOT more work than a C or C++ programmer to get the same job done. If you spend 5 or ten thousand dollars for an Ada toolchain you may be happy on X86.

Rand
Ah, I see, well that's too bad, it was looking like maybe Ada was close to what I was looking for. Thanks for the explanation.

So far it looks the first thing I'll do is get a refresher on C++ and use that for a while. Must dig up my old programming course books. It's funny, they gave them all away at the end of the course, they said everyone is switching to java next year, got lots of free C++ books (they are a bit old and dusty tho)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What was your first language to learn? vashsna Programming 21 06-11-2007 07:04 PM
what language is best to learn io13 Programming 4 07-09-2006 09:17 AM
What Language Should I Learn? KungFuHamster General 45 04-25-2006 02:10 PM
Which C language to learn? Heiland Programming 10 08-14-2005 08:03 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration