Click here to Skip to main content
15,904,415 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Is there a programming language... Pin
Gary Wheeler18-Dec-13 0:33
Gary Wheeler18-Dec-13 0:33 
GeneralRe: Is there a programming language... Pin
greydmar17-Dec-13 9:19
greydmar17-Dec-13 9:19 
GeneralRe: Is there a programming language... Pin
Marc Clifton18-Dec-13 1:41
mvaMarc Clifton18-Dec-13 1:41 
GeneralRe: Is there a programming language... Pin
greydmar20-Dec-13 1:59
greydmar20-Dec-13 1:59 
GeneralRe: Is there a programming language... Pin
HaBiX17-Dec-13 20:47
HaBiX17-Dec-13 20:47 
GeneralRe: Is there a programming language... Pin
kalberts17-Dec-13 22:34
kalberts17-Dec-13 22:34 
GeneralRe: Is there a programming language... Pin
Marc Clifton18-Dec-13 1:40
mvaMarc Clifton18-Dec-13 1:40 
GeneralRe: Is there a programming language... Pin
Rob Grainger17-Dec-13 22:48
Rob Grainger17-Dec-13 22:48 
Marc has already pointed to Smalltalk, someone else pointed out C++, I'd like to add Haskell to the mix.

Getting type safety would be easy:

newtype meter m = meter m deriving (Show, Num, Eq, Ord)
newtype foot f = foot f deriving (Show, Num, Eq, Ord)

-- Usage (ghci> is an iteractive prompt)
ghci> let m1 = meter 5
ghci> let m2 = meter 10
ghci> let m3 = m1 + m2
ghci> m3
meter 15
ghci> let f1 = foot 3
ghci> let f2 = foot 4
ghci> let f3 = f1 + f2
ghci> f3
foot 7
ghci> let e1 = f1 + m1      -- Won't Work - produces error of types mismatching


With more work, it can be extended to add support for conversions, magnitudes (nm, mm, m, km, ...).

Indeed someone has already done all this work for us: Dimensional[^] and Dimensional using type families[^].
All available at the standard repository Hackage[^].
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.

GeneralRe: Is there a programming language... Pin
Marc Clifton18-Dec-13 1:38
mvaMarc Clifton18-Dec-13 1:38 
GeneralRe: Is there a programming language... Pin
Rob Grainger18-Dec-13 4:28
Rob Grainger18-Dec-13 4:28 
GeneralRe: Is there a programming language... Pin
Marc Clifton18-Dec-13 4:52
mvaMarc Clifton18-Dec-13 4:52 
GeneralRe: Is there a programming language... Pin
Rob Grainger18-Dec-13 7:00
Rob Grainger18-Dec-13 7:00 
GeneralRe: Is there a programming language... Pin
greydmar20-Dec-13 2:17
greydmar20-Dec-13 2:17 
GeneralRe: Is there a programming language... Pin
Eduard Matei18-Dec-13 0:53
Eduard Matei18-Dec-13 0:53 
GeneralRe: Is there a programming language... Pin
Marc Clifton18-Dec-13 1:33
mvaMarc Clifton18-Dec-13 1:33 
GeneralRe: Is there a programming language... Pin
908236518-Dec-13 2:32
908236518-Dec-13 2:32 
GeneralRe: Is there a programming language... Pin
Marc Clifton18-Dec-13 2:34
mvaMarc Clifton18-Dec-13 2:34 
GeneralRe: Is there a programming language... Pin
908236518-Dec-13 2:57
908236518-Dec-13 2:57 
GeneralRe: Is there a programming language... Pin
Rob Grainger18-Dec-13 4:20
Rob Grainger18-Dec-13 4:20 
GeneralRe: Is there a programming language... Pin
908236518-Dec-13 6:12
908236518-Dec-13 6:12 
GeneralRe: Is there a programming language... Pin
Anas Karm.18-Dec-13 4:23
Anas Karm.18-Dec-13 4:23 
GeneralRe: Is there a programming language... Pin
Marc Clifton18-Dec-13 4:26
mvaMarc Clifton18-Dec-13 4:26 
GeneralRe: Is there a programming language... Pin
Member 460889818-Dec-13 7:50
Member 460889818-Dec-13 7:50 
GeneralRe: Is there a programming language... Pin
aschmahmann19-Dec-13 16:29
aschmahmann19-Dec-13 16:29 
GeneralRe: Is there a programming language... Pin
Marc Clifton20-Dec-13 2:27
mvaMarc Clifton20-Dec-13 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.