User:SWinxy/V (programming language): Difference between revisions
Appearance
Content deleted Content added
→V Language Wikipedia Article: --removed |
←Replaced content with '<!-- Previous article deleted -->' Tag: Replaced |
||
Line 1: | Line 1: | ||
<!-- Previous article deleted --> |
|||
{{User sandbox}} |
|||
<!-- EDIT BELOW THIS LINE --> |
|||
<!-- TESTING FOR ARTICLES, MAKING SURE THEY ARE CORRECT AND WELL STYLED --> |
|||
=V (programming Language)= |
|||
{{Infobox programming language |
|||
| name = V Language |
|||
| logo = https://vlang.io/img/v-logo.png |
|||
| logo_size = 200px |
|||
| logo_alt = V Language |
|||
| released = 2019 (Beta) |
|||
| designer = Alex Medvednikov |
|||
| developer = Alex Medvednikov and Community |
|||
| influenced_by = [[Go (programming language)|Go]], [[Rust (programming language)|Rust]], [[C (programming language)|C]] |
|||
| file ext = .v |
|||
| programming language = |
|||
| platform = |
|||
| operating_system = [[Cross-platform]] |
|||
| license = [[MIT License]]<ref name="license">{{cite web |
|||
| url = https://github.com/vlang/v/blob/master/LICENSE |
|||
| title = V Lang / LICENSE |
|||
| date = 2019-01-19 | accessdate = 2020-02-25 |
|||
| website = github.com | publisher = V Language Devs |
|||
}}</ref> |
|||
| website = {{URL|http://vlang.io/}} |
|||
}} |
|||
V is a general-purpose programming language with features optimized for ''"Simple, fast, safe, compiled language for developing maintainable software"''<ref name="headline">{{cite web |
|||
| url = https://vlang.io |
|||
| title = V Language / Tagline |
|||
| accessdate = 2020-02-25 |
|||
| website = vlang.io | publisher = V Language Developers. |
|||
}}</ref> The language itself works with the V compiler, written in V itself though was originally written in Go.<ref name="faq">{{cite web |
|||
| url = https://vlang.io/#faq |
|||
| title = V Language / Original Language |
|||
| accessdate = 2020-02-25 |
|||
| website = vlang.io | publisher = V Language Developers |
|||
}}</ref> V compiles down to machine code and a C language backend.<ref name="faq">{{cite web |
|||
| url = https://vlang.io/#faq |
|||
| title = V Language / Original Language |
|||
| accessdate = 2020-02-25 |
|||
| website = vlang.io | publisher = V Language Developers |
|||
}}</ref> |
|||
V has no garbage collection in the compiler<ref name="memory management">{{cite web |
|||
| url = https://vlang.io/docs#memory |
|||
| title = V Language / Documentation (Memory Management) |
|||
| accessdate = 2020-02-25 |
|||
| website = vlang.io | publisher = V Language Developers |
|||
}}</ref>, a module system (known as VPM), and a UI module (maintained by the V language developers)<ref name="ui">{{cite web |
|||
| url = https://github.com/vlang/ui |
|||
| title = V Language / V Ui GitHub Repository |
|||
| accessdate = 2020-02-25 |
|||
| website = github.com | publisher = V Language Developers |
|||
}}</ref>. It also has a section where they promote programs, libraries, and other pieces of software built-in V<ref name="software">{{cite web |
|||
| url = https://vlang.io/#software |
|||
| title = V Language / Software |
|||
| accessdate = 2020-02-25 |
|||
| website = vlang.io | publisher = V Language Developers |
|||
}}</ref>. The V developers also work on other projects in V such as V-OS.<ref name="vos">{{cite web |
|||
| url = https://github.com/vlang/vos |
|||
| title = V Language / V-OS |
|||
| accessdate = 2020-02-25 |
|||
| website = github.com | publisher = V Language Developers |
|||
}}</ref> |
|||
== Language Examples == |
|||
A normal hello world script. |
|||
<syntaxhighlight lang="rust"> |
|||
// This would be found in a v lang hello world file |
|||
fn main() { |
|||
println("Hello world") |
|||
} |
|||
</syntaxhighlight> |
|||
V language HTTP/Time modules. Borrowed from the example on the main website (modified for it to work)<ref name="time+http example">{{cite web |
|||
| url = https://vlang/io |
|||
| title = V Language |
|||
| accessdate = 2020-02-25 |
|||
| website = vlang.io | publisher = V Language Developers |
|||
}}</ref>. |
|||
<syntaxhighlight lang="rust"> |
|||
import time |
|||
import net.http |
|||
fn main() { |
|||
resp := http.get('https://vlang.io/utc_now') or { |
|||
println('failed to fetch data from the server') |
|||
return |
|||
} |
|||
t := time.unix(resp.text.int()) |
|||
println(t.format()) // 2019-08-16 17:48 |
|||
} |
|||
</syntaxhighlight> |