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

Make the world a better place

Name: Anonymous 2010-12-18 22:15

ITT: Name one thing about a language that annoys you most, and how it could be made better in your opinion (with code examples).

I'll start with... Python. Pretty awesome language in general, but the whole forced intendation ruins it for me, so why not just use braces instead of whitespace?

Anyway, old python:

import string

def poopy(data):
    ret = {}
    i = 0
    while i < len(data):
        if data[i] == '+' or data[i] == '-':
            if data[i].isdigit():
                i = i + 1
                temp = "%d" % data[i]
                ret[len(ret)] = temp
                while i < len(data) and data[i].isdigit():
                    ret[len(ret) - 1] += data.at[i]
                    i = i + 1
            else:
                i = i + 1
                temp = "%s" % data[i]
                ret[len(ret)] = temp
        elif data[i].isdigit():
            ret[len(ret)] = ""
            while (i < len(data)) and data[i].isdigit():
                ret[len(ret)-1] = data[i]
                i = i + 1

        elif data[i].isalpha():
            ret[len(ret)] = ""
            while i < len(data) and data[i].isalpha():
                ret[len(ret)-1] += data[i]
                i = i + 1
        elif data[i] in string.whitespace:
            i = i + 1
        else:
            temp = "%c" % data[i]
            ret[len(ret)] = temp
            i = i + 1
    return ret


new, stylish, brace'd python:

import string

def poopy(data)
{
    ret = {}
    i = 0
    while i < len(data)
    {
        if data[i] == '+' or data[i] == '-'
        {
            if data[i].isdigit()
            {
                i = i + 1
                temp = "%d" % data[i]
                ret[len(ret)] = temp
                while i < len(data) and data[i].isdigit()
                {
                    ret[len(ret) - 1] += data.at[i]
                    i = i + 1
                }
            }
            else
            {
                i = i + 1
                temp = "%s" % data[i]
                ret[len(ret)] = temp
            }
        }
        elif data[i].isdigit()
        {
            ret[len(ret)] = ""
            while (i < len(data)) and data[i].isdigit()
            {
                ret[len(ret)-1] = data[i]
                i = i + 1
            }
        }
        elif data[i].isalpha()
        {
            ret[len(ret)] = ""
            while i < len(data) and data[i].isalpha()
            {
                ret[len(ret)-1] += data[i]
                i = i + 1
            }
        }
        elif data[i] in string.whitespace
        {
            i = i + 1
        }
        else
        {
            temp = "%c" % data[i]
            ret[len(ret)] = temp
            i = i + 1
        }
    }
    return ret
}


I really hope someone forks the python codebase someday and adds braces, and removes that fucking whitespace bullshit...

anyway, now it's your turn!

Name: Anonymous 2010-12-18 22:20

also, the code is a completely useless, pointless, retarded, nonworking-ish LITHP tokenizer.

Name: Anonymous 2010-12-18 22:22

so why not just use braces instead of whitespace?
http://www.squirrel-lang.org/

Name: Anonymous 2010-12-18 22:24

It looks exactly the same, you've just introduced a retarded bracIHBT

Name: Anonymous 2010-12-18 22:27

import string

def poopy(data)
#{
    ret = {}
    i = 0
    while i < len(data)
    #{
        if data[i] == '+' or data[i] == '-'
        #{
            if data[i].isdigit()
            #{
                i = i + 1
                temp = "%d" % data[i]
                ret[len(ret)] = temp
                while i < len(data) and data[i].isdigit()
                #{
                    ret[len(ret) - 1] += data.at[i]
                    i = i + 1
                #}
            #}
            else
            #{
                i = i + 1
                temp = "%s" % data[i]
                ret[len(ret)] = temp
            #}
        #}
        elif data[i].isdigit()
        #{
            ret[len(ret)] = ""
            while (i < len(data)) and data[i].isdigit()
            #{
                ret[len(ret)-1] = data[i]
                i = i + 1
            #}
        #}
        elif data[i].isalpha()
        #{
            ret[len(ret)] = ""
            while i < len(data) and data[i].isalpha()
            #{
                ret[len(ret)-1] += data[i]
                i = i + 1
            #}
        #}
        elif data[i] in string.whitespace
        #{
            i = i + 1
        #}
        else
        #{
            temp = "%c" % data[i]
            ret[len(ret)] = temp
            i = i + 1
        #}
    #}
    return ret
#}

Name: Anonymous 2010-12-18 22:29

so why not just use braces instead of whitespace?
The Pleasure of Having Your Indentation Forced

Name: Anonymous 2010-12-18 22:33

>>4,5

PROTIP: the colons are missing. herpa derpa

Name: Anonymous 2010-12-18 22:36

>>7
As if that matters. There's even more wasted space how you've done it.

Name: Anonymous 2010-12-18 22:40

>>8
Not that I've expected /praque/ to actually get the point... but hey, since the majority is already infested by LITHP and HAKSAL, there wasn't any hope in the first place.

Name: Anonymous 2010-12-18 22:45

>>9

infested by LITHP and HASKAL
Python. Pretty awesome language


IHBT

Name: Anonymous 2010-12-18 22:50


We
Have
Bitch
Tits[/o]
[/o]

Name: Anonymous 2010-12-18 23:18

>>9
You really thought none of the people who learnt Python coming over from C thought exactly the same thing as you?

Name: Anonymous 2010-12-18 23:28

In C, replace "->" with ".".

Name: Anonymous 2010-12-18 23:38

>>from __future__ import braces

Name: Anonymous 2010-12-18 23:52

from __lisp__ import parens, macros
(import 'c '(pointers stdio))
(printf "Hello, %s" "/prog/")

Name: Anonymous 2010-12-19 0:05

>>14
I really hope someone forks the python codebase
forks the python codebase
forks the python
forks the
forks
forks
forks

Name: Anonymous 2010-12-19 0:10

Name: Anonymous 2010-12-19 1:27

pee in my butt, /prague/

Name: Anonymous 2010-12-19 2:07

Python. Lambdas + TCO.




def forever_sort(list)
    list.sort(lambda x,y:
                 z = anus(x.x())
                 y = anus(x) + y.y()
                 y < z)
    forever_sort(list)

Name: Anonymous 2010-12-19 2:45


while i < len(data):
    if data[i] == '+' or data[i] == '-':
        if data[i].isdigit():
            ...
        else:
            ...


ಠ_ಠ

Name: Anonymous 2010-12-19 3:29

>>13
I never understood why C couldn't infer an arbitrary number of dereferences when using ..  I mean, you already know what type it is.

Name: Anonymous 2010-12-19 4:35

I'll start with... C. Pretty awesome language in general, but the whole forced braces ruin it for me, so why not just use whitespace instead of braces?

Anyway, old c:
#include <stdio.h>

#define N 4
#define M 1000000

static int distinct_factor_count(unsigned n);

int main(void)
{
  unsigned i, j = 0;
  for (i = 2; i < M && j < N; i++) {
    for (j = 0; j < N && distinct_factor_count(i+j) == 4; j++)
      ;
  }
  printf("%u\n", i-1);

  return 0;
}

int distinct_factor_count(unsigned n)
{
  unsigned count = 0;
  unsigned i;
  for (i = 2; i <= n; i++) {
    if (n % i == 0) {
      count++;
      n /= i;
      while (n % i == 0) {
        n /= i;
      }
    }
  }
  return count;
}


new, stylish, withspace'd c:

#include <stdio.h>

#define N 4
#define M 1000000

static int distinct_factor_count(unsigned n);

int main(void):
  unsigned i, j = 0;
  for (i = 2; i < M && j < N; i++):
    for (j = 0; j < N && distinct_factor_count(i+j) == 4; j++):
      ;
  printf("%u\n", i-1);
  return 0;

int distinct_factor_count(unsigned n):
  unsigned count = 0;
  unsigned i;
  for (i = 2; i <= n; i++):
    if (n % i == 0):
      count++;
      n /= i;
      while (n % i == 0):
        n /= i;
  return count;



I really hope someone forks the c codebase someday and adds FIOC, and removes that fucking braces bullshit...

Name: Anonymous 2010-12-19 6:36

>>22
oh you

Name: Anonymous 2010-12-19 7:24

>>22
say, why are you choking on that phalloid object in your mouth so much?

also, semi-colons in a FIOC. huarhuarhuar

... anyway, let's just ignore >>22-san, and continue the thread with ontopic stuff:

since Lua has pcall() anyway, which is used to execute a function 'safely', why not just add try .. catch in the first place?

old code:

    local status, err = pcall(function () error({code=121}) end)
    print(err.code)  -->  121


new code:

    try
        error({code=121})
    catch err, status
        print(err.code)
    end


actually, there is a patch for it, but it never made it into the main source. :(

Name: Anonymous 2010-12-19 10:15

I'll start with... Lisp. Pretty awesome language in general, but the whole forced parentheses ruin it for me, so why not just use whitespace instead of parens?

Anyway, old Lisp:
(defun factorial (n)
   (if (<= n 1)
       1
       (* n (factorial (- n 1)))))


new, stylish, FIOC'd Lisp:
defun factorial n
  if <= n 1
    1
    * n
       factorial
         - n 1

Name: Anonymous 2010-12-19 10:17

>>22
YHBT

Name: Anonymous 2010-12-19 11:14

>>22
EPIC WIN

Name: Anonymous 2010-12-19 12:08

>>25
Because programs are represented as lists, and that is the read syntax for lists in Lisp. Lose that and you lose most of what makes Lisp interesting.
If you really can't get over it, then there's always Dylan.

Name: Anonymous 2010-12-19 12:14

>>28
Your Asperger's is showing.

Name: 2010-12-19 18:43

Name: Anonymous 2010-12-19 20:32

I'll start with... Whitespace. Pretty awesome language in general, but the whole whitespace ruins it for me, so why not just use nothing instead of whitespace?

Anyway, old Whitespace:












new, stylish, empty Whitespace:

Name: Anonymous 2010-12-19 20:58

I'll start with... Haskell. Pretty awesome language in general, but the whole HAKSAL ruins it for me, so why not just use VUISALBACISICS instead?

Anyway, old HAKSAL:

module Main where

main = putStrLn "Hello, World!"


new, stylish, ENTERPRISE'd HAKSAL:

Imports System

Public Module modmain
   Sub Main()
     Console.WriteLine ("Hello, World!")
   End Sub
End Module

Name: Anonymous 2010-12-19 21:03

I'll start with... PUDDI. Pretty awesome language in general, but the whole PUDDI ruins it for me, so why not just use PUDDI instead?

Anyway, old PUDDI:

PUDDI


New, stylish, PUDDI'd PUDDI:
[code]
PUDDI
[code]

Name: Anonymous 2010-12-23 17:37

Name: Anonymous 2013-01-19 23:18

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

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