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

/Prog/ramming Language

Name: Anonymous 2012-08-27 7:14

Hi /prog/, I was wondering what's the closest programming language that can do:


type percentage int x where x >= 0 and x <= 100
percentage discount = 25
# the above will not compile if e.g, discount = 9001
print discount


You get the idea, I found types lacking in conventional programming languages.

Name: Anonymous 2012-08-27 12:03

>>4
Yes, but it could be used for much more than subranges, e.g,

type smart_student student s where s.grade > 90

This is pretty DRY, obvious, straightforward, avoids bugs, all which leads to better spec-to-code process in our industry. Why isn't this kind of typing be more adopted? Enlighten me, /prog/

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