在Cadence SKILL(专有的EDA语言,基于LISP& SCHEME)中,可以在过程中定义参数类型。
如果给出了错误的参数类型,它将会出错。请参阅下面的shell报告:
procedure( foo( ko "t" ) printf( "Hey %s\n" ko ) )
>foo
>foo("1")
>Hey 1
>t
foo(1)
>*Error* foo: argument #1 should be a string (type template = "t") - 1
有没有像Ruby那样漂亮的东西?也就是说,在方法界面定义中,而不是正文,进行类型检查?
谢谢。
答案 0 :(得分:1)
你可以做到这一点" nifty"像这样:
Do u need like this
<style>
div.parent
{
display:table;
text-align:center;
}
div.child
{
display:table-cell;
vertical-align:center;
}
</style>
<html>
<head>
<body>
<div class="parent">
<div class="child">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
<div class="child">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and </div>
<div class="child">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five </div>
</body>
</head>
答案 1 :(得分:0)
你可以随时
fail 'Keep input as a string' unless variable_name.is_a?(String)
虽然它不是动态的打字语言思维方式,但试着实现鸭子打字