云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > Preface

Preface

  • 62 次阅读
  • 3 次下载
  • 2025/7/14 16:26:23

Preface

This book was written with the intention of making anybody with a little programming experience able to use Pike. It should also be possible to gain a deep understanding of how Pike works and to some extent why it works the way it does from this book. It will teach you how to write your own extensions to Pike. I have been trying for years to get someone else to write this book, but since it seems impossible without paying a fortune for it I will have to do it myself. A big thanks goes to Ian Carr-de Avelon and Henrik Wallin for helping me iron out some of the rough spots. The book assumes that you have programmed some other programming language before and that you have some experience of UNIX.

Introduction

This introduction will give you some background about Pike and this book and also compare Pike with other languages. If you want to start learning Pike immediately you can skip this chapter.

Overview

This book is designed for people who want to learn Pike fast. Since Pike is a simple language to learn, especially if you have some prior programming experience, this should benefit most people.

Chapter one is devoted to background information about Pike and this book. It is not really necessary to read this chapter to learn how to use and program Pike, but it might help explain why some things work the way they do. It might be more interesting to re-read the chapter after you have learned the basics of Pike programming. Chapter two is where the action starts. It is a crash course in Pike with examples and explanations of some of the basics. It explains the fundamentals of the Pike data types and control structures. The systematic documentation of all Pike

capabilities starts in chapter three with a description of all control structures in Pike. It then continues with all the data types in chapter four and operators in chapter five. Chapter six deals with object

orientation in Pike, which is slightly different than what you might be used to.

The history of Pike

In the beginning, there was Zork. Then a bunch of people decided to make multi-player adventure games. One of those people was Lars Pensj?at the Chalmers university in Gothenburg, Sweden. For his game he needed a simple, memory-efficient language, and thus LPC (Lars Pensj?C) was born. About a year later I started playing one of these games and found that the language was the most easy-to-use language I had ever encountered. I liked the language so much that I started improving it and before long I had made my own LPC dialect called LPC4. LPC4 was still geared towards writing adventure games, but was quite useful for writing other things with as well. A major problem with LPC4 was the copyright. Since it was based on Lars Pensj?s code, it came with a license that did not allow it to be used for commercial gain. So, in 1994 I started writing 礚PC, which was a new but similar LPC interpreter. I got financial backing from Signum Support AB for writing 礚PC. Signum is a company dedicated to supporting GNU and GPL software and they wanted to create more GPL software.

When 礚PC became usable, InformationsV鋠arna AB started using it for their web-server. Before then, Roxen (then called Spinner) was

non-commercial and written in LPC4. Then in 1996 I started working for InformationsV鋠arna developing 礚PC for them. We also changed the name of 礚PC to Pike to get a more commercially viable name.

A comparison with other languages

Python

Python is probably the language that is most like Pike. Pike is faster and has better object orientation. It also has a syntax similar to C++, which makes it more familiar for people who know C++. Python on the other hand, has a lot more libraries available. C++

Pike's syntax is almost the same as for C++. A huge difference is that Pike is interpreted. This makes the code slower, but reduces compile times to almost nothing. For those few applications which require the speed of C or C++, it is often easier to write a Pike extension than to write the whole thing in C or C++. Lisp and Scheme

Internally Pike has a lot in common with simple interpreted Lisp and Scheme implementations. They are all stack based, byte-compiled, interpreted languages. Pike is also a 'one-cell' language, just like Scheme. Pascal

Pike has nothing in common with Pascal. Tcl/Tk

Pike is similar to Tcl/Tk in intent and they both have good string handling. Pike has better data types and is much faster however. On the other hand Tcl/Tk has X windows system support.

What is Pike

Pike is:

? ? ? ? ? ? ? ? ?

A programming language Object oriented Interpreted Fast Dynamic High-level similar to C++ easy to extend (a fish)

Pike has:

? ? ? ? ? ?

Garbage collection

Advanced string functions

6 years of development behind it

Advanced data types such as associative arrays Support for bignums Builtin socket support

How to read this manual

This manual uses a couple of different typefaces to describe different things: italics

Italics is used as a placeholder for other things. If it says a word in the text it means that you should put your own word there. bold

Bold is just used to emphasize that this word is not merely what it sounds like. It is actually a term. fixed size

Fixed size is used to for examples and text directly from the computer. Also, please beware that the word program is also a builtin Pike data type.

Table of contents

Preface

Table of contents Introduction

Overview

The history of Pike

A comparison with other languages What is Pike

How to read this manual 1 Getting started

1.1 Your first Pike program 1.2 Improving hello_world.pike 1.3 Further improvements 1.4 Control structures 1.5 Functions

1.6 True and false 1.7 Data Types

2 A more elaborate example

2.1 Taking care of input 2.1.1 add_record() 2.1.2 main()

2.2 Communicating with files 2.2.1 save() 2.2.2 load()

2.2.3 main() revisited 2.3 Completing the program 2.3.1 delete() 2.3.2 search() 2.3.3 main() again 2.4 Then what?

2.5 Simple exercises 3 Control Structures

3.1 Conditions 3.1.1 if 3.1.2 switch 3.2 Loops 3.2.1 while 3.2.2 for

3.2.3 do-while 3.2.4 foreach

3.3 Breaking out of loops 3.3.1 break

搜索更多关于: Preface 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

Preface This book was written with the intention of making anybody with a little programming experience able to use Pike. It should also be possible to gain a deep understanding of how Pike works and to some extent why it works the way it does from this book. It will teach you how to write your own extensions to Pike. I have been trying for years to get someone else to write this book, b

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com