Re: [stack] Cat Type Inference
"Christopher Diggins" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
This question implies the question "why would one want to statically verify the types?". This one is fairly well-known: e.g. documentation, reducing defects, and improving performance, so I'll assume that it is already known. The question that remains then is "why allow the compiler (or better yet, the editor) infer the types instead of insisting the programmer write them out?". If you want static type verification then you will encounter a fair number of scenarios where expressing the types is non-trivial and the type signature may even be longer than the function body. Sometimes the type is not easily deduced by a programmer due to lack of familiarity with the complexities of type systems, but the programmer still knows how to write the program they want correctly. Finally, there are scenarios where the type is so trivially obvious, writing it is redundant. As for whether or not it is obvious, that really depends on your experience with statically typed languages, and an understanding of how the refactoring capabilities of modern IDEs for C# and Java actually do their magic. The more type inference you are able to do with a langauge, the more an IDE can refactor your code for you. Hope this helps. Christopher Diggins On 4/16/07, chris glur <[email protected]> wrote: > > A perhaps trivial question [which also serves to test if my - via > gmail - posts get through] is: "is it obvious why one would > want to 'infer the types' ?" > > == Chris Glur. > > On 4/11/07, Christopher Diggins <[email protected] <cdiggins%40gmail.com>> > wrote: > > I've written a short article explaining how to infer the types using > > the example of a non-trivial higher order function: "[] eval eval" at > > http://cdiggins.com/2007/04/11/type-inference-example-in-cat/ for > > those interested in a more down to earth explanation of the type > > inference algorithm. > > > > Cheers, > > Christopher Diggins > > http://www.cdiggins.com > > > > Messages in this topic > <http://groups.yahoo.com/group/concatenative/message/3297;_ylc=X3oDMTM0amE5dGJzBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BG1zZ0lkAzMyOTgEc2VjA2Z0cgRzbGsDdnRwYwRzdGltZQMxMTc2NzEzOTgxBHRwY0lkAzMyOTc-> > (0) Reply (via web post) > <http://groups.yahoo.com/group/concatenative/post;_ylc=X3oDMTJwN21kbjhqBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BG1zZ0lkAzMyOTgEc2VjA2Z0cgRzbGsDcnBseQRzdGltZQMxMTc2NzEzOTgx?act=reply&messageNum=3298>| > Start a new topic > <http://groups.yahoo.com/group/concatenative/post;_ylc=X3oDMTJlNjZ1Y2Y4BF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTE3NjcxMzk4MQ--> > Messages<http://groups.yahoo.com/group/concatenative/messages;_ylc=X3oDMTJlbGJqMzZhBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA21zZ3MEc3RpbWUDMTE3NjcxMzk4MQ-->| > Files<http://groups.yahoo.com/group/concatenative/files;_ylc=X3oDMTJmYzUwaW8yBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2ZpbGVzBHN0aW1lAzExNzY3MTM5ODE->| > Photos<http://groups.yahoo.com/group/concatenative/photos;_ylc=X3oDMTJldTM2NG9jBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA3Bob3QEc3RpbWUDMTE3NjcxMzk4MQ-->| > Links<http://groups.yahoo.com/group/concatenative/links;_ylc=X3oDMTJmMjdvYTR0BF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2xpbmtzBHN0aW1lAzExNzY3MTM5ODE->| > Database<http://groups.yahoo.com/group/concatenative/database;_ylc=X3oDMTJjOGx0NjhyBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2RiBHN0aW1lAzExNzY3MTM5ODE->| > Polls<http://groups.yahoo.com/group/concatenative/polls;_ylc=X3oDMTJmMjZ2dDh0BF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA3BvbGxzBHN0aW1lAzExNzY3MTM5ODE->| > Members<http://groups.yahoo.com/group/concatenative/members;_ylc=X3oDMTJlbGdkNWliBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA21icnMEc3RpbWUDMTE3NjcxMzk4MQ-->| > Calendar<http://groups.yahoo.com/group/concatenative/calendar;_ylc=X3oDMTJkdTE2cThhBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2NhbARzdGltZQMxMTc2NzEzOTgx> > [image: Yahoo! Groups]<http://groups.yahoo.com/;_ylc=X3oDMTJkdHJwc3BmBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxMTc2NzEzOTgx> > Change settings via the Web<http://groups.yahoo.com/group/concatenative/join;_ylc=X3oDMTJmOXNxaGhxBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA3N0bmdzBHN0aW1lAzExNzY3MTM5ODE->(Yahoo! ID required) > Change settings via email: Switch delivery to Daily Digest<[email protected]?subject=Email+Delivery:+Digest>| Switch > format to Traditional<[email protected]?subject=Change+Delivery+Format:+Traditional> > Visit Your Group > <http://groups.yahoo.com/group/concatenative;_ylc=X3oDMTJkNmtiaHZyBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2hwZgRzdGltZQMxMTc2NzEzOTgx>| > Yahoo! Groups Terms of Use <http://docs.yahoo.com/info/terms/>| Unsubscribe > <[email protected]?subject=> > Visit Your Group > <http://groups.yahoo.com/group/concatenative;_ylc=X3oDMTJlaGI2NnBpBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTE3NjcxMzk4MQ--> > SPONSORED LINKS > > - Computer telephony<http://groups.yahoo.com/gads;_ylc=X3oDMTJjYnZubHU1BF9TAzk3MzU5NzE0BF9wAzEEZ3JwSWQDMTgzOTI3NARncnBzcElkAzE3MDUwMDY3NjQEc2VjA3NsbW9kBHN0aW1lAzExNzY3MTM5ODE-?t=ms&k=Computer+telephony&w1=Computer+telephony&w2=Portable+computer&w3=Portable+computer+case&w4=Computer+telephony+integration&w5=Computer+telephony+integration+cti&c=5&s=151&g=2&.sig=JAsp-14TIOM--smLD8umaA> > - Portable computer<http://groups.yahoo.com/gads;_ylc=X3oDMTJjZWptOHVnBF9TAzk3MzU5NzE0BF9wAzIEZ3JwSWQDMTgzOTI3NARncnBzcElkAzE3MDUwMDY3NjQEc2VjA3NsbW9kBHN0aW1lAzExNzY3MTM5ODE-?t=ms&k=Portable+computer&w1=Computer+telephony&w2=Portable+computer&w3=Portable+computer+case&w4=Computer+telephony+integration&w5=Computer+telephony+integration+cti&c=5&s=151&g=2&.sig=MJdJLwRbIl1obm3uSH-5JQ> > - Portable computer case<http://groups.yahoo.com/gads;_ylc=X3oDMTJjN2I2amYzBF9TAzk3MzU5NzE0BF9wAzMEZ3JwSWQDMTgzOTI3NARncnBzcElkAzE3MDUwMDY3NjQEc2VjA3NsbW9kBHN0aW1lAzExNzY3MTM5ODE-?t=ms&k=Portable+computer+case&w1=Computer+telephony&w2=Portable+computer&w3=Portable+computer+case&w4=Computer+telephony+integration&w5=Computer+telephony+integration+cti&c=5&s=151&g=2&.sig=0L45TanocmGShw91jOg7bQ> > - Computer telephony integration<http://groups.yahoo.com/gads;_ylc=X3oDMTJjZzlkMWhhBF9TAzk3MzU5NzE0BF9wAzQEZ3JwSWQDMTgzOTI3NARncnBzcElkAzE3MDUwMDY3NjQEc2VjA3NsbW9kBHN0aW1lAzExNzY3MTM5ODE-?t=ms&k=Computer+telephony+integration&w1=Computer+telephony&w2=Portable+computer&w3=Portable+computer+case&w4=Computer+telephony+integration&w5=Computer+telephony+integration+cti&c=5&s=151&g=2&.sig=q3fyEPuegir5iyfxg8W-dA> > - Computer telephony integration cti<http://groups.yahoo.com/gads;_ylc=X3oDMTJjMWg5MGFoBF9TAzk3MzU5NzE0BF9wAzUEZ3JwSWQDMTgzOTI3NARncnBzcElkAzE3MDUwMDY3NjQEc2VjA3NsbW9kBHN0aW1lAzExNzY3MTM5ODE-?t=ms&k=Computer+telephony+integration+cti&w1=Computer+telephony&w2=Portable+computer&w3=Portable+computer+case&w4=Computer+telephony+integration&w5=Computer+telephony+integration+cti&c=5&s=151&g=2&.sig=iON1CbLeehVtxqxDmeEo_A> > > Yahoo! Finance > > It's Now Personal<http://us.ard.yahoo.com/SIG=12jgb88dq/M=493064.10512181.11138666.8674578/D=groups/S=1705006764:NC/Y=YAHOO/EXP=1176721181/A=4507179/R=0/SIG=12de4rskk/*http://us.rd.yahoo.com/evt=50284/*http://finance.yahoo.com/personal-finance> > > Guides, news, > > advice & more. > Search Ads > > Get new customers.<http://us.ard.yahoo.com/SIG=12isg30dt/M=493064.9803227.10510220.8674578/D=groups/S=1705006764:NC/Y=YAHOO/EXP=1176721181/A=3848641/R=0/SIG=1312g85fq/*http://searchmarketing.yahoo.com/arp/srchv2.php?o=US2003&cmp=Yahoo&ctv=Groups2&s=Y&s2=&s3=&b=50> > > List your web site > > in Yahoo! Search. > Yahoo! Groups > > Start a group<http://groups.yahoo.com/start;_ylc=X3oDMTJvbWRiZDV1BF9TAzk3MzU5NzE0BF9wAzMEZ3JwSWQDMTgzOTI3NARncnBzcElkAzE3MDUwMDY3NjQEc2VjA25jbW9kBHNsawNncm91cHMyBHN0aW1lAzExNzY3MTM5ODE-> > > in 3 easy steps. > > Connect with others. > . > > > [Non-text portions of this message have been removed]