やじゅ@アプリケーション・ラボ わんくま支局

目次

Blog 利用状況

ニュース

プロフィール

MSMVP

Visual BasicでRoslynを使ってみる

これは、Visual Basic Advent Calendar 2013 12/3日の記事。

Visual Studio 2013が発売されました、いつもならVisual Basicも新機能が追加されて「Visual Basic 2013」になるかと思ったのですが、残念ながら新機能の追加は見送れました。

No new C# and VB Language Features in VS 2013
言語的な新機能なし(C#もVBも、VS 2013で)
上記ブログによれば
・(ツールのアップデート間隔を短くしても)言語のアップデートは今まで通り(2~3年間隔)のペースがいいと思っている
・Roslynプロジェクトが進行中で、C#、VB のコンパイラーを再実装中
マイクロソフト全体として製品のリリース サイクルを縮めており、ランタイム、ライブラリ、言語、ツールはそれぞれのタイミングでリリースしていく方針になっていくようです。

昨年は、Yieldステートメントについて記事を書いてみたのですが、今年は新機能が無いのでどうしようか悩んだのですが、以前から「Roslyn」というキーワードが気になって軽く調べたりしてたけど、特に深く追求したりしてなかったので、今年はこれを機会に追求してみます。

■Roslynとはなんぞや?
「Roslyn」は、なんて読むのかというと「ロズリン」です。開発コードネームなので製品時に名称が変わることもありえますが、そのままの名前になりそうな予感です。開発コードネームは地名とか多かったりするのですが、「Roslyn」もワシントン州の町の名前だったりします。

Roslynは、Compiler as a Serviceと呼ばれていた言語機能の解析エンジンです。
コンパイラの機能として、プログラムを解析し、エラーなどの検出を行い、一通りのエラーが解消すると実行形式のオブジェクトを生成したりしますが、これらの中身については一般的にブラックボックス化されています。
Roslynでは、ブラックボックス化されたC# や Visual Basicのコード解析やオブジェクト生成のAPI等を公開したのです。

■Roslynで何が出来るのか?
例えば文字列変数にソースコードをセットすると、文字列変数から言語解析して実行させることが出来ます。
C#でありますが、参照:Visual Studio Express で Roslyn のコードを見るとイメージ出来るでしょう。

使いこなせれば、TypescriptのようにJavascriptを拡張したように、Visual Basicを拡張させることが出来るかも知れません。
Visual Basicには足りない複数行コメントを使えるように出来たり、リスト内包を書けばLinqに変換させるようなことも可能でしょう。

Roslyn の恐怖 - Compiler as a service の全貌」の最後の方に書かれていますが、C#/VB間のソースコード自動変換がコピーアンドペーストするだけで自動的に変換されます。C#をコンパイル後にVisual Basicに変換されるために、正確にしかも必ず動作するように変換されるわけです。

Roslynを活用すれば新たなコード生成機能や言語機能の追加、コード解析、リファクタリングなどを行うためのプログラム生成に役立てることができるわけです。


次回以降は、導入方法および実際にプログラムを組んでみたいと思います。少し調査したのですが、C#のサンプルに比べてVisual Basicのサンプルはかなり乏しいです。その上、C#にはある「Syntax.ParseStatement」という文字列のソースを解析するメソッドがVisual Basicには見当たらないなど、何点か機能的にC#より追いついていないのかも知れません。また、CTP(Community Technology Preview)「配布する対象を限定した評価版」であるため、サンプルでも変更されたメソッドがあってエラーになったりします。参照「CTP2からの変更
例 SyntaxTree.ParseCompilationUnitがなくなって、ParseTextとParseFileに変更


【参照】
Visual BasicでRoslynを使ってみる その2
Visual BasicでRoslynを使ってみる その3
Visual BasicでRoslynを使ってみる その4

投稿日時 : 2013年12月3日 0:19

コメントを追加

# ivermectin cost http://stromectolabc.com/
ivermectin 4 2022/02/08 2:52 Busjdhj

ivermectin cost http://stromectolabc.com/
ivermectin 4

# price of doxycycline https://doxycyline1st.com/
doxycycline 100mg dogs 2022/02/26 0:07 Jusidkid

price of doxycycline https://doxycyline1st.com/
doxycycline 100mg dogs

# doxycycline vibramycin https://doxycyline1st.com/
buy doxycycline 2022/02/26 8:29 Doxycycline

doxycycline vibramycin https://doxycyline1st.com/
buy doxycycline

# odering doxycycline https://doxycyline1st.com/
doxycycline 50mg 2022/02/26 20:10 Doxycycline

odering doxycycline https://doxycyline1st.com/
doxycycline 50mg

# clomid buy online http://clomidus.store/ 2022/04/12 12:24 Clomids

clomid buy online http://clomidus.store/

# CjTgIlLcZt 2022/04/19 11:12 johnanz

http://imrdsoacha.gov.co/silvitra-120mg-qrms

# clomid buy https://clomidonline.icu/ 2022/07/08 13:04 Clomidj

clomid buy https://clomidonline.icu/

# ivermectin scabies https://stromectolbestprice.com/ 2022/07/29 23:58 BestPrice

ivermectin scabies https://stromectolbestprice.com/

# cheap prednisone online https://deltasone.icu/
prednisone 10 mg canada 2022/08/22 9:13 Prednisone

cheap prednisone online https://deltasone.icu/
prednisone 10 mg canada

# online no prescription metformin https://glucophage.top/
metformin otc 2022/08/23 7:22 Niujsdkj

online no prescription metformin https://glucophage.top/
metformin otc

# gnc ed pills https://ed-pills.xyz/
buy ed pills online 2022/09/16 19:09 EdPills

gnc ed pills https://ed-pills.xyz/
buy ed pills online

# vibramycin 100 mg https://buydoxycycline.icu/ 2022/10/08 11:38 Doxycycline

vibramycin 100 mg https://buydoxycycline.icu/

#  https://clomidforsale.site/ 2022/11/13 14:01 ForSale

https://clomidforsale.site/

# buy prednisone online india https://prednisonepills.site/
prednisone 5 mg tablet price 2022/11/28 23:55 Prednisone

buy prednisone online india https://prednisonepills.site/
prednisone 5 mg tablet price

# our time dating website https://datingonlinehot.com/
christian dating 2022/12/09 19:22 Dating

our time dating website https://datingonlinehot.com/
christian dating

# buy ed pills online https://cheapestedpills.com/
medication for ed 2022/12/10 16:11 CheapPills

buy ed pills online https://cheapestedpills.com/
medication for ed

# men's ed pills https://edpills.science/
ed treatments 2023/01/07 13:53 EdPills

men's ed pills https://edpills.science/
ed treatments

# free meeting online https://datingonline1st.com/
dating services 2023/01/17 22:32 Dating

free meeting online https://datingonline1st.com/
dating services

# ï»¿Medicament prescribing information. drug information and news for professionals and consumers.
https://edonlinefast.com
Prescription Drug Information, Interactions & Side. All trends of medicament. 2023/02/16 12:59 EdPills

Medicament prescribing information. drug information and news for professionals and consumers.
https://edonlinefast.com
Prescription Drug Information, Interactions & Side. All trends of medicament.

# All trends of medicament. Read now.
https://edonlinefast.com
Actual trends of drug. Cautions. 2023/02/17 7:09 EdPills

All trends of medicament. Read now.
https://edonlinefast.com
Actual trends of drug. Cautions.

# Medicament prescribing information. Get here.
https://edonlinefast.com
Comprehensive side effect and adverse reaction information. Get here. 2023/02/17 20:03 EdOnline

Medicament prescribing information. Get here.
https://edonlinefast.com
Comprehensive side effect and adverse reaction information. Get here.

# Get warning information here. Everything information about medication.
https://canadianfast.com/
Everything information about medication. Medicament prescribing information. 2023/02/19 18:13 CanadaBest

Get warning information here. Everything information about medication.
https://canadianfast.com/
Everything information about medication. Medicament prescribing information.

# gel per erezione in farmacia https://viasenzaricetta.com/# 2023/04/16 9:14 ViaSenza

gel per erezione in farmacia https://viasenzaricetta.com/#

# buy doxycycline for dogs - https://doxycyclinesale.pro/# 2023/04/21 17:19 Doxycycline

buy doxycycline for dogs - https://doxycyclinesale.pro/#

# generic ed pills: https://edpills.pro/# 2023/05/15 15:18 EdPillsPro

generic ed pills: https://edpills.pro/#

# paxlovid india https://paxlovid.life/# paxlovid buy 2023/07/25 20:32 Paxlovid

paxlovid india https://paxlovid.life/# paxlovid buy

# buy cytotec https://cytotec.ink/# - buy cytotec pills 2023/07/26 14:25 PillsFree

buy cytotec https://cytotec.ink/# - buy cytotec pills

# ed medication https://edpills.ink/# - medications for ed 2023/07/26 20:07 EdPills

ed medication https://edpills.ink/# - medications for ed

# meeting with my lady 2023/08/09 19:27 WayneGurry

local single women near me: https://datingtopreview.com/# - free dating date

# migliori farmacie online 2023 2023/09/24 21:16 Archieonelf

https://farmaciaonline.men/# farmacie on line spedizione gratuita

# internet apotheke 2023/09/26 15:35 Williamreomo

http://onlineapotheke.tech/# online apotheke versandkostenfrei
п»?online apotheke

# farmacia online migliore 2023/09/26 22:09 Archieonelf

https://farmaciabarata.pro/# farmacia online envГ­o gratis

# online apotheke gГјnstig 2023/09/27 0:34 Williamreomo

http://onlineapotheke.tech/# online apotheke deutschland
online apotheke deutschland

# versandapotheke 2023/09/27 0:59 Williamreomo

http://onlineapotheke.tech/# versandapotheke deutschland
gГ?nstige online apotheke

# online apotheke preisvergleich 2023/09/27 1:31 Williamreomo

https://onlineapotheke.tech/# versandapotheke deutschland
versandapotheke

# п»їonline apotheke 2023/09/27 3:00 Williamreomo

http://onlineapotheke.tech/# gГ?nstige online apotheke
online apotheke gГ?nstig

# gГјnstige online apotheke 2023/09/27 6:50 Williamreomo

https://onlineapotheke.tech/# online apotheke deutschland
online apotheke preisvergleich

# п»їonline apotheke 2023/09/27 10:35 Williamreomo

https://onlineapotheke.tech/# п»?online apotheke
internet apotheke

# п»їonline apotheke 2023/09/27 12:52 Williamreomo

http://onlineapotheke.tech/# versandapotheke
online apotheke deutschland

# п»їonline apotheke 2023/09/27 13:10 Williamreomo

http://onlineapotheke.tech/# versandapotheke deutschland
internet apotheke

# farmacie online sicure 2023/09/27 18:11 Rickeyrof

acheter sildenafil 100mg sans ordonnance

# farmacia online miglior prezzo 2023/09/27 19:31 Rickeyrof

acheter sildenafil 100mg sans ordonnance

# п»їfarmacia online migliore 2023/09/27 22:31 Rickeyrof

acheter sildenafil 100mg sans ordonnance

# ed medications online 2023/10/07 16:45 BobbyAtobe

Quick service without compromising on quality. https://doxycyclineotc.store/# buy doxycycline 100mg canada

# buy doxycycline 100mg pills 2023/10/08 9:52 GaylordPah

They source globally to provide the best care locally. http://edpillsotc.store/# cheap ed pills

# doxycycline 50 mg 2023/10/09 11:49 GaylordPah

They provide access to global brands that are hard to find locally. https://doxycyclineotc.store/# doxycycline 50 mg india

# best erection pills 2023/10/09 13:10 BobbyAtobe

I'm always informed about potential medication interactions. https://edpillsotc.store/# cheapest ed pills

# canadian cheap rx 2023/10/16 18:42 Dannyhealm

They provide valuable advice on international drug interactions. https://mexicanpharmonline.shop/# mexican rx online

# your canada drug store 2023/10/16 19:50 Dannyhealm

Their flu shots are quick and hassle-free. http://mexicanpharmonline.com/# reputable mexican pharmacies online

# canadian prescriptions in usa 2023/10/16 21:38 Dannyhealm

They maintain a high standard of hygiene and cleanliness. http://mexicanpharmonline.com/# mexican border pharmacies shipping to usa

# canadian pharmacie 2023/10/17 13:21 Dannyhealm

Their patient education resources are top-tier. http://mexicanpharmonline.shop/# mexico drug stores pharmacies

# canadian drug stores 2023/10/17 13:55 Dannyhealm

The staff is well-trained and always courteous. http://mexicanpharmonline.com/# mexico drug stores pharmacies

# prescription online canada 2023/10/17 18:58 Dannyhealm

Generic Name. https://mexicanpharmonline.com/# mexican mail order pharmacies

# top canadian pharmacies 2023/10/18 0:04 Dannyhealm

A gem in our community. http://mexicanpharmonline.shop/# reputable mexican pharmacies online

# top rated canadian mail order pharmacies 2023/10/18 0:39 Dannyhealm

The widest range of international brands under one roof. http://mexicanpharmonline.com/# mexican rx online

# canada meds online 2023/10/18 18:00 Dannyhealm

A place where customer health is the top priority. https://mexicanpharmonline.com/# mexico drug stores pharmacies

# Plavix 75 mg price https://plavix.guru/ plavix best price 2023/10/23 21:17 Plavixxx

Plavix 75 mg price https://plavix.guru/ plavix best price

# vibramycin 100 mg https://doxycycline.forum/ generic doxycycline 2023/11/25 9:10 Doxycycline

vibramycin 100 mg https://doxycycline.forum/ generic doxycycline

タイトル  
名前  
URL
コメント