Talk:Type detection

From Rosetta Code

start of a draft task?

Hi, Is this the start of a draft task? --Paddy3118 (talk) 12:57, 7 October 2015 (UTC)

  1. Questions: Is type detection itself a task ? What problem might I be trying to solve by detecting a type (at run-time) in the compiled version of a statically typed language ? Are you, for some reason, thinking of a class of problems which can't be solved in terms of an untyped lambda calculus ? If so, what are they ? Does this sound like a Rosetta task (the value of which is that languages turn out to be unexpectedly similar beneath the surface, if you set them all to the same task) ? Or is it a stamp-collector, list-maker or grammatical librarian's task (simply absorbed in the cataloguing of notational differences) ?
  2. Thoughts: The message of Rosetta is that you get deep insights when different languages are coming at the same non-linguistic task from their own distinctive angles, rather than each trying to jump through contrived grammatical or notational hoops. There may well be interesting and genuine problems to which solutions can be found by making use of the notion of type, but I think the way to find them will be to step back from particular (and perhaps parochial) problems encountered within scripting (and other dynamically typed) languages, and to think a bit more deeply about what type systems are good for, and why they are there.
A task to which Miranda, Haskell or OCaml users might respond by saying not really relevant, doesn't really arise outside the REPL or doesn't arise at all, would probably be too superficial, and a bit of a waste of potential for insight and comparison.
In short – what is the concrete problem (outside the language) for which the solutions may include branching on types  ? What is the actual task ? How would you frame it so that it scored well as a Rosetta task in terms of the 3 values formulated on the landing page:
  1. Likely to harvest responses from as many different languages as possible
  2. Designed to demonstrate how languages are similar and different, and to
  3. Aid a person with a grounding in one approach to a problem in learning another
? Hout (talk) 17:47, 7 October 2015 (UTC)
PS There are some existing tasks, like list flattening (http://rosettacode.org/wiki/Flatten_a_list) which already demonstrate type-conditional divergence of evaluation or flow. Perhaps "type detection", however, would either be too parochial (or simply misleading) as a description of what is happening in, for example, pattern matching. Hout (talk) 18:14, 7 October 2015 (UTC)

Spam attempt ?

I notice that www.BugMeNot.com provides a login-control evasion service, by sharing ersatz login credentials.
Would a bone fide editor make use of such a service ? The choice of lowest common denominator language, and the invitation to facile documentation consultation entries, rather than actual tasks, might conceivably be an attempt to set up pages which attracted instant content, in preparation for launching spam from a context which might delay deletion.
Perhaps the user(s) of these shared BugMeNot credentials would like to allay our suspicions ? Hout (talk) 13:39, 8 October 2015 (UTC)
Hi. BugMeNot user here. I've corrected this thread to have a proper title, as i believe it's supposed to have.
First, i can say that my choice of a shared account like this, is just because i'm a bit of a casual user/contributor of the site. I wasn't allowed to post anonymously and thus went for the 2nd easiest solution. If i end up caring about my account and wanting to go in to deeper usage/discussions and gain more trust, i'll be sure to create a proper account. But i assure you i'm a good person and have good intentions. Although i can't guarantee this account won't be used by others.
The language was just what i happened to be working on at the time and not meant as a challenging exercise. It was fairly easy for me to contribute with it, since i was already working on it. I must admit, it's also a selfish reason, cause i believe i might benefit from having this article here for future reference and hopefully others do too. The fact that others saw it as an invitation to expand it with more languages, is really a testament to the community on this wiki and it's really nice to see. I can understand your worry about spam, but people are clearly maintaining this wiki very nicely, so it should hopefully be detected fairly quickly and efficiently if it actually happens. --Bugmenot2 (talk) 10:10, 19 October 2015 (UTC)
As "you" say i can't guarantee this account won't be used by others … Perhaps taking the 30 seconds it requires to get a consistent username is actually a sine qua non of anything resembling constructive conversation. It could be construed as quite impolite to lazily expect others to 'talk' to a reusable ersatz name without any sense of whether the same person is behind it from one sentence to another. There's not even any coherent 'body corporate' or 'legal person' behind a mutable string that's simply been picked up somewhere in a public space and very possibly dropped again, perhaps several times. Any one of the sentences that have been typed under the various bugmenot1-Ns took longer than simply getting a username. Hout (talk) 11:14, 19 October 2015 (UTC)
I can see that this was posted by Hout, but you forgot to add a signature. I'm not sure how to add a signature for someone else, so i'm at least mentioning it.
I've added it now, and perhaps 'you' see my point … Not one of the "BugmenotN" sentences have anything that actually constitutes the signature of a persistent 'person', individual or corporate. Hout (talk) 11:28, 19 October 2015 (UTC)
I didn't expect to use this account for discussions. I merely wanted to create a few small contributions where i saw i could help. When i saw there was a discussion about me, i felt i should at least respond. --Bugmenot2 (talk) 10:47, 19 October 2015 (UTC)
Good. Get yourself a username and do that. Hout (talk) 11:19, 19 October 2015 (UTC)

Delete?

I am thinking of deleting this task after 09-Oct-2015 due to the lack of credibility of the creator account. --Paddy3118 (talk) 15:08, 8 October 2015 (UTC)

I agree – that seems sensible, unless they can give a proper account of themselves Hout (talk) 15:17, 8 October 2015 (UTC)
I do not agree (I am a "wiki inclusionist"). Try to make stuff useful of it (it should be the primary priority), or use pure-wiki-deletion. Whether or not the user that wrote it is using BugMeNot is irrelevant; the contents of the page are what matter, and anyone can fix it, therefore anyone should fix it! --Zzo38 (talk) 19:37, 9 October 2015 (UTC)
I just noticed this thread here after i wrote the response in the thread above. Please see my response there. --Bugmenot2 (talk) 10:10, 19 October 2015 (UTC)

Could the draft description be coaxed into something useful ?

As Craigd has taken the trouble to start thinking about a task description, perhaps we should try to see if a spark of spam can indeed be coaxed into life as a useful task ?

Using a quick checklist of Rosetta values (copied from from the landing-page formulation), a good task will:

1. Lend itself well to solutions to in as many different languages as possible
2. demonstrate how languages are similar and different
3. aid a person with a grounding in one approach to a problem in learning another

Good scope for alternative approaches and the maximum number of languages is best served by the principle of Task focus, which is specified on the Add a Task page.

Broadly, tasks from the world outside computer languages, which make no assumptions about particular models of computing, yield better insight and deeper comparisons. The value of the Rosetta stone was that 3 very different languages were dealing with the same external (non-linguistic) task.

Given that, the text processing context sounds promising, and should probably be more focal than a framing like Show a function/procedure which … . Perhaps for example, (thinking about Goal 1 above) that is not quite how a declarative language would be used. Better to make no assumptions about language-internal issues, and to frame the task itself.

On Goals 2 and 3 (demonstrate how languages are similar and different, & learning another approach) you would need to allow for the differences such as, for example, that between run-time "Type detection" and compiler-driven pattern-matching. Framing it too tightly in terms of "type detection" assumptions would marginalise some languages, and miss the scope for comparing different approaches, for example, safe static checking in Haskell and Java, unsafe static checking in C++, and dynamic checking in Lisp, Scheme, Perl etc.

(Not easy though, to think of a task which centrally turns on any of the issues which arise, unless, perhaps, complex data structures are inherently likely to be involved ...)

Finally, on the learning aspect of Goal 3, it would clearly be good to find a task which learners are quite likely to actually encounter and think about

( It may also be worth looking at some existing tasks which already demonstrate type-conditional evaluation or flow – flattening lists, for example – just to check that something more focused is really required. There are probably also many tasks which demonstrate evaluation or flow which is conditional on the particular type of numeric values – maybe what is really needed is an index, rather than an additional task ) Hout (talk) 18:34, 9 October 2015 (UTC)

Perhaps search a nested list or tree ?

A natural context for type-conditional evaluation or flow is a search for a value through the leaves of a tree, or through the sub-lists of a nested list/array.

I may be missing something, but I haven't spotted a task that immediately looks like search a tree or search a nested list. If there is such a gap, I think that perhaps 'Type detection' could usefully be reworked and reframed (possibly retitled ?) to fill it. Hout (talk) 14:53, 10 October 2015 (UTC)

Description doesn't match

The task description mentioned at the top is a different task, not type detection (although one that may involve type detection), and it is the one implemented in zkl. The other three (JavaScript, OASYS Assembler, PHP) implement type detection. Some tasks are meant to explain features of the programming language (such as special symbols, naming conventions, etc), and this perhaps is similar, but nevertheless can be improved so that better explanation, examples, examples of usage, etc are possible. I think C++ has RTTI (although I don't really know as I do not program in C++). Haskell has the "Typeable" class for supporting type detection. Entries on here could also link to tasks which use type detection to achieve their task in this programming language. --Zzo38 (talk) 17:59, 10 October 2015 (UTC)