Dynamically typed txhais li cas?
Dynamically typed txhais li cas?

Video: Dynamically typed txhais li cas?

Video: Dynamically typed txhais li cas?
Video: This Is My DREAM PC Case! - Lian Li O11 AIR MINI 2024, Kaum ib hlis
Anonim

Dynamic Typing . Dynamic Typing : cov cuab yeej ntawm ib hom lus nyob qhov twg hom kuaj yog feem ntau ua tau thaum lub sijhawm ua haujlwm. Ib qho txawv yog dynamically ntaus ntawv thaum lub hom ntawm cov khoom nws yuav npe yog tsis tau teev nyob rau lub sij hawm compile. Ib qhov program yog dynamically ntaus ntawv yog tias nws siv tsawg kawg yog ib qho dynamically ntaus ntawv sib txawv.

Xav txog qhov no, qhov txawv ntawm hom lus dynamically typed thiab hom lus statically typed yog dab tsi?

Ua ntej, dynamically - yam lus ua hom tshuaj xyuas ntawm runtime, thaum statically ntaus hom lus ua hom kev kuaj xyuas ntawm lub sijhawm sau. Cov txawv lus dag hauv thawj kab ntawm Java piv txwv, int num;, uas txhais num 's data type as int.

Tsis tas li ntawd, puas yog dynamically ntaus ntawv? Tswv yim yog ib qho statically scoped programming lus, uas txhais tau hais tias txhua qhov kev siv ntawm ib qho kev sib txawv yog txuam nrog lexically pom tseeb khi ntawm qhov sib txawv. Lwm yam lus nrog latent hom (tseem hu ua tsis muaj zog ntaus ntawv los yog dynamically ntaus ntawv hom lus) suav nrog APL, Snobol, thiab lwm yam lus ntawm Lisp.

Tib neeg kuj nug, vim li cas cov lus dynamically typed?

Qhov zoo ntawm dynamically - yam lus : Qhov no ua rau lub voj voog debug luv luv thiab tsawg cumbersome. Qhov ncua sij hawm qhia los ntawm cov kauj ruam ua ke tuaj yeem cuam tshuam thiab rhuav tshem koj txoj kev xav. Txawm tias 10-thib ob compile kauj ruam yuav ntxiv mus ntxiv.

Vim li cas Python dynamically ntaus ntawv?

Python Kev ua haujlwm sib txawv yog txawv ntawm qee yam lus nrov xws li c, c ++ thiab java. Piv txwv li: pib ib txoj hlua tus nqi rau qhov sib txawv ntawm int tsis raug tso cai thiab qhov kev zov me nyuam yuav tsis sau. Tab sis Python yog a dynamically ntaus ntawv lus. Nws tsis paub txog cov hom ntawm qhov sib txawv kom txog thaum lub code khiav.

Pom zoo: