雅虎香港 搜尋

  1. Duck - Wikipedia

    en.wikipedia.org/wiki/Duck

    Duck is the common name for numerous species of waterfowl in the family Anatidae. Ducks are generally smaller and shorter-necked than swans and geese, which are also members of the same family.

  2. A baby duck is called a duckling, and a male duck is called a drake. Most ducks are aquatic birds. They can be found in both saltwater and fresh water. Ducks lay eggs once a year and are omnivorous, eating aquatic plants and tiny animals.

  3. Duck (film) - Wikipedia

    en.wikipedia.org/wiki/Duck_(film)

    Duck is a 2005 American drama film by director-writer-producer Nic Bettauer. It stars Philip Baker Hall. The film is a dystopian view of the then-near future of 2009.

    • $300,000
    • 2005
  4. DuckDuckGo - Wikipedia

    en.wikipedia.org/wiki/Duck_Duck_Go
    • History
    • Search Results
    • Instant Answers
    • Tor Access
    • Bangs
    • Business Model
    • Source Code
    • Reception
    • Traffic
    • Controversy

    DuckDuckGo was founded by Gabriel Weinberg on February 29, 2008, in Valley Forge, Pennsylvania. Weinberg is an entrepreneur who previously launched Names Database, a now-defunct social network. Initially self-funded by Weinberg, DuckDuckGo is advertising-supported, but the user has the option to disable ads. The search engine is written in Perl and runs on nginx, FreeBSD, and Linux. DuckDuckGo is built primarily upon search APIs from various vendors. Because of this, TechCrunch characterized the service as a "hybrid" search engine. Weinberg explained the beginnings of the name with respect to the children's game duck, duck, goose. He said of the origin of the name: "Really it just popped in my head one day and I just liked it. It is certainly influenced/derived from duck duck goose, but other than that there is no relation, e.g., a metaphor." DuckDuckGo was featured on TechCrunch's Elevator Pitch Friday in 2008, and it was a finalist in the 2008 BOSS MashableChallenge. In July 2010,...

    DuckDuckGo's results are a compilation of "over 400" sources, including Yahoo! Search BOSS, Wolfram Alpha, Bing, Yandex, its own web crawler (the DuckDuckBot) and others. It also uses data from crowdsourced sites, including Wikipedia, to populate knowledge panel boxes to the right of the results. As of March 2021[update], it had 97,653,174 daily searches on average. DuckDuckGo positions itself as a search engine that puts privacy first and as such it does not store IP addresses, does not log user information, and uses cookiesonly when required. Gabriel Weinberg, creator of DuckDuckGo, states: "By default, DuckDuckGo does not collect or share personal information. That is our privacy policy in a nutshell." It maintains logs of all search terms used "though not in a personally identifiable way". Weinberg has refined the quality of his search engine results by deleting search results for companies he believes are content mills, such as Demand Media's eHow, which publishes 4000 articles...

    In addition to the indexed search results, DuckDuckGo displays relevant results, called Instant Answers, on top of the search page. These Instant Answers are collected from either third party APIs or static data sources like text files. The Instant Answers are called zeroclickinfo because the intention behind these is to provide what users are searching for on the search result page itself so that they do not have to click any results to find what they are looking for. Instant answers are created by and maintained by a community of over 1,500 open source contributors. This community has come to be known as DuckDuckHack. As of July 2019[update], there were 1236 Instant Answers active. In the DuckDuckHack documentation, four types of Instant Answers are described: Goodies, Spices, Fatheads, and Longtails. These types of Instant Answer extensions are differentiated by how their data is retrieved. Goodies do not retrieve data from a third party API, whereas Spices do. Goodies instead us...

    In August 2010, DuckDuckGo introduced anonymous searching, including an exit enclave, for its search engine traffic using Tor network and enabling access through a "Tor hidden service" (onion service), 3g2upl4pq6kufc4m.onion is the DuckDuckGo Onion service on Tor.This allows anonymity by routing traffic through a series of encrypted relays. Weinberg stated: "I believe this fits right in line with our privacy policy. Using Tor and DDG, you can now be end to end anonymous with your searching. And if you use our encrypted homepage, you can be end to end encrypted as well."

    DuckDuckGo includes "!Bang" keywords, which give users the ability to search on specific third-party websites – using the site's own search engine if applicable. As of August 2020, 13,564 "bangs" for a diverse range of internet sites are available.In December 2018, around 2,000 "bangs" were deleted. Some of them were deleted due to being broken, while others, such as searches of pirated content sites, were deleted for liability reasons.

    DuckDuckGo earns revenue by serving ads from the Yahoo-Bing search alliance network and through affiliate relationships with Amazon and eBay.As a privacy-focused search engine, the ads served on DuckDuckGo are keyword and search-based unlike other search engines that track user behaviour for search ads.

    Some of DuckDuckGo's source code is free software hosted at GitHub under the Apache 2.0 License, but the core is proprietary. DuckDuckGo also hosts DuckDuckHack, a sister site for organizing open source contributions and community projects. The search engine's Instant Answers are open source and are maintained on GitHub, where anyone can view the source code. As of August 31, 2017, DuckDuckHack was placed on maintenance mode; as such, only pull requestsfor bug fixes will be approved.

    In a June 2011 article, Harry McCracken of Time commended DuckDuckGo, comparing it to his favorite hamburger restaurant, In-N-Out Burger: The barebones approach cited in his quote has since changed; for instance, DuckDuckGo now has auto-completion, instant results, and a news tab. McCracken included the site in Time's list of "50 Best Websites of 2011". Thom Holwerda, who reviewed the search engine for OSNews, praised its privacy features and shortcuts to site-specific searches as well as criticizing Google for "track[ing] pretty much everything you do", particularly because of the risk of such information being subject to a U.S. government subpoena. In 2012, in response to accusations that it was a monopoly, Googleidentified DuckDuckGo as a competitor. Weinberg was reportedly "pleased and entertained" by that acknowledgment. In November 2019, Twitter CEO Jack Dorseyrevealed his preference for using the DuckDuckGo search engine rather than Google, stating, "I love @DuckDuckGo. My de...

    In June 2013, DuckDuckGo indicated that it had seen a significant traffic increase; according to the website's Twitter account, on Monday, June 17, 2013, it had three million daily direct searches. On average during May 2013, it had 1.8 million daily direct searches. Some relate this claim to the exposure of PRISM and to the fact that other programs operated by the National Security Agency (NSA) were leaked by Edward Snowden. Danny Sullivan wrote on Search Engine Land that despite the search engine's growth "it's not grown anywhere near the amount to reflect any substantial or even mildly notable switching by the searching public" for reasons due to privacy, and he concluded "No One Cares About "Private" Search". In response, Caleb Garling of the San Francisco Chronicleargued: "I think this thesis suffers from a few key failures in logic" because a traffic increase had occurred and because there was a lack of widespread awareness of the existence of DuckDuckGo. Later in September 20...

    In March 2018, DuckDuckGo introduced a feature to its Android browser app which retrieves the favicon of all visited websites from a service hosted by DuckDuckGo. Several users expressed their privacy concerns regarding this change.DuckDuckGo closed the issue referring to its privacy policy, which states that the service does not store any personal information. This feature was introduced in June 2019 to the iOS app as well. In July 2020, this issue was brought up again on Hacker Newsand DDG CEO Weinberg promised to eliminate the issue by moving this feature directly into the app.

  5. Duck (cricket) - Wikipedia

    en.wikipedia.org/wiki/Duck_(cricket)
    • Etymology
    • Significant Ducks
    • Variations
    • Pair
    • See Also

    The term is a shortening of the term "duck's egg", the latter being used long before Test cricket began. When referring to the Prince of Wales' (the future Edward VII) score of nought on 17 July 1866, a contemporary newspaper wrote that the Prince "retired to the royal pavilion on a 'duck's egg' ". The name is believed to come from the shape of the number "0" being similar to that of a duck's egg, as in the case of the American slang term "goose-egg" popular in baseball and the tennis term "love", derived - according to one theory - from French l'œuf("the egg"). The Concise Oxford Dictionary still cites "duck's egg" as an alternative version of the term.

    The first duck in a Test match was made in the first Test, between Australia and England at Melbourne in March 1877, when Ned Gregory was caught by Andrew Greenwood off the bowling of James Lillywhite.As of 2017, the record for the most ducks in Test cricket is held by West Indies player Courtney Walsh, who was out for nought on 43 occasions,while the overall first-class record is 156, set by Worcestershire and England player Reg Perks. One particularly high-profile example of a duck came in 1948, when Don Bradman was playing his final Test match for Australia, against England at The Oval. In Australia's first innings, Bradman was bowled for a duck by Eric Hollies, causing his Test average to fall from 101.39 to 99.94; had he scored just four runs, his average would have been 100. As things turned out, Australia won the match by an innings, and so Bradman did not get to bat a second time (had he batted, he would have needed at least 104 runs if dismissed or at least four runs if not...

    There are several variations used to describe specific types of duck. The usage or prevalence of many of these terms vary regionally, with one term having different meanings in different parts of the world. Even within commentary from ESPN Cricinfo or individual cricket board websites, there is no uniform application of some of these terms. 1. Players who are dismissed by the first ball they face are said to have been dismissed for a golden duck. This term is applied uniformly throughout the cricket world. 2. A batsman who is dismissed without facing a ball (most usually run out from the non-striker's end, but alternatively stumped or run out off a wide delivery) is said to be out for a diamond duck,but in some regions that term has an alternative definition.

    To be dismissed for nought in both innings of the same two-innings match is to be dismissed for a pair,because the two noughts together are thought to resemble a pair of spectacles; the longer form is occasionally used. To be dismissed first ball in both innings (i.e., two golden ducks) is to suffer the indignity of making a king pair.

  6. 其他人也問了

    Where does the company DuckDuckGo get its name?

    What's the definition of a duck in cricket?

    What do you call a duck that lays eggs?

    Where does the term duck duck goose come from?

  7. DuckDuckGo - 維基百科,自由的百科全書

    zh.wikipedia.org/zh-hk/DuckDuckGo
    • 總覽
    • 歷史
    • 評論
    • 流量

    DuckDuckGo的搜尋結果彙集了超過400個來源的內容,包括Yahoo! Search BOSS(英語:Yahoo! Search BOSS)、Wolfram Alpha、Bing、它的網絡爬蟲程式DuckDuckBot。它也會使用源於眾包網站的數據(包括維基百科),把它們填入頁面上方的資訊框內,用以作主題的簡要介紹和展示其他相關主題。 DuckDuckGo是一款定位為「把私隱放在第一位」的搜尋引擎。為此其不會儲存用戶的IP地址、記錄用戶的資訊、當用戶要求在用戶端儲存Cookies時才會設置之。DuckDuckGo的創始人蓋布瑞·溫伯格指出:「一言蔽之,我們的私隱政策就是在默認情況下不收集和分享用戶的個人資訊」,然而他們會記錄用戶所輸入的關鍵詞。 溫伯格為了提高他的搜尋引擎結果質素,而把一些他相信為內容農場的網站從中刪去,其中包括聘請了自由職業作者來擇寫每日4000多篇文章的EHow。溫伯格指它們是「為了在google搜尋引擎目錄中能獲得較佳的排名而產生的低質內容」。除此之外DuckDuckGo也會過濾含有大量廣告的頁面。

    2008年2月29日,蓋布瑞·溫伯格在賓夕法尼亞州福吉谷推出DuckDuckGo。溫伯格是一名實業家,曾經建立社交網站Names Database,但其現已關站。DuckDuckGo在剛剛建立時的支出完全由溫伯格個人負擔,現在則由一些網頁廣告收入來分擔費用,不過用戶也可以選擇停止顯示廣告。它的搜尋引擎是由Perl寫成的,並在nginx、FreeBSD、Linux上運行。DuckDuckGo是一款以各大型搜尋服務商(比如Yahoo! Search BOSS)為基的應用程式介面,因此TechCrunch上有報導指它是一個「混合的」搜尋引擎。當被問及為什麼取這個被認為可笑的網站名稱時,溫伯格如此解釋:「說實話,它就是某天突然靈光一現地出現在腦海,而且我很中意。它當然是源自,或說受到「Duck duck goose」(跟「丟手絹」類近的一款遊戲)的影響,但除此之外沒有其他的關聯或隱喻。」DuckDuckGo曾在TechCrunch的Elevator Pitch Friday上亮相。在BOSS Mashable挑戰賽中,DuckDuckGo進入了決賽圈。 2010年6月,蓋布瑞·溫伯格啟動了DuckDuckGo社群網頁讓大眾報告使用問題,討論如何推廣搜尋引擎,尋求新功能以及討論開放原始碼。 2011年1月,DuckDuckGo因在三藩市架設了一塊寫有「Google會跟蹤你,我們不會」的廣告牌,而獲得了關注。 2011年10月,合廣投資公司投資了DuckDuckGo。DuckDuckGo在合廣投資公司的合作夥伴布拉德·伯納姆說:「我們注資DDG,是因為我們相信只有它有能力改變搜尋引擎之間的競爭,而現在正是時候」。除此之外,Trisquel、Linux Mint、Midori網絡瀏覽器已在之前把DuckDuckGo設為預設搜尋引擎。在2012年5月,DuckDuckGo平均每日處理的搜尋量達到150萬宗。溫伯格指它在2011年的收入為115,000美元,僱用了3名員工及一些外判商。Compete.com估計在2012年4月,總共有266,465名獨立訪客存取該網站。2011年4月13日,Alexa顯示DuckDuckGo前三個月的造訪量增長率達到了51%。DuckDuckGo自身的網站流量統計顯示,在2012年8月其每天平均造訪量為1,393,644次,高於2010年4月的...

    《時代雜誌》作者哈里·麥克拉肯(Harry McCracken)於2011年6月發表的評論中高度讚揚DuckDuckGo,並將它與作者最愛的漢堡餐廳In-N-Out漢堡比對: DuckDuckGo在其發表評論後進行了改版,並已加入自動完成及即時結果。麥克拉肯後把其名列在《時代雜誌》的「2011年度50大最佳網站」之中。 湯姆·郝瓦達(Thom Holwerda)在為《OSNews》評估各大搜尋引擎時,讚掦DuckDuckGo對私隱的重視及跳轉至其他特定網站搜尋的捷徑。並批評Google「跟蹤你差不多所有的活動」,這一批評主要是基於美國政府會把相關活動資訊視作傳喚證據的風險而作。在2012年,Google對批評其為壟斷企業的指責進行了回應,在回應中Google把DuckDuckGo視為競爭對手看待。溫伯格對此感到「捧腹不已般的高興」。 學習編程的開源社群自由編程營(Free Code Camp)創始人昆西·拉森說「如果有人對Google極度不放心,他會強烈推薦他們使用另一款搜尋引擎DuckDuckGo。……Google的建立以黑客倫理為基礎,他們在某些方面是把原則置於利潤之上的」 。

    DuckDuckGo官方表示其流量在2013年6月有顯著的上升趨勢。2013年6月17日,DuckDuckGo在其Twitter頁面上發文指其每天平均處理的直接搜尋量達300萬宗;相比之下5月每天平均只有180萬宗。一些來源稱此一趨勢跟稜鏡計劃的披露有關。技術專家丹尼·沙利文(Danny Sullivan)在搜尋引擎行銷教學網站Search Engine Land上稱,儘管相關數字的確有所增長,但「其還不能夠顯着地反映用戶因私隱原因,而作的任何實質性改變,甚至些微的改變也不能從中看出……沒有人會關注『具有私隱性的』搜尋」 。《三藩市紀事報》的迦勒·耶林(Caleb Garling)對此回應道:「我認為這篇文章在邏輯上犯了一些根本性的錯誤,因為流量的確增加了,且可從中看出作者對DuckDuckGo的理解有限」。 到了9月,DuckDuckGo每天平均處理的搜尋量達400萬宗;在2015年6月達1000萬宗;此一數字後於2017年11月翻倍。 截至2021年3月,DuckDuckGo每日處理的平均累積搜尋量達98,629,221宗。此外每月處理的搜尋量於2019年1月突破了1億大關。

  8. Peking duck - Wikipedia

    en.wikipedia.org/wiki/Peking_duck
    • History
    • Preparation
    • Serving
    • Crispy Aromatic Duck
    • See Also

    Duck has been roasted in China since the Southern and Northern Dynasties. A variation of roast duck was prepared for the Emperor of China in the Yuan Dynasty. The dish, originally named "shāo yāzi" (燒鴨子), was mentioned in the Complete Recipes for Dishes and Beverages (飲膳正要) manual in 1330 by Hu Sihui (忽思慧), an inspector of the imperial kitchen. The Peking roast duck that came to be associated with the term was fully developed during the later Ming Dynasty, and by then, Peking duck was one of the main dishes on imperial court menus. The first restaurant specialising in Peking duck, Bianyifang, was established in the Xianyukou, close to Qianmenof Beijing in 1416. By the Qianlong Period (1736–1796) of the Qing Dynasty, the popularity of Peking duck spread to the upper classes, inspiring poetry from poets and scholars who enjoyed the dish. For instance, one verse of Dūmén zhúzhīcí, a Beijing local poem was, "Fill your plates with roast duck and suckling pig". In 1864, the Quanjude (全聚德)...

    Raising the duck

    The ducks used to prepare Peking duck originated in Nanjing. They were large, had black feathers, and lived in the canals that linked the city to major waterways. With the relocation of the Chinese capital to Beijing, supply barge traffic increased in that area. Often these barges spilled water into side-canals, providing a habitat for the ducks. By the time of adoption of five-spice powder, a new breed of duck had been domesticated by Chinese farmers. Nowadays, Peking duck is prepared from t...

    Cooking the duck

    Fattened ducks are killed, plucked, eviscerated and rinsed thoroughly with water.[citation needed] Air is pumped under the skin through the neck cavity to separate the skin from the fat. The duck is then soaked in boiling hot water for two hours before it is hung up to dry. While it is hung, the duck is glazed with a layer of runny syrup, and the inside is rinsed once more with water. A second layer of glaze/marinade of soy sauce, five-spice powder, and more maltose is then applied inside and...

    Closed-oven style

    Peking duck is originally roasted in a closed oven (Chinese: 焖炉), and Bianyifang is the restaurant that keeps this tradition. The closed oven is built of brick and fitted with metal griddles (Chinese: 箅子; pinyin: bì zi). The oven is preheated by burning Gaoliang sorghum straw (Chinese: 秫秸; pinyin: shú jiē) at the base. The duck is placed in the oven immediately after the fire burns out, allowing the meat to be slowly cooked through the convection of heat within the oven.[citation needed]Contr...

    Peking duck is traditionally carved in front of the guests and served in three stages. First, slices of duck skin are served with sugar and sweet bean sauce as dip. Duck skin is best enjoyed hot and crisp to the bite. The meat is then served with steamed pancakes (simplified Chinese: 春饼; traditional Chinese: 春餅; pinyin: chūn bǐng) and an assortment of vegetable dishes, typically julienned cucumber and spring onion. Traditionally, diners dip slices of duck into the condiments and wrap into the pancake with cucumber and any other ingredients. The wrap is then eaten by hand or with chopsticks. The carved duck (鸭架) – the remainder of the roast duck, with choice cuts removed – can be cooked in three ways. The traditional way is in a broth with ingredients such as Chinese cabbage and soft tofu. The carved duck can also be chopped and stir-fried in sweet bean sauce, or rapidly sautéed and served with salt and pepper (椒鹽). Otherwise, the carved duck is packed to be taken home by the customers.

    Crispy aromatic duck (香酥鴨 xiang su ya) is a similar dish to Peking duck. It is very popular in the United Kingdom,where it was created in the latter half of the twentieth century. The duck is first marinated with spices, then steamed until tender, and finally deep fried until crispy. The meat has less fat and is drier and crispier compared to that of Peking duck.Crispy aromatic duck can also be seen in the United States, usually served with buns rather than pancakes. In Germany, some Asian fusion restaurants also serve crispy aromatic duck (Knusprige Ente), sometimes also labeled as Peking duck (Peking-ente, also Pekingente). The duck is marinated with spices and deep-fried, served together with stir-fried vegetables (Wokgemüse) over fried noodles or with rice.

    • Beijing roast duck
    • 北京烤鴨
    • 北京烤鸭
  9. Duck Donuts - Wikipedia

    en.wikipedia.org/wiki/Duck_Donuts
    • History and Operations
    • Charitable Contributions and Services
    • Products
    • See Also
    • External Links

    Headquartered at 6230 Carlisle Pike in Hampden Township, near Mechanicsburg, Pennsylvania, Duck Donuts was founded in 2006 by Russell "Russ" DiGilio, who saw a need for "warm, fresh, made-to-order doughnuts", and Robin Griffith. Both natives of Delaware County, Pennsylvania, the duo met in 1992 while working in the assisted livingindustry. Prior to Duck Donuts, there were no doughnut shops in North Carolina's Outer Banks. The first Duck Donuts shop was opened in Duck, North Carolina, from which the chain got its name, followed by a second location in Kitty Hawk. The third and fourth Duck Donut shops were opened in Corolla and Kill Devil Hillsrespectively. For half a decade, Duck Donuts was limited to the Outer Banks, but after receiving numerous inquiries about franchising, DiGiglio finally decided to establish the Duck Donuts Franchising Company; the first franchise location was opened in Williamsburg, Virginia, in 2013. Thereafter, the franchise began expanding to other states inc...

    In March 2017, Duck Donuts announced its collaboration with the Nashville-based nonprofit organization Gabe's Chemo Duck Program for children with cancer,and raised some $75,000 in September via its countrywide "Quack Gives Back" initiative.

    Duck Donuts' menu predominantly comprises doughnuts, sandwiches, coffee, and desserts. The "cake doughnuts" at Duck Donuts are made-to-order and customizable, with topping options including "chopped bacon" and peanuts. The entire doughnut-making process is automated using doughnut makers from Belshaw Adamatic. Among the four kinds of breakfast sandwiches sold by Duck Donuts is the OBX, which is described as "a sliced doughnut with egg, cheese, sausage or bacon and topped with maple drizzle and chopped bacon". Duck Donuts' dessert selection includes doughnut sundaes made with Breyersice cream.

    Media related to Duck Donutsat Wikimedia Commons
    • Baked goods, Hot beverages, Iced beverages, Desserts, Sandwiches, Soft drinks
    • US$32 million (2017)
  10. 鴨子型別 - 維基百科,自由的百科全書

    zh.wikipedia.org/zh-tw/Duck_typing
    • 概念樣例
    • 靜態語言中的鴨子型別
    • 與其他型別系統的比較
    • 批評
    • 歷史
    • 實現
    • 外部連結

    考慮用於一個使用鴨子型別的語言的以下虛擬碼: 在樣例中,每次對calculate的呼叫都使用的物件(數字、列表和字串)在繼承關係中沒有聯絡。只要物件支援「+」和「*」方法,操作就能成功。例如,翻譯成Ruby或Python語言,執行結果應該是: 這樣,鴨子型別在不使用繼承的情況下使用了多型。唯一的要求是calculate函式需要作為參數的物件擁有「+」和「*」方法。以下樣例(Python語言)體現了鴨子測試。就in_the_forest函式而言,物件是一個鴨子:

    一些通常的靜態語言如Boo和C#第四版,有一些額外的類型註解,它們指示編譯器將類的型別檢查安排在執行時而不是編譯時,並在編譯器的輸出中包含用於執行時型別檢查的代碼。這些附加的內容允許這些語言享受鴨子型別的大多數益處,僅有的缺點是需要在編譯時辨識和指定這些動態類。

    結構型別系統

    鴨子型別和結構類型(英語:Structural type system)相似但與之不同。結構類型由類型的結構決定類型的相容性和等價性,而鴨子型別只由結構中在執行時所存取的部分決定類型的相容性。Objective Caml語言使用結構型別系統。

    介面

    介面可以提供鴨子型別的一些益處,但鴨子型別與之不同的是沒有顯式定義任何介面。例如,如果一個第三方Java庫實現了一個使用者不允許修改的類,使用者就無法把這個類別的實例用作一個自己定義的介面的實現,而鴨子型別允許這樣做。

    模板或泛型

    模板函式或方法在一個靜態型別上下文中應用鴨子測試;這同時帶來了靜態和動態型別檢查的一般優點和缺點。同時,由於在鴨子型別中,只有「在執行時被實際呼叫的」方法需要被實現,而模板要求實現「在編譯時不能證明不可到達(英語:Unreachable code)的」所有方法,因此鴨子型別更具有可伸縮性。 實例包括帶有模板的C++語言和Java語言的泛型。

    關於鴨子型別常常被參照的一個批評是它要求程式設計師在任何時候都必須很好地理解他/她正在編寫的代碼。在一個強靜態型別的、使用了類型繼承樹和參數型別檢查的語言中,給一個類提供未預測的物件類型更為困難。例如,在Python中,你可以建立一個稱為Wine的類,並在其中需要實現press方法。然而,一個稱為Trousers的類可能也實現press()方法。為了避免奇怪的、難以檢測的錯誤,開發者在使用鴨子型別時需要意識到每一個「press」方法的可能使用,即使在語意上和他/她所正在編寫工作的代碼沒有任何關係。 本質上,問題是:「如果它走起來像鴨子並且叫起來像鴨子」,它也可以是一隻正在模仿鴨子的龍。儘管它們可以模仿鴨子,但也許你不總是想讓龍進入池塘。 鴨子型別的提倡者,如吉多·范羅蘇姆,認為這個問題可以通過在測試和維護代碼庫前擁有足夠的了解來解決。 對鴨子型別的批評傾向於成為關於動態型別和靜態型別的爭論的更廣闊的觀點的特殊情形。

    Alex Martelli很早(2000年)就在發布到comp.lang.python新聞群組上的一則訊息(頁面存檔備份,存於網際網路檔案館)中使用了這一術語。他同時對鴨子測試的錯誤的字面理解提出了提醒,以避免人們錯誤認為這個術語已經被使用。 1. 「換言之,不要檢查它是不是一個鴨子:檢查它像不像一個鴨子地叫,等等。取決於你需要哪個像鴨子的行為的子集來使用語言。」

    在ColdFusion中

    web應用程式手稿語言ColdFusion允許函式參數被指定為類型為any。對於這種參數,任意物件都可被傳入,函式呼叫在執行時被動態繫結。如果物件沒有實現一個被呼叫的函式,一個可被擷取並優雅地處理的執行時異常將被丟擲。在ColdFusion 8中,這也可以被一個已定義的事件onMissingMethod()而不是例外處理器處理。另一個可替代的參數類型WEB-INF.cftags.component限制傳入參數是一個ColdFusion組件(CFC),在一個不正確的物件傳入時它提供了更好的錯誤訊息。

    在C#中

    C# 4.0實現了動態成員查詢(dynamic member lookup)實現了鴨子型別化。注意下例中類別方法InTheForest的參數類型被聲明為dynamic。

    在Common Lisp中

    Common Lisp提供了一個物件導向的擴充(Common Lisp物件系統,簡寫為CLOS)。在Common Lisp中,CLOS和Lisp的動態型別使鴨子型別成為一種通用的編程風格。 使用Common Lisp,使用者通常不需要查詢類型,因為如果一個函式不適用,系統會丟擲一個執行時錯誤。這個錯誤可以被Common Lisp的條件系統處理。在類外定義的方法也可以為指定的物件定義。 Common Lisp通常的開發風格(像SLIME一樣使用Lisp REPL)也允許互動式修復: 通過這種方法,軟體可以通過擴充只有部分工作的使用鴨子型別的代碼來開發。

    Duck Typing: Ruby(頁面存檔備份,存於網際網路檔案館)
    How to duck type? - the psychology of static typing in Ruby(頁面存檔備份,存於網際網路檔案館)
    Python術語表中的duck-typing詞條(頁面存檔備份,存於網際網路檔案館)
    Dr. Dobbs June 01 2005: "Templates and Duck Typing"(頁面存檔備份,存於網際網路檔案館)
  11. Wikipedia

    www.wikipedia.org

    Download Wikipedia for Android or iOS Save your favorite articles to read offline, sync your reading lists across devices and customize your reading experience with the official Wikipedia app. Google Play Store