News for hackers. Stuff that matters.
Re:String types are fine. How about your code? by RyanZAG on Thursday November 28, 2013 @07:27AM (#6814245)
Misses the point, I think? There are plenty of times you must alter human text. For example, a word processor with a find/replace function must be able to replace the correct text and not move extra symbols around while doing so. There are thousands of similar examples.
Re:String types are fine. How about your code? by rbehrends on Thursday November 28, 2013 @08:12AM (#6814356)
Yes, but functionality that is about dealing with text for human consumption is properly the function of a library, not the core language, or even a single type in the standard library.

Human language and culture is too complex, fuzzy, and variable to hardwire its rules into a programming language specification. Character boundaries and character transformations are really only the beginning of it.

Consider finding the end of an English word. Is an apostrophe at the end an actual apostrophe denoting the possessive case (of a plural word) or meant as a closing single quote (even where there are different symbols, they are often mixed up when doing data entry)? How do you pluralize words? You have to consider exceptions to the usual rules (e.g., a dictionary), words that only exist in the plural, languages that don't have the concept of plural words, etc.

Re:String types are fine. How about your code? by informatimago on Thursday November 28, 2013 @10:49AM (#6814988)
Nonetheless, that's what Wolfram is trying to do with his "programming" language. At least it's at the same level. Provide human level rules and knowledge embodied in a computer programming language.
Re:String types are fine. How about your code? by maxk42 on Thursday November 28, 2013 @01:46PM (#6815866)
Entirely misses the point. The original document was discussing the problem of text normalization, which still remains.

If I have a database of employee bios and I write an app so HR can search that database, it's no problem for them to type in "management" and get a list of all employees with the word "management" in their bio. But when a division does the same thing in a non-English-speaking country where there's an é in the word, then that word can be composed of either two characters or one and searching one way will tend to miss any results which were composed of text the other way. The solution here is to normalize the data before it is stored in the DB and the search term before it is searched for.

It's a simple concept. Not all programmers are aware of it, however, and this guy totally missed the point.

Re:String types are fine. How about your code? by skrebbel on Thursday November 28, 2013 @10:12AM (#6814805)
Actually, one of the points that I tried to make is that the amount of situations where you have to do that is remarkably small. You don't code a word processor every day. And, if you do need to do that, and you need to support more than a single language, you're talking about a rather complex, probably slightly fuzzy, major feature.

I bet the MS Word team that made internationalized search/replace spent a lot of time getting it even somewhat right.

Re:String types are fine. How about your code? by nabla9 on Thursday November 28, 2013 @08:19AM (#6814373)
The author argues that when string processing becomes complicated, it does not matter and incorrect results are usually OK.

Everybody knows about Bobby Tables? How about Mr. เจ้าพระยาบดินทรเดชา Unicode?

What if somebody told you that if certain exotic names are entered into the system by certain input method, government officials can't find those people in their searches, including full text search to a police report?

Re:String types are fine. How about your code? by bcoates on Thursday November 28, 2013 @09:41AM (#6814676)
SQL injection is caused by exactly the confusion between human- and machine- readable text that the author is warning against.
Re:String types are fine. How about your code? by lelf on Thursday November 28, 2013 @12:29PM (#6815489)
> There are thousands of similar examples

Not actually

Re:String types are fine. How about your code? by RyanZAG on Thursday November 28, 2013 @02:59PM (#6816139)
Text search, text replacement, ellipsizing text at the end or middle (as done commonly on iOS), fuzzy search, password word limits, password length limits, matching passwords (try using bcrypt on international languages without first normalizing), detecting and filtering rude words in public chat, ... Basically anywhere that text needs to be checked or changed.

Just off the top of my head. There are far more. You can't even have a native language user friendly login system without normalizing text.

Re:String types are fine. How about your code? by lelf on Thursday November 28, 2013 @03:32PM (#6816290)
Text search,

search, that counts

text replacement,

why?

ellipsizing text at the end or middle (as done commonly on iOS),

you need to know width for that, and you don't, bad idea

fuzzy search,

search

password word limits, password length limits, matching passwords (try using bcrypt on international languages without first normalising),

i18n password? very bad idea

detecting and filtering rude words in public chat

search&replace, anyway you won't be able to, because f͌̊ͦuͥcͥ͑ͩ͛k͂͌̿ͣ̾

Re:String types are fine. How about your code? by deathanatos on Friday November 29, 2013 @12:21AM (#6817999)
> you need to know width for that, and you don't, bad idea

You also need to not chop off accents. "café" cannot become "cafe…"

> i18n password? very bad idea

Because string types are so broken.