syntax across languages

11 Feb 2002 18:48:54 +0100

"C.Reinke" <> writes:

> > > I'm not sure if "iterate" counts as loop forever?
> > 
> > I don't think there can be a "loop forever" construct in haskell?
> [...]
>   loop f = f >> loop f 
> [...]
> example (get ready to hit that interrupt key;-):
>   loop (putStrLn "hi")

ok, got it. /me bad

> > > I can't remember any %-based sprintf off the top of my head, but hey,
> > > who'd want one anyway?
> > 
> > me! I've always wondered how you internationalize a program without it?
> [...]
> you only want to factor out the strings, so that they
> can be collected in a single space for the translators/customizers
> convenience. functional abstraction allows you to just do that 
> (then put the functions into a module per language, or collect them
> in tuples/records, and link or select as appropriate):
>   encryptionTooSimple d =  
>     "This encryption key is too simple (must be at least "
>     ++(show (d::Integer))++ characters long)"

- i don't like separating the string from the code for simple strings
- do you really suggest giving this translators? You can be sure it won't
  compile any more ;p
  ok, i agree one of the strength of gettext/po solution relies on available
  tools (eg: kbabel)


>   Main> format ( s "age: " . int . s " name: " . str . nl )  10 "IGS"
>   "age: 10 name: IGS\n"

anyone really using this? ;p

give me OCaml's Printf.sprintf!!


> > i don't put any non-simple functions, the main aim is not to show how it can
> > be done, but what are the various names used in various languages.
> but it is one of the major features of functional languages that 
> it is so easy to compose/reuse functionality! this is why Haskell
> doesn't need a name for everything - composing the functions can 
> be as simple as (and more flexible than) composing the names.

I don't deny this. But anyway, haskell has quite a big library for very common
functions (compared with OCaml for example), so it's not a big pb for haskell.