Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

All languages should compile to C/LLVM/JVM

Name: Anonymous 2015-07-30 9:03

All languages should just be syntactic sugar for an intermediate language that's mature enough to have optimizing compilers

Name: Anonymous 2015-08-02 17:09

I am implementing the coreutils in Golang. This serves 2 purposes:
1. ease of maintenance and adding new features
2. avoid the unsafe C language.

Example cat is below. It is almost POSIX compliant, however -u flag is not implemented.

package main
import (
"errors"
"flag"
"io"
"os"
)
func check(err error) {
if err != nil {
panic(err)
}
}
func main() {
var uFlag *bool = flag.Bool("u", false, "Write bytes from the input file to the standard output without delay as each is read.")
flag.Parse()
if *uFlag {
panic(errors.New("Not implemented"))
}
files := flag.Args()
if len(files) == 0 || files[0] == "-" {
// stdin -> stdout mode
io.Copy(os.Stdout, os.Stdin)
} else {
// file mode
for _, file := range files {
f, err := os.Open(file);
check(err)
defer f.Close()
io.Copy(os.Stdout, f)
}
}
}


Only problem is the binaries are rather large )

Directory of C:\Gocode\bin

2015-08-02 10:41 AM <DIR> .
2015-08-02 10:41 AM <DIR> ..
2015-08-02 10:39 AM 2,194,944 cat.exe
2015-07-28 10:08 PM 2,650,624 env.exe
2015-07-27 09:42 PM 2,249,728 pwd.exe
2015-07-25 09:41 PM 2,205,184 touch.exe
2015-07-27 12:07 AM 1,191,936 true.exe
5 File(s) 10,492,416 bytes
2 Dir(s) 89,684,774,912 bytes free

C:\Gocode\bin>


So the next task is to combine into 1 executable, similar idea to busybox except with better (not GPL) license.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List